Key Based SSH Logins With PuTTY

In SSH, key based authentication are more secure while connecting to a server.

On Windows Desktops we use application called Putty for accessing a linux server using SSH. We can enable key based authentication in Putty.

1. First we have to create a profile in putty for the target linux server.

2. We have to download the executable file of Puttygen, using this we can generate two key files private and public keys.

3. Open Puttygen then select SSH-2 RSA under type of key to generate and specify 1024as the number of bits in a generated key. Then click “Generate”

4. Please move the mouse pointer over the blank area during the key generation to generate some randomness.

5. Now a private/public key pair has been generated.  Under Key comment, you can enter any comment, then specify a Key pass phrase and repeat it under Confirm pass phrase (This is not must)you’ll need that pass phrase to log in to SSH with your new key. Then click on Save public key and save it. After that click on save private key , you can choose any name but the extension should be .ppk.

6. Now we need to save the public key in our server, copy the public key from puttygen  then logon to target linux server using SSH.

7. We must now create a directory and file in which to store our public key
mkdir ~/.ssh
chmod 700 ~/.ssh
vi ~/.ssh/authorized_keys2
chmod 600 ~/.ssh/authorized_keys2

8. After this restart our Putty program.
Go to SSH >> Auth and click on Browse

9. Browse to the folder where you saved your keys and select the private key. The one with the ppk suffix.

10. Go back to your Session tab and click save.

11. After all these steps we can access the server with added security.


There are no revisions for this post.

Tags: , , , , , , , , ,

No comments yet.

Leave a Reply