Setting Up SSH Keys to Connect from Windows to a Linux Server with Putty

The following is a how to on getting putty set up putty on a Win XP box to enable you use an RSA (or DSA) private/public key pair to connect to a linux server over SSH.

  • Generate your keys on the linux server to which you want to connect.
  • SSH to your server
  • go to your home directory .ssh/
  • Enter the following command to generate the key pair:
  • # ssh-keygen -t rsa
  • Enter a passphrase for your keys

This will generate two files: id_rsa and id_rsa.pub. id_rsa is the private key.
Transfer the id_rsa file to your client/local machine. Delete the id_rsa file from the server.
Use puttygen.exe to convert the private key to a format that putty.exe will like

  • Fire up puttygen.exe
  • Select File/Load Private Key
  • Enter your passphrase that you entered when generating your key pair
  • Click on the “Save Private Key” button to save a format of this private key to your local drive.

Open putty.exe

  • By default putty.exe starts with the “Session” screen selected.
  • Click on Connection/SSH/Auth
  • Under “Private key file for authentication” click on “Browse” and select the private key that you converted in the aforementioned step.
  • Go back to the Session screen, specify the IP address or name of your server and save the session.

Connect to the server:

  • Run putty.exe
  • Simply double-click on the saved session and it will open up an SSH session to your server and you will be prompted to enter your passkey.

Leave a Reply