Interview Prep/Linux/SSH & Access Hardening

How do you protect /tmp and other shared mounts?

IntermediateProductionSSH & Access Hardening
Answer

Mount /tmp, /var/tmp and /dev/shm with nodev,nosuid,noexec so attackers cannot run dropped binaries or SUID files from there.

tmpfs  /dev/shm  tmpfs  defaults,nodev,nosuid,noexec  0 0

On systemd use systemctl enable tmp.mount with an override for options. Caveat: some installers and package scripts execute from /tmp, so test, and point them at TMPDIR=/var/lib/app/tmp if needed.

All Linux questions Roadmap: Linux

More on SSH & Access Hardening