Posts tagged ssh

Using Mac OS X 10.5’s keychain for ssh

The version of ssh that comes with Mac OS X 10.5.6 has a -K option that stores your passphrases in your system’s keychain.

Run this:

ssh-add -K [path to private keyfile]

Provide your passphrase once when asked, and keychain will provide the passphrase for you automatically. You should probably enable “Require password to wake this computer from sleep or screen saver” in the Security pane of the System Preferences if you decide to do this.

If you see

$ ssh-add -K
ssh-add: illegal option -- K

it’s because you’re using the macports (or fink) version of ssh. (run ‘which ssh’ to find out). With macports, uninstall the “openssh” package:

sudo port uninstall openssh

The ‘-K’ option was discovered courtesy of http://www-uxsup.csx.cam.ac.uk/~aia21/osx/leopard-ssh.html.

http://kimmo.suominen.com/docs/ssh/ has some excellent ssh documentation.

Accessing git over ssh on a non-standard port

Simple ssh access to a git repo can be sufficient for a small dev team–but what if you’re using a non-standard ssh port?

The solution–do as Linus says. Use ~/.ssh/config.

My config now looks like this:

Host my.servername.org
  Port 1234

Remember that ~/.ssh needs to be 700 (read/write/execute for only the owner), and the files inside are all 600:

$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*