- Checked
- 2026-11-14
A hardening checklist for a small Linux server
Most break-ins on small servers are not clever. They walk through a password login, an old package or a service nobody knew was listening. This list closes those, one area at a time, with a command to check each.
Updates
Install security updates automatically and check once a month that they still arrive. On Debian and Ubuntu, unattended-upgrades does it; apt list --upgradable shows what is waiting. Note the OS version's end of support date: a release that no longer gets fixes cannot be hardened.
SSH
Log in with keys and turn passwords off. In /etc/ssh/sshd_config set PasswordAuthentication no and PermitRootLogin no, keep your current session open, and test a new login from a second terminal before you close it.
Give each person their own account with sudo, so a departure means removing one key. fail2ban, or a limit on SSH connections in the firewall, slows down password guessing that still hits the port.
Firewall and listening services
ss -tulpn lists every port the machine listens on and the program behind it. Anything you cannot name should be stopped or bound to localhost. A database listening on 0.0.0.0 is the classic find.
Then deny incoming traffic by default and allow only what is needed, usually SSH, 80 and 443. With ufw: ufw default deny incoming, ufw allow OpenSSH, ufw allow 80,443/tcp, ufw enable. Check the provider's firewall too; it may be open where yours is closed, or the other way round.
TLS and headers
Redirect http to https, keep the certificate renewing automatically, and send the basic security headers: Strict-Transport-Security, X-Content-Type-Options and a Content-Security-Policy that fits the site. The free server health check reads all of these from outside.
Backups that have been restored
Back up the data and the configuration, to somewhere the server itself cannot delete. Then restore one, to a spare machine or a local copy, and time it. A backup nobody has restored is a guess.
Logs and monitoring
Keep logs long enough to answer "when did this start", a few weeks at least. Have something outside the server tell you when it stops answering or its certificate is about to expire. A server that is broken into often shows it first as a disk filling up or CPU pinned for no reason.
Having it done
Our security hardening is a fixed $109. We review the firewall, SSH, TLS, updates, backups and monitoring, starting with read-only checks, make the changes on the server one area at a time, verify each, and hand you a written report of exactly what changed. It is not a penetration test and not a certification.
Questions people ask
- What is the first thing to harden on a new VPS?
- SSH: keys only, no password logins, no root login. Then a default-deny firewall and automatic security updates. Those three close most of what automated attacks try.
- Is changing the SSH port worth it?
- It cuts log noise from scanners, which is pleasant, but it is not protection. Keys and no passwords are what keep people out.
- Does hardening include a penetration test?
- Ours does not. Nobody attacks the server to see what gives; we review and change the basic defences and write down what changed.
- What does server hardening cost?
- $109 for the review, the changes and the written report, fixed and confirmed with the scope before work starts.
More server help
- Website hacked: the first steps
- Renewing a Let's Encrypt certificate
- Disk full: no space left on device
- Email from the server going to spam
- Server down: what to check first
- 502 Bad Gateway on nginx
- 504 Gateway Timeout
- Error establishing a database connection
- WordPress white screen or critical error
- Too many redirects
- 403 Forbidden on nginx or Apache
- SSL certificate expired: the fix
- DNS not resolving or still on the old server
- Moving a site to a new server
- All server help guides
