FL1GHT5 Lab • Privacy & Self-Hosting

SSH Hardening Checklist for Ubuntu Servers

Who This Is For

Beginner. A practical reference you'll come back to on every new server.

Think of it like changing the locks and adding a peephole after buying a house. The door still opens the same way for you, but now only people with the right key get in, and you can actually see who's knocking.

What You'll Build

Key-only SSH access from your local network or VPN, with root password login disabled, done in an order that never locks you out.

Prerequisites

Before Changing Anything

Create a Non-Root Admin User

$adduser youruser
$usermod -aG sudo youruser

Install Your SSH Key

$ssh-copy-id youruser@server-ip

Test logging in with the key from a second terminal before closing your original session.

Disable Password Authentication

Only after confirming key login works. Edit /etc/ssh/sshd_config:

$PasswordAuthentication no
$PermitRootLogin no
$sudo systemctl restart sshd

Restrict Allowed Users

Optionally add AllowUsers youruser to sshd_config to explicitly whitelist who may connect at all.

Configure the Firewall

$sudo ufw allow OpenSSH
$sudo ufw enable

Audit the Result

$sudo sshd -t
$ss -tulpn | grep ssh

Check /var/log/auth.log periodically for repeated failed login attempts.

Security & Backup Notes

Troubleshooting

Lab Finish Line

Key-only SSH from the local network or VPN, with root password login disabled.

What to Build Next

Planning a business implementation?

Explore our infrastructure and systems services.

View services