Take the 2-minute tour ×

Terminal V. 2.2.2

Mac OS X Lion 10.7.3

I've followed ipsis verbis the steps here:


This works, BUT, if I restart the machine, it promps for the password again!!!

I even add one more, just to make sure it works:

ssh-agent bash

ssh-add ~/.ssh/mykeywithoutextention

#Restart terminal

It stills asks for the password after restart!!

It seems that, as posted here: http://alchemycs.com/2011/08/mac-os-x-lion-terminal-and-ssh-how-to-start-ssh-agent-at-login/

when Mac OS X boots back up and starts Terminal.app at login,ssh-agent is not started before Terminal.app starts

Does anyone have a clue about that could be the issue here and how can we properly solve this?

share|improve this question

2 Answers 2

up vote 16 down vote accepted

On OS X Lion, ssh-agent is configured to start at boot by default. And ssh-agent will always load your default keys (~/.ssh/id_rsa and ~/.ssh/id_dsa). If you have multiple ssh keys (I have one for each client/project) and want ssh-agent to remember them across restarts:

ssh-add -K ~/.ssh/your-other-key

I give mine an expiration as well, although honestly, I don't know if it matters, since the -K adds it to keychain and I believe the expiration is just the agent. Anyway:

ssh-add -K -t 7776000 ~/.ssh/my-other-key
share|improve this answer
Byt he way if ssh-agent should happen to not start at boot time as it just didn't for me, this should get it going: sudo launchctl load /System/Library/LaunchAgents/org.openbsd.ssh-agent.plist sudo launchctl start org.openbsd.ssh-agent –  scooterXL Jun 22 '12 at 14:07

I think you are missing the point with ssh-agent. You're supposed to enter the password once every new session. If you never want to enter the password just create ssh keys without a password.

Btw, in OS X you don't need to bother with ssh-agent and ssh-add at all, it just works.

share|improve this answer
I do have created ssh keys with no password. :( –  MEM Mar 26 '12 at 21:48
If there's no password on the key then ssh won't ask for a password. You must have done something wrong. Just run "ssh-keygen -t rsa", don't enter a password and then upload "id_rsa.pub" to the server you want to connect to (put it in ~/.ssh). –  ggustafsson Mar 26 '12 at 23:08
:) I've tried that and even more. It was a permission related issue on the shared host. Cheers, and thanks. –  MEM Mar 27 '12 at 20:27

Your Answer


