Ariejan.net has moved and is now available at https://www.devroom.io

How to enable SSH Forwarding on Mac OS X Snow Leopard

29 July 2010

The other day I was toying with Rubber to deploy a Rails3 app to Amazon EC2. I host the project code in a private Github repository, accessible only with my own SSH key.

In order to checkout your code an any EC2 instance you can do one of two things:

  1. Copy your private SSH key to the instance - This sounds easy enough, but has serious security implications. You do not want to be sending out your private SSH key, do you? That leaves you with option 2.

  2. Let SSH forward the authentication request to your local machine. This is call Forwarding and requires ssh-agent to be running on your system. You’re in luck, ssh-agent is started automatically on your mac.

Now, the problem is that in Leopard (10.5) SSH Forwarding was enabled by default. You guessed it, in Snow Leopard it has been disabled by default. So, it’s up to you to enable SSH Forwarding manually. Here goes:

  1. Open Terminal.app.
  2. sudo vi /etc/ssh_config
    You will be asked for your password now. Feel free to use your preferred editor here.
  3. Add the following two lines to the top of the file:
    Host *
    ForwardAgent yes
  4. Save the file and exit your editor.

All right sparky, you now have enabled SSH Forwarding. Have fun!

PS. If you have enabled “Remote Login” under Sharing Preferences, make sure to stop and start that service to notify it of the changes you just made.