Linux hardening is most useful when it improves the way a team actually operates servers. A checklist that ignores patching habits, access ownership and recovery paths will not help much, even if every individual setting looks sensible.
For lean IT teams, the first goal should be a clean baseline: fewer exposed services, clearer administrative access, better logging, predictable patching and working backups.
1. Know what the host is for
Before changing configuration, confirm what the server does and who owns it. Hardening without ownership context can create outages. Start by understanding the role of the host and the blast radius of each change.
Useful review questions:
- What business service depends on this host?
- Is it production, staging, development or legacy?
- Who approves changes to the host?
- How is it rebuilt if it fails?
- Which ports should be reachable from the internet?
2. Secure SSH access
SSH is usually the first control to review. At minimum, a hardened baseline should make it clear who can log in, how access is granted, and how access is removed. For a deeper dive, review our guide on SSH hardening for business Linux servers.
Useful review questions:
- Is password authentication disabled in favour of SSH keys?
- Is direct root login disabled (
PermitRootLogin no)? - Are old or unmanaged keys removed from
authorized_keysfiles? - Is access managed centrally (e.g. SSO, short-lived certificates) or via a bastion host rather than scattered keys?
3. Review sudo and privilege escalation
Many Linux environments have grown organically. Over time, sudo rules become broad and old administrators remain present. Avoid turning every operational user into a full administrator by default. Where full administrative access is necessary, make the reason and owner explicit.
Useful review questions:
- Are rules in
/etc/sudoersand/etc/sudoers.d/scoped to least privilege? - Have service accounts been stripped of unnecessary login or sudo rights?
- Are former employees or contractors removed from privileged groups (e.g.,
wheel,sudo)? - Are overly broad rules (like
NOPASSWD: ALL) restricted to specific automated tasks?
4. Patch with a cadence
Patching is not only a package manager command. It is an operating habit. Confirm how security updates are identified, tested, applied and verified. For internet-facing hosts, the cadence should be explicit. For fragile legacy hosts, the risk should be documented rather than ignored.
Useful review questions:
- Are unattended security updates enabled where appropriate?
- Are kernel updates actually completed with reboots?
- Are end-of-life distributions still present in the environment?
- Is there a tested rollback or rebuild path if an update breaks a service?
5. Reduce exposed services and configure firewalls
List listening services and compare them to the intended role of the host. The safest exposed service is the one that does not exist. Beyond disabling services, ensure network access is restricted at the host level using a firewall, and avoid disabling mandatory access controls as a quick fix.
Useful review questions:
- Are unnecessary services (e.g., forgotten web apps, dev databases) disabled or removed?
- Is a host-based firewall (like
ufworfirewalld) configured to drop unexpected traffic? - Are mandatory access controls (like SELinux or AppArmor) enabled and enforcing, rather than permanently disabled for convenience?
- Are administrative interfaces hidden behind a VPN or IP allowlist?
6. Harden the web stack
For Nginx, Apache, reverse proxy and common web hosting stacks, the goal is not to chase every hardening benchmark setting. The goal is to remove avoidable weaknesses from the path that real users and attackers can reach.
Useful review questions:
- Are modern TLS protocols configured and older versions (TLS 1.0/1.1) disabled?
- Are important HTTP security headers (e.g., HSTS, Content-Security-Policy) present?
- Are default sites, test pages, and stale virtual hosts removed?
- Are request size limits and timeouts configured to prevent basic resource exhaustion?
7. Improve logs and auditability
A hardened host should leave enough evidence to understand important events. Central logging does not need to be over-engineered, but critical systems should not depend only on local logs. If logs only exist on the host, ask what happens when the host is compromised or lost.
Useful review questions:
- Are authentication logs (
auth.logorsecure) monitored for repeated failures? - Are web server and application logs retained for a useful period?
- Are critical logs forwarded to a central system or SIEM?
- Are log files protected against unauthorised modification or deletion?
8. Validate backups and restore paths
Backups should cover configuration, application data, databases and any state needed to rebuild the service. More importantly, restores should be tested.
Useful review questions:
- Does the backup include all necessary data and configuration to recreate the service?
- Are backups stored securely off-host and protected from ransomware?
- Have restoration procedures been successfully tested recently?
- Is it documented how long a restore is expected to take (RTO)?
What good hardening leaves behind
Good Linux hardening should leave a team with a safer host and a clearer operating model. That means documented access, reduced exposure, current packages, usable logs, tested recovery assumptions and handover notes that another engineer can follow.
The best result is boring operations: fewer surprises, fewer emergency mysteries and fewer systems that only one person understands.