# 🔐 Disable direct root SSH login
Objective
Improve server security by restricting direct root login via SSH.
Why this matters
Reduces brute-force risk against the root account
Limits blast radius if credentials are leaked
Forces least-privilege access through sudo
Step 1: Connect to the server
bash
ssh {user}@{ip-address}Example:
bash
ssh tony@52.186.140.102Step 2: Edit SSH configuration
bash
sudo nano /etc/ssh/sshd_configFind:
bash
PermitRootLogin yesChange to:
bash
PermitRootLogin noStep 3: Restart SSH
Depending on the distro:
bash
sudo systemctl restart sshor
bash
sudo systemctl restart sshdStep 4: Verify
bash
sudo grep PermitRootLogin /etc/ssh/sshd_configExpected:
bash
PermitRootLogin noSecurity best practices (recommended)
Use SSH keys instead of passwords
Limit SSH access to specific IPs (firewall or security group)
Keep sudo access limited to trusted admins
Consider changing the default SSH port only if it fits your operational model