Managing SSH Keys in Mac OS X

For some reason that I haven’t yet worked out my OS X SSH Agent has stopped prompting me for a password when I load it up to add my private key. So I wondered what’s involved to manage my ssh keys with the command line instead.

First up, I had to install my public and private keys in ~/.ssh/

drwx------    5 paul  paul    170 Apr 24 20:32 .
drwxr-xr-x   40 paul  paul   1360 Apr 18 23:19 ..
-rwx------    1 paul  paul    951 Oct  6  2006 id_rsa
-rwx------    1 paul  paul    218 Oct  6  2006

Note the folder needs to be owned by your user with 700 permissions.

Once the keys are in, the actual process of starting an ssh-agent and adding a key is pretty straightforward:

eval `ssh-agent`
ssh-add ~/.ssh/id_rsa

You will be prompted for a password and then that’s it! To confirm your key has been added correctly, you can list all the keys in your agent with:

ssh-add -l

Leave a Reply

Your email address will not be published. Required fields are marked *