I love ssh -A
, which allows me to use my local ssh key when establishing a connection from a remote server. For example, I ssh -A host1.example.com
and then from there I can ssh host2.example.com
(or use git) and it uses my ssh key from the original machine, which in this case should be my mac. Although this has always worked for me on Debian/Ubuntu, it doesn't work on my new mac (Lion).
What am I missing here? How do I configure ssh to work correctly with -A? Do I need an ssh that is not the standard MacOS one?
Best Answer
Actually, the very simple answer is that you have to run
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.