24/7 Magento, server & cloud support · USA · UK · Europe · Middle East · Asia hello@scripulse.com
Security9 min read

Linux Production Server Security Checklist

A practical Linux server hardening checklist: SSH, patching, firewall, least privilege, logging, intrusion detection, backups and CIS.

Most compromised servers are not victims of sophisticated zero-day attacks. They fall to weak access control, missing patches and services that should never have been exposed. This checklist covers the controls we apply first when hardening Linux production servers.

1. Lock down SSH

# /etc/ssh/sshd_config
PasswordAuthentication no
PermitRootLogin no            # or prohibit-password if root keys are required
PubkeyAuthentication yes
MaxAuthTries 3

Restrict SSH to a VPN, bastion host or known IP ranges where possible. Test a new session before closing the current one so you do not lock yourself out.

2. Patch automatically and promptly

Enable unattended security updates on Debian and Ubuntu (unattended-upgrades) or dnf-automatic on RHEL-family systems, and plan kernel reboots. Track pending updates in monitoring.

3. Minimise exposed services

ss -tulpn
systemctl list-unit-files --state=enabled

Disable anything you do not need. Databases, Redis, OpenSearch and admin interfaces should never listen on public interfaces.

4. Default-deny firewall

Allow only the ports you need (typically 80, 443 and restricted SSH) with nftables, UFW or cloud security groups. Use both host and network firewalls for defence in depth.

5. Least privilege

  • Individual named accounts; no shared logins.
  • Limited sudo rules instead of full root for everyone.
  • Run each application under its own user, never as root.
  • Remove accounts and keys promptly when people leave.

6. Brute-force protection

Use Fail2ban or equivalent for SSH and web login endpoints, and rate limits at the web server or WAF.

7. Harden the web stack

  • Hide versions: ServerTokens Prod (Apache), server_tokens off (Nginx), expose_php = Off.
  • Modern TLS only, with automated certificate renewal.
  • Security headers such as HSTS and X-Content-Type-Options.
  • Disable directory listing and block access to sensitive files.

8. Log centrally and detect intrusions

Ship logs off the server so an attacker cannot erase them. Use auditd for sensitive actions, AIDE or Wazuh for file integrity monitoring, and alert on new users, sudo usage and unexpected changes.

9. Backups you have restored

Follow the 3-2-1 approach: three copies, two media types, one off-site, ideally with immutable or versioned storage. Schedule restore tests; an untested backup is an assumption.

10. Measure against a baseline

Run Lynis for a quick audit and use the CIS Benchmarks for your distribution as a reference, adapting controls to your applications.

Want your servers hardened properly?

We audit, harden and monitor Linux servers using repeatable Ansible configuration. Request a server security audit →

S
Scripulse Engineering Team
Written and reviewed by our Magento, Linux, SRE, cloud and security engineers. About our team.
Let’s talk

Need a reliable engineering partner for your platform?

Tell us what you need. A senior engineer will reply within one business day with a clear next step.

Book a free audit →