How to Disable SSH Password Authentication

Linux Help 

As long as you use strong passwords, it is not necessary to disable SSH password authentication for your server; however, you can disable it if you would like.

Before you proceed, keep these things in mind:

  • Disabling password authentication makes it more likely for you to be locked out of your server.
  • You can become locked out if you lose your private key or break your ~/.authorized_keys file.
  • If you are locked out, you will no longer be able to access the files of any apps.

You should only disable SSH password authentication if you are extremely familiar with public key authentication and understand the potential consequences of locking yourself out of your server.

To disable SSH password authentication, SSH in to your server as root to edit this file:

/etc/ssh/sshd_config

Then, change the line

PasswordAuthentication yes

to

PasswordAuthentication no

After making that change, restart the SSH service by running the following command as root:

sudo service ssh restart

Recommended Posts

How to Start Using a Web Hosting Account

Starting with a web hosting account is an essential step in launching your online presence. Whether you’re setting up a personal blog, an e-commerce website, or a professional portfolio, a hosting account serves as the foundation. Here’s a comprehensive guide to help you get started: Step 1: Choose the Right Hosting Plan Before diving into […]

Linux Help 

5 Linux commands to check free disk space

Keeping track of disk utilization information is on system administrators’ (and others’) daily to-do list. Linux has a few built-in utilities that help provide that information. Linux df command The df command stands for “disk-free,” and shows available and used disk space on the Linux system. df -h shows disk space in human-readable format df -a shows the file system’s […]

Linux Help