How to Disable Password-Based Authentication

Disabling password-based authentication is a crucial step in securing your server. After transitioning to SSH key-based authentication, it's essential to turn off password logins to prevent unauthorized access through weak or stolen passwords. This configuration makes it significantly harder for attackers to compromise your system.

Steps to Disable Password-Based Authentication

Open the SSH configuration file using a text editor,

nano /etc/ssh/sshd_config

Find the line containing PasswordAuthentication and set its value to no,

PasswordAuthentication no

After making the change, save the file and exit the editor,

To apply the changes, restart the SSH service,

systemctl restart sshd

CrownCloud - Get a SSD powered KVM VPS at $4.5/month!
Use the code WELCOME for 10% off!

1 GB RAM / 25 GB SSD / 1 CPU Core / 1 TB Bandwidth per month

Available Locations: LAX | MIA | ATL | FRA | AMS