Howto use Pageant and Putty
For those of you who already use PuTTY: Here’s a little improvement that’s surprisingly little known. Probably because it is very hard to explain. But I’ll try.
Here is how you can avoid starting programs, entering login information or indeed typing passwords when you use PuTTY:
- Download Putty installer from the PuTTY Download Page. Make sure to grab the “Installer”
- Install Putty
- Start PuttyGen from Start -> PuTTY-> PuttyGen
- Generate a new key and save it as a .ppk file without a passphrase
- Use Putty to login to the server you want to connect to
- Append the Public Key text from PuttyGen to the text of
~/.ssh/authorized_keys
- Create a shortcut to your .ppk file from Start -> Putty to Start -> Startup
- Select the .ppk shortcut from the Startup menu (this will happen automatically at every startup)
- See the Pageant icon in the system tray? Right-click it and select “New session”
- Enter
_username_@_hostname_
in the “Host name” field - You will now log in automatically.
This process is a bit hard to explain, so I have made a short video that explains it:
In order to streamline things even more, notice how Saved sessions show up under the Pageant icon in your system tray.
Comments:
Johannes Brodwall - Jun 16, 2011
Thanks for a good tip with having a shortcut to the ppk file. I’ve updated the description with this variation.
Personally, I’m getting too old for passwords, though.
[Salve J. Nilsen] - Jun 17, 2011
It’s a passphrase, and you only have to type it in once. I, for example use a 20+ character passphrase that I can type really quick. And it’s the only one I ever have to type.
The trick here is to remember that the agents are your friends. If you turn on key forwarding (using standard commandline ssh, it’s the -A flag), then your authentication goes with you to the server you log in to.
To check if it works after logging in, run “ssh-add -l”. You should then see the fingerprint of your private key from where you’re authenticated.
Works really well for me! :)
Johannes Brodwall - Jun 18, 2011
Sounds cool. So when I have use putty to login to a server, I can use “ssh -A” to use the key for the next hop? It doesn’t seem to work.
[sjn] - Jun 15, 2011
Here’s a better way: Use the PuTTY “Windows installer for everything” and make sure any file associations are installed too. Then create the ppk file (But please use a proper passphrase! You’ll only be asked for it once every login!), and then create a link in the Startup directory to the ppk file.
This will make sure pageant will be started when you log in, and the agent will give you the opportunity to supply your passphrase and remember it for you. PuTTY is smart enough to check with the agent if you have authorized a key there, before it starts asking you for passwords or phrases.
This has worked very well for me for a couple years now. Good luck! :)
Thomas Ferris Nicolaisen - Jun 22, 2011
Thanks for posting this guide, Johannes! It’s nice for us *nix folks who  want to help Windows people get productive with ssh (for example when using TortoiseGit over ssh this is very handy).Â
[Carlo] - Jun 5, 2013
You have the public key on the next hop?
I found this guide to be very helpful: http://www.unixwiz.net/techtips/ssh-agent-forwarding.html
Also regarding being too old to remember passwords, check out http://www.keepassx.org/
Johannes Brodwall - Jun 5, 2013
I found the option in Putty: When connecting, under Connection -> SSH -> Auth there is a checkbox for “Allow agent forwarding”.