A secure Linux server needs more than regular updates and strong passwords. The real protection comes from configuration discipline and least privilege — practices that shrink the attack surface before an incident happens.
Start with least privilege: run services under dedicated, unprivileged system users and grant processes only the capabilities they need. Apply the same rule to people — scoped sudo rules instead of shared or always-root accounts.
Next, minimize what is installed and running. Every extra package, daemon, or open port is a potential entry point. Remove unused services and default-deny with a firewall (nftables or ufw) so only required ports are reachable. CIS Benchmarks and NIST SP 800-123 provide concrete checklists for this baseline.
Add mandatory access control with AppArmor, shipped in the mainline kernel and enforced by default on Ubuntu and Debian. Profiles confine applications to defined files, network, and capability sets, so a compromised process stays limited.
Finally, make sure you can see what happens. auditd records privileged actions and file access; Lynis and OpenSCAP turn the same steps into repeatable scans that verify your baseline instead of assuming it.
Hardening is a maintenance loop, not a one-time pass: audit, fix, re-scan, and keep the attack surface small.
Related What I Do
Related What I Do
These What I Do pages are matched from the subject matter of this article, creating a cleaner path from educational content to implementation work.
Continue reading
Related articles
Based on shared categories first, then the strongest overlap in tags.