Yves Dorfsman asked:
How can you configure Fedora / RedHat / CentOS systems to delete files in /tmp on boot like Debian and Ubuntu?
/tmp is a tmpfs, and doesn’t exist on boot anyway. To get into this situation, your server must already be non-standard in some way: Someone explicitly configured your system to not have
/tmp emptied on boot.
So it is best to fix the problem, by undoing whatever changes were made to cause
/tmp to not mount as a tmpfs on boot:
Make sure the mount has not been disabled:
systemctl unmask tmp.mount
If this command fails, fix the problem before continuing.
Go to single user mode. You need to be on the console for this.
systemctl start rescue.target
/tmpdirectory on the hard drive, to clear out the used space.
rm -rf /tmp mkdir -m 1777 /tmp
On CentOS 7, you need to explicitly enable the mount. On Fedora, you can skip this.
systemctl enable tmp.mount
Restart the system.
systemctl start default.target
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.