Systemd-tmpfiles
Systemd-tmpfiles is a component of the systemd suite that manages volatile and temporary files and directories by creating, cleaning, and deleting them based on configuration files found in /etc/tmpfiles.d, /run/tmpfiles.d, and /usr/lib/tmpfiles.d. It uses configuration files with a specific format to define actions for different paths, ensuring that temporary data does not accumulate and consume unnecessary storage space.
RHEL 7, 8, and other Red Hat Derivatives
On Red Hat Enterprise Linux (RHEL) 7 and later, the cleanup of the /tmp directory is managed by systemd-tmpfiles. The configuration file responsible for defining the cleanup parameters for /tmp is located at:
/usr/lib/tmpfiles.d/tmp.conf
Within this file, the v directive specifies the path to be cleaned, along with permissions, ownership, and the retention period. For example, a common entry for /tmp would resemble:
v /tmp 1777 root root 10d
This line indicates that files and directories within /tmp older than 10 days are subject to deletion during the systemd-tmpfiles --clean operation, which is typically executed periodically by a systemd timer.
The configuration file: /usr/lib/tmpfiles.d/tmp.conf is called by systemd-tmpfiles-clean.service