Saturday, August 4, 2012

Password-Free SSH on OS X Mountain Lion

I had set up my home network with password-free ssh access between various Mac computers. But when I recently upgraded to OS X Mountain Lion, this stopped working.

Turns out /etc/sshd_config is modified during Mountain Lion installation. The following line gets unchecked:

# 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


Once I had renamed ~/.ssh/authorized_keys2 to ~/.ssh/authorized_keys on my Mountain Lion computers, everything worked fine again.

6 comments:

  1. This took me days to figure out.. thanks for confirming that something on 10.8 had changed!!

    ReplyDelete
  2. I've linked & resposted.. again may thanks

    ReplyDelete
  3. My Mountain Lion 10.8.2 does not have a ~/.ssh/authorized_keys at all. It does have the known_hosts file.

    In the /etc/sshd_config file, rsa appears to be commented out, but in the ~/.ssh directory there is id_rsa and id_rsa.pub.

    In the known_hosts file there are lots of keys that have ssh-rsa following the ip address.

    What do I put in the authorized_keys file or how do I create it?

    ReplyDelete
  4. Hi,

    You should copy the contents of the ~/.ssh/id_rsa.pub file on the computer you want to connect FROM, and paste into ~/.ssh/authorized_keys on the computer you want to connect TO.

    You can create ~/.ssh/authorized_keys if it doesn't already exist.

    Cheers,

    Francis

    ReplyDelete
  5. I haven’t any word to appreciate this post.....Really i am impressed from this post....the person who create this post it was a great human..thanks for shared this with us. tech release

    ReplyDelete