2.6 Bind Mount the /var/tmp directory to /tmp

Information

The /var/tmp directory is normally a standalone directory in the /var file system. Binding
/var/tmp to /tmp establishes an unbreakable link to /tmp that cannot be removed (even by
the root user). It also allows /var/tmp to inherit the same mount options that /tmp owns,
allowing /var/tmp to be protected in the same manner /tmp is protected. It will also prevent
/var from filling up with temporary files as the contents of /var/tmp will actually reside in
the file system containing /tmp.

*Rationale*

All programs that use /var/tmp and /tmp to read/write temporary files will always be
written to the /tmp file system, preventing a user from running the /var file system out of
space or trying to perform operations that have been blocked in the /tmp filesystem.

Solution

# mount --bind /tmp /var/tmpand edit the /etc/fstab file to contain the following line-/tmp /var/tmp none bind 0 0

See Also

https://benchmarks.cisecurity.org/tools2/linux/CIS_Ubuntu_12.04_LTS_Server_Benchmark_v1.1.0.pdf

Item Details

Category: CONFIGURATION MANAGEMENT, MEDIA PROTECTION

References: 800-53|CM-6, 800-53|CM-7, 800-53|MP-2

Plugin: Unix

Control ID: 4aa2bb58b150e91f319eb8b80ab3529e280ad971e1a8be061b02c1ca420ec9be