How to Disable SSH Password Authentication on Linux VPS

How to Disable SSH Password Authentication on Linux VPS

How to Disable SSH Password Authentication on Linux VPS

Are you concerned about the security of your server? Using password authentication for SSH may not be as safe as you think. If a hacker gets hold of your SSH password, your valuable information is at risk. In this tutorial, we’ll show you how to disable password authentication for SSH on your Linux VPS, making your server much safer.

What You’ll Need

  • A working Linux OS based server / VPS
  • Root access to your server / VPS via SSH command line

Step 1 — Configuring SSH Key Authentication on Your Server

Before we begin, it’s important to set up another authentication method, such as SSH Key authentication, before disabling password authentication. This ensures that you won’t get locked out of your own server. Once you’ve configured your SSH Keys, you can proceed with this tutorial.

Step 2 — Editing SSH Configuration File

Before proceeding with this step, make sure you have completed Step 1 and successfully connected to your VPS using SSH keys. Follow these steps:

  1. Connect to your server/VPS with root SSH credentials.
  2. Open /etc/ssh/sshd_config configuration file with a text editor like nano or vim via SSH command line. Run the command: nano /etc/ssh/sshd_config
  3. Find the line PasswordAuthentication yes and change it to PasswordAuthentication no.
  4. Save the changes and exit by pressing Ctrl + X, typing in Y, and pressing Enter.
  5. Restart the SSHD service to apply the changes. Run the command: service sshd restart

That’s it! SSH password authentication has been disabled on your server. Now, only privileged users with SSH keys or other advanced authentication methods will be able to connect.

Conclusion

By following this tutorial, you have successfully disabled SSH password authentication on your Linux VPS. This significantly improves the security of your server, as no one will be able to connect via SSH using a password. Only privileged users with SSH keys or advanced authentication methods will have access. Stay safe!

👉
Start your website with Hostinger – get fast, secure hosting here
👈


🔗 Read more from MinimaDesk:


🎁 Download free premium WordPress tools from our Starter Tools page.

How to Start an Online Boutique in 10 Minutes
How to Set Up WooCommerce Google Analytics Integration for Your Online Store
My Cart
Wishlist
Recently Viewed
Categories