Pcornel
Linux

Security

Cheat sheet · https://pcornel.dk/topic.php?topic=2844

Back to the Topic

Answer

Linux security combines layers: patching, minimal services, users and sudo, file permissions and ACLs, SSH hardening, PAM, a host firewall, mandatory access control (SELinux/AppArmor), auditing and intrusion blocking (fail2ban).

Remember

Start with exposure: what listens and who can log in. Keep the system patched automatically or on a schedule. Never fix access problems by disabling SELinux/AppArmor or the firewall — find the specific rule.

First checks

  • sestatus / aa-status — SELinux or AppArmor state
  • ss -tulpn — listening services
  • journalctl -u sshd -g 'Failed' — failed logins
  • ausearch -m avc,user_login -ts today — audit events (auditd)

Commands

sudo
Run an allowed command as another identity according to sudo policy and authentication state.

Verify in this order

patched system → minimal services → restricted access → MAC policy → monitoring and alerting

Where it usually breaks

First mismatch in identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation; preserve identity/native diagnostic/pre-state before mutation.

Read-only verification commands unless stated otherwise. Confirm syntax for your platform and release. Full reference: https://pcornel.dk/topic.php?topic=2844

Confirmation

Confirm action

Continue?