Tuesday, 1 January 2019

PuTTYgen: Configure SSH Keys for Password less Logins to Linux

PuTTYgen: Configure SSH Keys to Password less Logins to Linux

PuTTY is a free and open-source SSH and telnet client. It is primarily developed by Simon Tatham for Microsoft Windows but now it supports a wide variety of other operating systems. Public key authentication is a feature of PuTTY, in which, we can configure SSH Keys to allow password less logins to Linux machines from our PuTTY terminals.

In this article, we are configuring SSH Keys using PuTTYgen and then configure a CentOS 7 machine for password less logins by PuTTY client.

 

This Article Provides:

     

    Environment Specification:

    One Microsoft Windows based client and a CentOS 7 based server.

     

    Generate SSH Keys using PuTTYgen:

    PuTTYgen is included with PuTTY SSH client. Both are free and open source and distributed under MIT License. Therefore, it is available for free download at PuTTY official website.

    We have already installed PuTTY SSH client on our MS Windows client.

    Search and run PuTTYgen application.

    PuTTYgen-generate-keys-01

    Click on Generate button to generate a SSH Public/Private keys pair.

    PuTTYgen-generate-keys-02

    Meanwhile, we are required to scroll mouse in the area under the progress bar for randomization and generation of SSH Keys.

    PuTTYgen-generate-keys-03

    PuTTYgen has generated a SSH Public/Private keys pair.

    Click on Save private key button to save the SSH Private Key locally.

    PuTTYgen-generate-keys-04

    Since, we are not defining any passphrase, therefore, PuTTYgen is displaying the above warning.

    Ignore it and click on Yes.

    PuTTYgen-generate-keys-05

    We have saved our SSH Private Key in a local directory. You can also save your SSH Public Key in the same way, if you plan to use this same SSH Keys pair for more than one Linux machines.

    PuTTYgen-generate-keys-06

    Select the generated SSH Public Key and copy it to clipboard.

     

    Configure SSH Keys for Password Less Logins to CentOS 7:

    Connect to our CentOS 7 machine using PuTTY and insert SSH Public Key in ~/.ssh/authorized_keys file.

    login as: root root@192.168.116.131's password: Last login: Tue Jan 1 18:58:53 2019 from 192.168.116.1 [root@ssh-server ~]# mkdir ~/.ssh [root@ssh-server ~]# vi ~/.ssh/authorized_keys [root@ssh-server ~]# exit

    Now, open PuTTY and add a session for that CentOS 7 server.

    PuTTYgen-generate-keys-07

    Besides other settings, we are required to include our SSH Private Key as follows:

    PuTTYgen-generate-keys-08

    PuTTYgen-generate-keys-09

    Save first and then open this session.

    login as: root Authenticating with public key "rsa-key-20190101" Last login: Tue Jan 1 18:59:44 2019 from 192.168.116.1 [root@ssh-server ~]#

    Our CentOS 7 server won’t prompt for a password this time.

    We have successfully configured SSH Keys using PuTTYgen for password less logins to Linux machines.

    PuTTYgen: Configure SSH Keys for Password less Logins to Linux


    YOU MIGHT ALSO LIKE:

    No comments:

    Post a Comment