SSH Keychain Access in Mac OSX Sierra

Prior to Sierra keys were persisted between logins – and with an update to ssh Keychain is no longer used by default. It can get frustrating to be prompted to enter your passphrase for a key after an upgrade and after each restart.

In your ~/.ssh/config file you will need the following lines:

Host *
    UseKeychain yes
    AddKeysToAgent yes
    IdentityFile ~/.ssh/id_rsa

Change ~/.ssh/id_rsa to the filename of your private key and if you utilise multiple keys also add an IdentityFile line for each of them.

You also need to initially add the key to save the passphrase to Keychain for the first time using:

ssh-add -K ~/.ssh/id_rsa

Leave a Reply

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