SSH Forwarding is turned off by default in OS X Maverick and Yosemite. Here are the steps to quickly setup and configure other servers to accept your ssh key
- Setting SSH Forwarding on OS X
- Edit the /etc/ssh_config file
sublime /etc/ssh_config
- Look for the ForwardAgent line. By default it’ll look like this
# ForwardAgent no
Modify it to
ForwardAgent yes - Save the file. OS X is now configured to forward your SSH Keys
- For extra security, you could modify your Host configuration from
Host *
to
Host
<ip address of server you want to enable forwarding for>
- Edit the /etc/ssh_config file
- Create and enable your own SSH keys if you haven’t yet
- Set up ssh-copy-id
- Install ssh-copy-id via HomeBrew
brew install ssh-copy-id
- Run ssh-copy-id to the server you want to copy your ssh-key to. This assumes you already have an existing login to the server you need to access
ssh-copy-id <username>@<server ip or server name>
- Install ssh-copy-id via HomeBrew
- You should now be able to SSH to the server without using your username and password but rather your SSH Key going forward. To do that, you type the following:
ssh -A <username>@server ip or server name>