Friday, October 28, 2011

ssh from Windows to Linux without password using putty

Putty is used heavily to ssh from Windows to Linux systems. It is irritating to keep entering username and password to some of the systems esp test machines which are frequently used and whose security is not of lot of concern or at the most you are ready to use a single passphrase for the same. In my case I wanted to login to my Linux system without using password. This is how I went about doing this.

1. Use puttygen to create public/private key pair. To do this run puttygen and click on "Generate"

2. Now click on "Save public key" and "Save private Key" to save it in a folder of your choice.

3. In a box above you will see something such as :-

ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAIBbarb4KbbSZnttu0F5OqGX
+Vo+TDvNbF3bINcywZamoZrTW4YwAHR6yUaqJX4gv3bFM0pbMlUuYYCkHC
f1xp5ps2NiTrJnm+GnKHdBKRNT4AdlUYDgzEkMgoa0Rz120UO+JkgdVAxcNfDbE
Dlqjk+i6+rIg12/2M1xCc+yjTGBgw== rsa-key-20111028

4. Copy paste this into a file in your Linux system. The file is /home//.ssh/authorized_keys

5. Now open putty and the enter your Linux host details. If it is already present, load it.

6. Goto Connection -> Data on your right hand side menu tree.

7. Enter the username in Auto-Login Username textbox.

8. Goto SSH -> Auth. Browse and choose the private key file under 'Private Key file for authentication'
9. Save it

Now try login and it should take you in directly.

No comments: