Howto: Automatic OS X Leopard ssh-agent

Update: March 9, 2010

Somehow I failed to notice that since 10.5 ssh agent is automatically started by OS X. My script just duplicated work that was already built-in to the OS.

To add a passphrase for a private key just type:

ssh-add -K keyfile_rsa

After this, ssh-agent is started automatically whenever ssh needs it. No extra work needed.

I found that the "sudo touch

I found that the "sudo touch /var/db/useLS" command given at http://www-uxsup.csx.cam.ac.uk/~aia21/osx/leopard-ssh.html with a reboot worked for me. The site says that you don't need the touch with Leopard, but with Snow Leopard it didn't work for me until I did it. HTH

You can also make a shell

You can also make a shell alias which adds your key to ssh-agent when ssh is called. I find this preferable to storing your private key password in the Keychain. I use tcsh, so this alias does the trick:

alias ssh 'if (`ssh-add -l` == "The agent has no identities.") ssh-add; /usr/bin/ssh'

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Allowed HTML tags: <blockquote> <a> <em> <b> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
You must prove you are not a bot.
Personnel