How To Configure SSH Key Access Authentication Only On Your CentOS SSH Server

Article By: samantha


img

ssh key for VPS

Introduction to SSH Key pairs

This how to assumes you have SSH Key installed on your server. If you do not you can follow either of the how to’s below:

In this tutorial we will be:

  • Changing The SSH Servers Po1rt
  • Allowing connections only va PubkeyAuthentication.

We will begin by editing your SSH servers configuration file: /etc/ssh/sshd_config

vi /etc/ssh/sshd_config

To change the SSH Listening Port. Locate the below line:

# Port 22

Uncomment and change the 22 to some random port number you wish to use to connect to SSH via.

Port 2314

Next lets confirm the following lines are set to yes (these are normally enabled by default and may be commented out):

RSAAuthentication yes
PubkeyAuthentication yes

At this point please make sure your SSH keys are working properly. If they are not you will be unable to log back in via SSH.

Now change the below line to disable PasswordAuthentication and only allow access for ssh keys.

PasswordAuthentication yes

change this to:

PasswordAuthentication no

Now lets restart the SSH service

/etc/init.d/sshd restart

Your SSH server should now be locked down to only allow access via SSH key authentication.




Tags: , , , , , ,


Welcome to the healthcare-only HIPAA - GDPR compliant cloud. Exclusively hosted on a HPC environment!

Learn more or start today by choosing your secure HIPAA - GDPR compliant server's Operating System bellow and pick the package that's best for you.

BIPmd makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine, thousand or more.



Windows VPS options and add ons
Linux VPS options and add ons

>

Looking for a custom solution?

Our technicians can provide you with the best custom-made solutionss on the market, no matter whether you're a small business or large enterprise.

Get in touch

Leave a Reply



Feedbacks