Apple - 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.

Tags:

Macos

Ssh