configure /tmp to be tmpfs,nosuid,nodev RHEL/CentOS

configure /tmp to be tmpfs,nosuid,nodev RHEL/CentOS

configure /tmp to be tmpfs CentOS 6

Usually this configuration is a security standard, it requires /tmp to be cleared on reboot, nodev, and suid are usually associated with this configuration as well.

Add the following to fstab:

fstab line mounting tmpfs on /tmp with options nodev,nosuid,size=10G

so what we told fstab is the following:

tmpfs filesystem is mounted to /tmp, the filesystem type is tmfps, nodev means no devices can be mounted in /tmp, nosuid means that root cannot execute anything in /tmp and size=10G is the amount of space the /tmp space can take from root, you may want to trim this to a more manageable size, depending ont he size of your root disk.

if you already have content in /tmp, you may want to do a rm -rf /tmp/*, from here we do a mount -a, this will load this new configuration, and show if you made any errors.

mount -a run as root to load the new tmpfs /tmp entry from fstab

after any fstab entry, it’s good to do a reboot just in case.

reboot command typed at the root prompt to confirm the tmpfs /tmp mount survives a restart

Related guides: Using stickybit, setuid,setguid permissions CentOS | Disable SELinux CentOS 7

Leave a Reply

Your email address will not be published. Required fields are marked *