Categories: Windows

How to enable key based authentication

Enable key based authentication

1. Generating Keys

Key generator is available with Putty to generate private and public keys. You can download PuttyGen from here, download Putty.Gen.

1.1 Open PuttyGen and click on Generate button to create your keys.

1.2 Generate randomness to create keys.

The key passphrase option enables additional security.

1.3 Save private key on the local machine.

2. Adding the public key to server

After generating keys we need to add the public key into the server’s authorized_keys file. This file is in the location “/root/.ssh/authorized_keys“;

2.1 Adding key

# vi /root/.ssh/authorized_keys

If it’s not there, create it.
For security reasons, change the file and folder permissions as follows:

[root@hostripples ~]# chmod 600 /root/.ssh/authorized_keys [root@hostripples ~]# chmod 700 /root/.ssh/
Windows

vi /etc/ssh/sshd_config
.
AuthorizedKeysFile      .ssh/authorized_keys
.

If you need to enable only key based authentication in your server, disable password authentication.

PasswordAuthentication no

2.3 Restart SSHD

[root@vps ~]# /etc/init.d/sshd restart
Stopping sshd:                                             [  OK  ]
Starting sshd:                                             [  OK  ]

3, Final step : Connecting to server

Now we have to check whether the keys are working. Please follow the steps to connect server using key.

3.1 Create a “Saved Session”

Here you need to create a new saved session for your key based connection. Mention server IP address, SSH port and session name.

3.2 Add user name

Under “Connections >> Data” add user name to connect to server.

3.3 Add private key

Under “Connections >> SSH >> Auth” you can select the private key that we saved in our machine.

That’s it! Then come to session and save.

Try to connect now 

 

 


Vishwajit Kale
Vishwajit Kale blazed onto the digital marketing scene back in 2015 and is the digital marketing strategist of Hostripples, a company that aims to provide affordable web hosting solutions. Vishwajit is experienced in digital and content marketing along with SEO. He's fond of writing technology blogs, traveling and reading.

Recent Posts

The Ultimate Guide to WordPress Maintenance: Tips and Tricks

When you’re running a business that relies on website traffic and sales to succeed. Then you need to keep it…

4 days ago

Migrate In 2024: Our Comprehensive Website Migration Manual to the Next Level

Migration! Yes, this word is very big in the web hosting industry and it has its importance. Especially for businesses…

6 days ago

Unveiling the Importance of Server Maintenance Plans: A Comprehensive Guide

The server is the backbone of the web hosting industry and it acts like a HERO in the web hosting…

2 weeks ago

IP Address is Blocked? A handpicked list of Solutions to Fix it?

Imagine you are on holiday having a cup of tea and browsing your website or blog.Then, what next?You will get…

3 weeks ago

Explained: Difference between Nameservers Vs. DNS

The web hosting industry is growing every minute, day, and year. It has many terminologies that are important to understand…

1 month ago