How to Disable Password Login on VPS (Ubuntu/Debian)

How to Disable Password Login for VPS (Ubuntu/Debian)

Disable password login and enforce SSH key authentication for better VPS security. This guide applies to Ubuntu, Debian, and similar Linux distributions.

Prerequisites


Steps to Disable Password Login

1. SSH into Your VPS

ssh root@your_server_ip

2. Edit SSH Config

Open SSH config:

nano /etc/ssh/sshd_config

Find and set:

PasswordAuthentication no
PermitRootLogin prohibit-password

3. Reload SSH

systemctl reload sshd

4. Test Login in New Terminal

Before logging out, open a new SSH session and verify you can still login via SSH key:

ssh root@your_server_ip

5. Done

Password logins are now disabled. Only SSH key logins are accepted.


Notes

  • Always test in a new terminal to avoid being locked out.

  • Use Console/Serial access if SSH access fails.


Related

 

  • disable password login ssh, secure ssh access, ssh key only login, ubuntu ssh disable password, debian ssh disable password, sshd_config password authentication no, vps ssh security hardening
  • 21 Users Found This Useful
Was this answer helpful?

Related Articles

How to Request an rDNS (PTR) Update

If you need to update the rDNS (PTR) record for your VPS or dedicated server, please follow the...

Requesting mail access (Port 25)

By default, port 25 is blocked on all servers for outgoing email to prevent spam and abuse. If...

How to Add SSH Key for a New User on VPS (Ubuntu/Debian)

  How to Add SSH Key for a New User on VPS (Ubuntu/Debian) You can allow other users to access...

How to Setup SSH Key Authentication on VPS (Ubuntu/Debian)

  How to Setup SSH Key Authentication on VPS (Ubuntu/Debian) Secure your VPS by logging in with...

Powered by WHMCompleteSolution