Hostxpeed
Login Get Started →
Security

How to Disable Root Login via SSH

4 min read
24 views
Jun 11, 2026

Step 1: Edit SSH Config

sudo nano /etc/ssh/sshd_config

Step 2: Change PermitRootLogin

Find and set:

PermitRootLogin no

Step 3: Save and Restart SSH

sudo systemctl restart sshd

Step 4: Test with Sudo User

ssh username@YOUR_SERVER_IP -p PORT
sudo whoami

⚠️ Ensure you have a working sudo user before disabling root login.

Was this article helpful?