Howto, windows

Howto: Passwordless SSH authentication with Putty

Credits: by MSH*, from Flickr CCHaving recently switched to Windows as my main desktop due to some work assignments, I’ve set up Putty to use encryption keys to handle my sessions - this way I don’t need to type in a password every time I need to open a new ssh session. Here is how to do it.

First of all, you need to get Putty from here. While Putty itself is only a tiny executable, I recommend you use the fullinstallable package, as we’ll use other apps from there such as PuttyGen and Pageant. Once installed, fire up PuttyGen and create a new pair of keys by clicking the “Generate” button. You can keep all the options at their default settings. It might be a good idea to set a passphrase for your key. Then, save both public and private key to a safe location. Name your public key <your_key_name>.pub and the private key <your_key_name>.ppk.

Now, upload your public key to a directory in your remote system. You need to import it and add it to the authorized_keys file with the command:

 ssh-keygen -i -f key.pub >> ~/.ssh/authorized_keys

Replace key.pub with the path to your key. Now log out and start Putty.

In Putty, configure the following items:

  • In Connection/Data, add your rmeote username
  • Connection/SSH/Auth, browse to your private key file (<your_key_name>.ppk)
  • Go back to Sessions, fill in the name or IP address of your remote machine, give your session a name and click on Save.

Now we need to set up Pageant - it is Pageant who will be doing the authentication for us. Open it up, right click on the icon in the system tray and select “Add key”. Select your private key. Now you have an item under “Saved sessions” in Pageant - clicking on your session will fire up Putty and Pageant handles authenticaton for you. Great eh? If your key has a passphrase, you will need to enter it only once, and after that Pageant remembers it for you.

Simple and a great time saver if you do this often ;)

some posts that may be related

Viewing 3 Comments

Trackbacks

close Reblog this comment
blog comments powered by Disqus