Tuesday, 2 August 2016

Password less login to a remote machine from Windows via putty & putty gen

So to remotely login to a server via putty without being prompted for a password we need a simple tool called putty gen.
It can be downloaded from the same website as putty.
Once you download it just double click the icon & click on run.

A window like the once in the screen shot shown below will open.


Click on generate & click on Save private key once the keys get generated. This will prompt you to save the keys in a file in .ppk format.

Once you save the file open it with notepad & you'll see that the file contains a public key & a private key. Copy & save the public key in the authorized_keys file under .ssh directory of the user you want to login as.

Make sure that there are no spaces or junk characters in the file & add the suffix ssh-rsa in front of the key.

Heres is an example in which I added the key in ~/.ssh/authorized_keys file fo user sa.


'cat -vet' helps verify that there are no junk characters in the file.
Now open putty.
Click on data & enter user name in the 'auto login username' field.



Click on ssh & then click on auth. Under the private key file for authentication browse to the .ppk key file that you had saved earlier.



Now just enter the server name in the session section & you'll be directly logged in:



No comments:

Post a Comment

Using capture groups in grep in Linux

Introduction Let me start by saying that this article isn't about capture groups in grep per se. What we are going to do here with gr...