All systems operational

Pay with Bitcoin, Monero, USDT, Ethereum or Solana · email-only sign-up

Security

Hardening SSH on a new server

Keys only, no root passwords, a firewall and automatic updates — without locking yourself out.

5 min readReviewed 25 September 2026

A reinforced door with several locks and a key, in front of a server rack

Use keys, disable passwords

With your key working, create a drop-⁠in file rather than editing the main configuration:

PasswordAuthentication no
KbdInteractiveAuthentication no
PermitRootLogin prohibit-password
MaxAuthTries 3
$ sshd -t && systemctl reload ssh     # "sshd" on AlmaLinux/Rocky

Keep your current session open and test a new login in a second terminal before closing it. If anything goes wrong, the KVM console still gets you in.

Firewall

$ apt install ufw
$ ufw allow 22/tcp
$ ufw allow 443/tcp
$ ufw enable

Automatic security updates

$ apt install unattended-upgrades
$ dpkg-reconfigure -plow unattended-upgrades

Add fail2ban if you must keep password logins for another service.

Security

More in Security

All 3 guides