A freshly provisioned server is, by default, not secure. It ships with a default SSH configuration, a full set of services you do not need, and a root account that anyone on the internet can try to guess. Before we point a production domain at a new box, we run through the same ten steps every time.

The checklist

  1. Create a non-root user. Never log in as root. Make a regular user with sudo and disable root SSH login.
  2. Key-based SSH only. Turn off password authentication and use SSH keys. This eliminates the entire class of brute-force password attacks.
  3. Move SSH off port 22. It is not a silver bullet, but it cuts the noise from the constant automated scans.
  4. Install a firewall. Allow only the ports you actually serve (usually 80, 443 and your SSH port) and drop everything else.
  5. Enable automatic security updates. Unattended upgrades for security patches mean you are not the one who notices a CVE three weeks late.
  6. Fail2ban. Ban IPs that repeatedly fail to authenticate, so a single determined scanner cannot hammer your login.
  7. Failover and monitoring. Set up uptime monitoring and alerts so you find out about a problem before your users do.
  8. Backups. Automate off-server backups of anything you cannot afford to lose. A server without backups is a server you will lose.
  9. HTTPS. Terminate TLS at the edge and redirect all HTTP to HTTPS. No plaintext traffic, ever.
  10. Least privilege. Run each service as its own user, not as root, so a compromise in one app does not hand over the whole box.

None of this is exotic. It is just the baseline that a fresh install does not give you. Do these ten things and you are already ahead of the vast majority of servers on the internet.