How to configure Password-less authentication from Windows to Linux using Putty

How to configure Password-less authentication from Windows to Linux using Putty

I have already written few articles to configure passwordless authentication between two Linux servers, here in this article I will share the steps to configure password less login from Windows to Linux box using Putty

How to configure Password-less authentication from Windows to Linux using Putty

My setup:
==========================
Windows Box: 192.168.1.2
Linux Box: 192.168.1.5
==========================

You can download and install Putty from their official page based on your Windows environment.

My Putty files are available at C:Program FilesPuTTY as below

Here double click on "puttygen.exe" to open this tool which can be used to generate new private and public key

How to configure Password-less authentication from Windows to Linux using Putty

This tool is similar to Linux based ssh-keygen, next in the puttygen tool, select the key type and bit size which you would like use for the generated key.

Here for my example I am using 2048 bit size RSA-2 key

How to configure Password-less authentication from Windows to Linux using Putty

Once you click on "Generate" both private and public key will be generated.

Next change the comment to something which can be more meaningful and you can remember in future, like for me I have used root@192.168.1.5 since I plan to use this key for root user for my Linux node 192.168.1.5

Since we want to perform a password less authentication hence I will leave the password section blank, in case if you wish to assign a passphrase then provide the same here

How to configure Password-less authentication from Windows to Linux using Putty

Next save the private key to your machine.

I am saving it by below name
golinuxhub-server-id_rsa

How to configure Password-less authentication from Windows to Linux using Putty

Now it is time to copy the public key to the Linux box
Since I want to use this for root user I will append the public key to root user's authorized keys

The public key can be seen in the highlighted section, copy this and append the key to /root/.ssh/authorized_keys on 192.168.1.5 (my Linux box)

How to configure Password-less authentication from Windows to Linux using Putty

On my Linux box

NOTE: If /root/.ssh does not exists you can manually create this


# mkdir /root/.ssh
# chmod 700 /root/.ssh

as you see below I have appended my public key to the root user's authorized_keys file

[root@golinuxhub-server root :~]# ls -ld .ssh/
drwx------. 2 root root 80 Apr  8 16:18 .ssh/

[root@golinuxhub-server root :~]# cat .ssh/authorized_keys
ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEApAhmZgOtgHLjxbbpUkjvpTjhN9WaVMy7gUw1sH2Uo8P9hgdSoGzs1zhNG7o/D4xuSJ2JfmWAMSqhJHtmgeszRNerPvAWWVOq7F98sS1W2fhHH/kShDnP05QXcUQxZnm+97iQHDBLb280KkXwj48NmpZP722AKIL/qaYVwS5TRnpgTrOLpa7zv9y5MaeH6+MmMmV6n0U5A8+LFf0qYPQYJ4oSFolA0anHJDDM9Gqw3JVX2mgyEOR7+H6R36LE01Fy5kgSBSX8KjGyF6VsssiUF1aDWsB3KEO3eHRuRIgfBfMTXV0K+rjFLSqnVj/m0/+pLx9JngYaGSFZNEHe4/4Irw== root@192.168.1.5

Now since everything is done it is time to create and save a session for my Linux box in the Putty with the private key.

Open Putty and add the Linux box IP as shown below

How to configure Password-less authentication from Windows to Linux using Putty

Navigate to SSH -> Auth
and Browse to the private key which was created above

How to configure Password-less authentication from Windows to Linux using Putty

Next navigate back to "Session" as shown below and "save" the changes

How to configure Password-less authentication from Windows to Linux using Putty

This will create a new shortcut with the host name as shown below. Select the hostname and click on Load, next click on "Open" to open a new connection

How to configure Password-less authentication from Windows to Linux using Putty

Next attempt to login using root, as you see it does not prompts for password this time and logs in without and passphrase

How to configure Password-less authentication from Windows to Linux using Putty

I hope the article was useful.

Leave a Comment