I have set Remote Login to "on" for my Mac OS X so that I can ssh into it from somewhere else. For security reason, I want to disable password authentication and only allow public key authentication.

I have the following line in /etc/ssh/ssh_config:

PasswordAuthentication no

However, it also prevents me from login to other servers from my Mac using password authentication:

$ sftp username@some_host
Permission denied (publickey,password).
Connection closed

I don't have permission to change settings on the some_host and have to use password authentication. How can I configure my ssh correctly so that it requires public key authentication for inbound connection only, but not the other way around?


I think you want to edit /etc/ssh/sshd_config (not ssh_config).

See also: https://superuser.com/questions/364304/how-do-i-configure-ssh-on-os-x/993713

  • Thanks it works! I think I need to order a pair of glasses : ) – Yuhao Zhang Aug 29 '16 at 19:37

You must log in to answer this question.

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