If you regularly use Putty to do remote login on a machine and you find it inconvenient to type username and password everytime, then this post is for you. Go ahead and read how in few easy steps you can configure putty to avoid username and password for secure remote logins.
Step 1:
Download and run Putty Key Generator from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
Step 2:
Click on the ‘Generate’ button. Once it has generated the key it will look something like the screen shown below. You can provide the passphrase to protect this private key but it is optional. The default parameter to generate the key SSH-2 RSA is good enough and you can leave it as it is.
Step 3:
Click on “Save the private key”. Save the key in a file say key.ppk. Storing the public key is not really needed as you can easily generate it by loading the private key in putty key generator.
Step 4:
Now you need to put the public key on the remote system where you would like to login. To do this, login to the remote machine and go to the home directory of the user with which you login to the remote system. Now create a directory named .ssh in the home directory of the user and create a authorized_keys file in this directory. Copy and paste the public key generated in the previous step into the authorized_keys file. See the screen shot below of the authorized_keys file containing the public key.
mkdir ~/.ssh touch ~/.ssh/authorized_keys echo ssh-rsa AAAAB3Nza … = rsa-key-20100203 >> ~/.ssh/authorized_keysStep 6:
Now click on the Connection –> Data in the left panel. Specify the user name in the ‘Auto-login username’ in the input box on the right panel.
Step 7:
Now click on the Connection –> SSH –> Auth in the left panel. Click the browse button and specify the name and location of the private key which was created in the Step 3.
Step 8:
Finally click on the Session in the left panel and click on the ‘Save’ button to save the configuration by the name of the session that you have specified. Once this is done you are done with your configurations and you can start using putty for secure remote logins without the need to specify the username and password on every login.
Step 9:
Now simply run the putty and choose the session name for which you have done the configuration. This should automatically login the remote machine and would look something like the screenshot shown below.
Ending Notes:
You can also use the public private key pair for configuring WinSCP for secure file copy.
Please do leave your comments if you found this post useful.
Useful Links:
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
http://en.wikipedia.org/wiki/Public_key_cryptography
http://winscp.net/eng/index.php
Awesome tutorial!
Thanks.
Thanks for the tutorial. You may also need to “chmod 700 .ssh; chmod 600 .ssh/*”