ssh -A doesn't properly enable forwarding of authentication agent connection
Actually, the very simple answer is that you have to run
ssh-add
and then it all works.
Basically, macOS already has the ssh-agent set up for you, but after each reboot you need to add your keys to it. ssh-add gives ssh-agent access to your keys for the current boot cycle. You'll have to enter the password for your private key if you have created one.
As of OS X 10.8 you need to do this once:
sudo touch /var/db/useLS
And add this as part of your ~/.bash_profile
:
if [ -f ~/.ssh/id_rsa ]; then
ssh-add -K ~/.ssh/id_rsa 2>/dev/null
fi
Note: this recipe is parto of my bedouin scripts.
The concept behind ssh -A
are ssh agents. They run in the background and through the use of environment variables the agent can be located and automatically used for authentication when logging in to other machines using ssh. Have a look at the manpage of ssh-agent for more details.
With Mac OS X, the ssh-agent should be started on demand.
For more information see:
- Using SSH Agent With Mac OS X Leopard