Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am looking for a solution that would automatically load multiple RSA keys at login, some of them having passwords stored in the Keychain.

Example: first keys would be obviously in ~/.ssh/id_rsa and let's say that the second cone would be in ~/.ssh/id_rsa.2.

I want them to be loaded automatically, without having to enter their passwords.

share|improve this question
What do you mean by loaded? If the keys are password protected you'll have to enter the password at least once. Then you can choose to save the password to Keychain however. – Gerry Apr 4 '12 at 7:19
So, how to I add the key to the keychain in a persistent mode? – sorin Apr 4 '12 at 9:53
up vote 0 down vote accepted

ssh-agent can do this: use ssh-add -K path/to/key to store the passphrase for the key in your Keychain. Whenever you do something requiring that key you won't be prompted for your password, provided the Keychain is unlocked.

This article gives more information, as does this related ServerFault question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.