On Mac OS X Mountain Lion (10.8) I have setup public/private keys for passwordless SSH to another Mountain Lion machine but when I try to SSH to the other machine it still asks for my password. I have verified permissions of the ~/.ssh directory and the ~/.ssh/authorized_keys2 file are correct. Verbose output from ssh -vvv my.server.com does not show any type of failure and there is nothing indicating a failure in the /var/log/system.log.

My keys work fine when connecting to Linux and Mac OS X Lion (10.7) machines.

1 Answer 1


In Mountain Lion the sshd configuration (/etc/sshd_config) was changed and sshd no longer looks at ~/.ssh/authorized_keys2 for valid keys.

/etc/sshd_config on Lion (line 46):

#AuthorizedKeysFile     .ssh/authorized_keys

/etc/sshd_config on Mountain Lion (line 48):

# The default is to check both .ssh/authorized_keys and .ssh/authorized_keys2
# but this is overridden so installations will only check .ssh/authorized_keys
AuthorizedKeysFile      .ssh/authorized_keys

If you don’t wish to edit the /etc/sshd_config on the target machine you can either rename ~/.ssh/authorized_keys2 to ~/.ssh/authorized_keys or symlink it.

Symlink ~/.ssh/authorized_keys to ~/.ssh/authorized_keys2

ln -s ~/.ssh/authorized_keys ~/.ssh/authorized_keys2

Rename ~/.ssh/authorized_keys2

mv ~/.ssh/authorized_keys2 ~/.ssh/authorized_keys

You must log in to answer this question.

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