Enabling remote login without password authentication

I have enabled remote login (ssh) on my Mac via System Preferences. But it doesn't work with keys and only works with normal user/pass authentication. I want to disable this behaviour and only allow public key (RSA or DSA) authentication.

I edited /etc/sshd_config and uncommented following lines:

PasswordAuthentication no
PermitEmptyPasswords no

I then restarted the Remote Login service but it didn't help. It still allows password authentication and my keys are rejected.

Could anyone help me set this up?


Solution 1:

Allow me to answer myself as I found a resolution.

If PasswordAuthentication no doesn't work on its own (and I read in some situations it may) make sure to uncomment and set to "no" this:

UsePAM no

Kudos for this resolution go to Mac OS X Hints - http://hints.macworld.com/article.php?story=20050815135941513&lsrc=osxh.