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

It seems that ssh-add -K ~/.ssh/id_rsa will load your key but will ask for the password each time you reboot.

I am looking for a solution that would not require me to re-enter the key password between logins.

share|improve this question
Can you say a little more about when the password prompt comes up for you? I ask because I have an ssh-key for a remote server, which I assure you is not the same as my Mac login password or anything, and I haven't had to enter the password for the ssh-key for years. I can just open up a terminal, type "ssh <server>", and I'm there. I think I first set this key up under OSX 10.5. id_dsa, but I don't think that should matter. – khedron Apr 13 '12 at 16:39
My id_rsa key has a password on it. – sorin Apr 13 '12 at 16:46
I also have the problem that I solved this so long ago that I can't remember exactly what I did. But I think the idea is to not run ssh-add, but just run ssh directly. You should get a window popping up that will as the pass phrase for the key, and with a checkbox to let you store it in your keychain. – Harald Hanche-Olsen Apr 13 '12 at 18:19
@Sorin - so does mine! I had to enter it once, long ago, and the Mac has saved it for me ever since. Hopefully Harald's advice will help. – khedron Apr 13 '12 at 18:35
Do you mean the Keychain password (i.e. your login password) or the key's passphrase? If it's the latter, re your passphrases definitely stored in Keychain? You can check this by opening Keychain Access and looking for it in the login keychain. – Mathew Hall Apr 20 '12 at 11:41

You are being prompted for the password every time because your "login" keychain is being locked after inactivity and/or sleeping or in your case a reboot. There are two ways to solve this for you.

  1. Change the settings for your "login" keychain. Assuming your ssh key is stored in the "login" keychain.

    • Open Keychain Access
    • Highlight the "login" keychain
    • Right-click or option-click the "login" keychain
    • Uncheck the "Lock after X minutes of inactivity" and the "Lock when sleeping" checkboxes.
  2. Generate another SSH key without using a passphrase.

    • Open Terminal.
    • Enter command: ssh-keygen -t rsa -b 4096 -C <comment> -f <.ssh/id_rsa>
    • -t is for type, -b is key size, -C is comment, -f output file (must create directories first)
    • Do not set a passphrase.
    • Import SSH key into "login" keychain with ssh-add -K <path to ssh key>

You should not be prompted for a keychain password anymore.

share|improve this answer

Add the public key in:


Public key usually are on:


Hope that helps

share|improve this answer
I think mean the authorized_keys – Rene Larsen May 23 '12 at 18:47
Anyway, this doesn't work if you have more than one key! – sorin May 24 '12 at 10:01

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.