OSX: Don’t ask always for ssh passphrase

Copy your private key to ~/.ssh/

chmod a-r id_rsa
chmod u+r id_rsa

Permissions should read:

.ssh directory: 700 (drwx------)
public key (.pub file): 644 (-rw-r--r--)
private key ( id_rsa ): 600 (-rw-------)

To save the passphrase in the keychain type:

ssh-add -K ~/.ssh/id_rsa

Enter your passphrase.

To tell the ssh agent to use your key from the keychain, create the file ~/.ssh/config and put this in it:

Host *
 UseKeychain yes
 AddKeysToAgent yes
 IdentityFile ~/.ssh/your_id_rsa
 IdentityFile ~/.ssh/your_id_rsa2 (if you have multiple)

Leave a Reply