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:

  1. Download Putty installer from the PuTTY Download Page. Make sure to grab the “Installer”
  2. Install Putty
  3. Start PuttyGen from Start -> PuTTY-> PuttyGen
  4. Generate a new key and save it as a .ppk file without a passphrase
  5. Use Putty to login to the server you want to connect to
  6. Append the Public Key text from PuttyGen to the text of ~/.ssh/authorized_keys
  7. Create a shortcut to your .ppk file from Start -> Putty to Start -> Startup
  8. Select the .ppk shortcut from the Startup menu (this will happen automatically at every startup)
  9. See the Pageant icon in the system tray? Right-click it and select “New session”
  10. Enter username@hostname in the “Host name” field
  11. 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.

About Johannes Brodwall

Johannes is Principal Software Engineer in SopraSteria. In his spare time he likes to coach teams and developers on better coding, collaboration, planning and product understanding.
This entry was posted in English, Technology, video. Bookmark the permalink.

7 Responses to Howto use Pageant and Putty

  1. sjn says:

    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! :)

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

  3. Salve J. Nilsen says:

    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! :)

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

  5. 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). 

  6. Carlo says:

    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/

  7. I found the option in Putty: When connecting, under Connection -> SSH -> Auth there is a checkbox for “Allow agent forwarding”.

Comments are closed.