How to use PuTTY for forwarding keys
Solution 1:
Yes, the option is equivalent, however, it doesn't forward keys in general – it forwards connections to the "SSH agent" specifically. The "agent" holds your keys in memory, decrypted (so you only need to unlock them once), and the client asks it to sign data for authentication.
On Linux/Unix/BSD/Cygwin, OpenSSH's agent program is ssh-agent
(though in some occasions it's replaced by gpg-agent or gnome-keyring, but that doesn't matter here).
Meanwhile, PuTTY on Windows has pageant.exe
for the same purpose. (Other programs, such as WinSCP, also use Pageant.)
First, start the agent and load your keys into it. (Double-clicking the .ppk key file will be enough.) Now, when PuTTY on your PC connects to server A, it will use your key from the agent running on your PC, not from the .ppk file.
- Pageant on PC (agent) ⇆ PuTTY on PC (client) ⇆ sshd on serverA (server)
Similarly, when you're on server A and run ssh serverB
, it tries to contact the agent running on serverA.
- ??? (agent) ⇆ ssh on serverA (client) ⇆ sshd on serverB (server)
If you connected to server A with the "Agent forwarding" or -A
option enabled, then PuTTY will relay the agent connections, and ssh
on serverA will be able to use keys from the agent on your PC.
- Pageant on PC (agent) ⇆ PuTTY on PC (forwarding client) ⇆ sshd on serverA (forwarding server) ⇆ ssh on serverA (client) ⇆ sshd on serverB (server)