Wednesday 9 May 2012

Using Putty to configure passphraseless SSH login to CentOS server


A couple of weeks ago, I re-imaged my laptop again and for some reason I had neglected to backup all the private-public key pairs that I use to logon to our dev servers. Since I use a single server almost all of the time and then ssh from it to other servers, it hasn’t been too much hassle, but today I’ve had enough, so armed with puttygen, which can be downloaded from the putty downloads page here, I resolved to restore my easy access to the dev severs.

A word of caution, not using a passphrase is a security risk and should only be used in private networks without access to the outside world.

So without further ado here are the instructions:
  1. Generate public private key pair with Puttygen:
  2.  
  3. Save private key to a file:
  4.  
  5. Copy public key from window and paste to your user’s .ssh/authorised_keys file (e.g. if your user is called mike you can find this file /home/mike/.ssh/authorised_keys. If the file does not exist create it and give it appropriate permissions [RW for user only]):
     
  6. You can now configure putty. Ensure that the Auto-login name username is correct for your user:

  7. Select the private key saved in step 2:
  8.  
  9. It's always a good idea to save the session, so you don't have to type the settings every time:
  10.  
Enjoy!

No comments:

Post a Comment