Sefism is free for learners. We are here to help you grow, one step at a time.Join for free
Sefism.

Checklist · Security

Linux Server Hardening Checklist

Opens with credits

A Linux server hardening checklist for a VPS or cloud VM that runs your app. It covers user accounts and sudo, SSH, security updates, open ports and the firewall, system settings and permissions, logging, and checking the result against a CIS benchmark, with a command to verify every check.

Written by Tauseef Fayyaz7 chapters, 38 checksAbout 19 minReviewed 13 October 2026

What you will learn

7 chapters · about 19 min

  1. 1User accounts and sudoChecks that every person has their own account, nobody works as root, and admin rights are limited and traceable.5 checks · 3 min
  2. 2SSHChecks on the front door: key-only logins, no root, a tested configuration and as little exposure as possible.7 checks · 4 min
  3. Updates and packagesChecks that the system gets security fixes without anyone remembering to, reboots when it must, and runs only software you need.5 checks · 2 minOpens with credits
  4. Open ports and the firewallChecks that only the services you intend are listening, and that a firewall blocks everything else even if a new service starts by mistake.6 checks · 3 minOpens with credits
  5. System settings and file permissionsChecks on the operating system itself: mandatory access control, kernel network settings, sensitive file permissions and mount options.6 checks · 3 minOpens with credits
  6. Logging, time and integrityChecks that the server keeps a trustworthy record of what happened, somewhere an attacker on the box cannot erase it.5 checks · 2 minOpens with credits
  7. Benchmarks, configuration and recoveryChecks that compare the server against a published baseline, keep its setup reproducible, and make sure you can recover it.4 checks · 2 minOpens with credits

About this checklist

This Linux server hardening checklist is for the server you actually run: a VPS or cloud VM with your app, a database and a reverse proxy on it. Fresh images are not insecure, but they are general purpose. Password logins may still be on, every package you installed for a quick test is still listening, nobody is watching whether security updates apply, and the firewall on Ubuntu starts disabled. Hardening means turning that general-purpose machine into one that does only what you need.

The checks follow the order you would work in on a new server. First, who can log in and with what privileges. Then SSH, which is the front door. Then updates, the network surface (open ports, the host firewall and services bound to the wrong address), system settings and file permissions, and logging. The last chapter checks the whole machine against a CIS benchmark and makes sure you can rebuild it.

Commands are given for Ubuntu and Debian first, with the RHEL equivalent where it differs. The advice follows the Ubuntu Server documentation, the OpenSSH manual, Red Hat's RHEL 10 security hardening guide and the CIS benchmarks. Each check has a severity: must means do it before the server holds real data, should means do it soon, nice means worth doing once the rest is solid.

Common questions

What is Linux server hardening?

It is the process of reducing what a server exposes and allows: removing unneeded software and accounts, locking down SSH, keeping packages patched, closing ports with a firewall, tightening permissions and logging what happens. The goal is a server that only does what your app needs.

What should I do first on a new Ubuntu server?

Create your own user with sudo, add your SSH key, then turn off password and root logins for SSH and test from a second terminal. Enable ufw with SSH, 80 and 443 allowed, confirm unattended-upgrades is running, and check ss -tulpn for anything listening that should not be.

Is changing the SSH port a good security measure?

It reduces log noise from automated scans but does not stop a targeted attacker, who can find the new port quickly. Key-only authentication, no root login and limiting which networks can reach SSH matter far more.

Do I need fail2ban if SSH uses keys only?

It is less important once password logins are off, because guessing cannot succeed. Recent OpenSSH also has PerSourcePenalties on by default, which temporarily refuses sources that keep failing. A firewall that limits SSH to known networks helps more than either.

What is a CIS benchmark?

CIS benchmarks are hardening baselines published by the Center for Internet Security for specific OS releases, such as Ubuntu 24.04 LTS. They list detailed settings with audit and remediation steps. Tools like the Ubuntu Security Guide and OpenSCAP can scan a server against them.

Should my server reboot automatically for updates?

Something has to restart it, or a patched kernel never takes effect. You can set Automatic-Reboot in unattended-upgrades with a fixed time in a quiet window, or schedule reboots yourself. Either way, monitor for /var/run/reboot-required so nothing waits for months.

Sources (7)

Checked against these, last on 13 October 2026.

  1. CIS Ubuntu Linux Benchmarks, Center for Internet Securitywww.cisecurity.org/benchmark/ubuntu_linux/
  2. OpenSSH server, Ubuntu Server documentationubuntu.com/server/docs/how-to/security/openssh-server/
  3. sshd_config(5) manual page, OpenBSDman.openbsd.org/sshd_config
  4. Automatic updates, Ubuntu Server documentationubuntu.com/server/docs/how-to/software/automatic-updates/
  5. Firewalls, Ubuntu Server documentationubuntu.com/server/docs/how-to/security/firewalls/
  6. Security hardening, Red Hat Enterprise Linux 10, Red Hatdocs.redhat.com/en/documentation/red_hat_enterprise_linux/10/html/security_hardening/index
  7. CIS compliance with Ubuntu Security Guide, Canonicalubuntu.com/security/certifications/docs/usg/cis

Picked from the other libraries by shared topics.

Work with me

Stuck on something specific?

Writing only gets you so far. If you want an answer to your situation rather than the general case, book a session and we will work through it together. Sessions are free for approved Sefism members, and a few slots open each week.

  • 1:1 Mentorship
  • Fresh Graduate Mentorship
  • Career Guidance

Brand deals, promos and partnerships: tauseeffayyaz@gmail.com