We can enable SFTP on our MacOS by going into System Preferences -> Sharing -> Remote Login

This works fine and we can easily connect to our local server by sftp localhost and then provide the password of the current user.

Now, some professional FTP Servers, allow you to connect to the FTP server by using a SSH key. (so you don't have to enter username/password).


I wonder if the SFTP server on MacOS can also be configured to authenticate users using keys rather than raw username/password.


1 Answer 1


Oh I found the answer. we just have to add the public key to the authorized_keys file

cat ~/.ssh/id_rsa.pub | ssh localhost "cat >> ~/.ssh/authorized_keys"

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .