Blueprints · Server Hardening
Production
10 min · Linux
Shared memory noexec
Stages an fstab line so /dev/shm is mounted noexec,nosuid,nodev. Apply it from a console session.
Baked-in protections
- shm cannot execute binaries
- The setuid bit is ignored on shm
- The line is staged, not mounted
Step 1 · conf
fstab line
/root/portgate-blueprints/shm-fstab.line
Add this only after you confirm nothing legitimate executes from /dev/shm.
tmpfs /dev/shm tmpfs defaults,noexec,nosuid,nodev 0 0
Step 2 · bash
Read-only check
/root/portgate-blueprints/shm-check.sh
Prints status. It does not change the service.
#!/bin/sh set -eu findmnt /dev/shm || echo "/dev/shm is not a separate mount."