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.
More on SSH & Access Hardening
What are the first sshd_config changes you make on a new production server?BeginnerWhy use a drop-in file in /etc/ssh/sshd_config.d/ instead of editing sshd_config?IntermediateWhy disable SSH password authentication entirely?BeginnerShould you change the SSH port from 22?IntermediateWhat are SSH certificates and why do large fleets use them?AdvancedHow do you restrict what a specific SSH key can do?Advanced