$linuxjunkies
>

tmpfiles.d

also: systemd-tmpfiles, tmpfiles configuration

A systemd mechanism that automatically creates, deletes, and manages temporary files and directories at boot time and during system operation. Configuration files in /etc/tmpfiles.d/ define what temporary resources should exist.

tmpfiles.d is a systemd feature that provides declarative management of temporary files, directories, and other filesystem resources. Instead of manually creating temporary resources with shell scripts, administrators and packages define them in configuration files that systemd processes automatically.

The service systemd-tmpfiles reads all .conf files from /etc/tmpfiles.d/, /run/tmpfiles.d/, and /usr/lib/tmpfiles.d/, then creates or removes resources according to their specifications. For example: d /run/myapp 0755 myuser mygroup - - creates a directory at boot time.

Common use cases include ensuring temporary runtime directories exist with proper permissions, managing PID files, cleaning up stale lock files, and setting up volatile storage. This is especially useful for applications that need guaranteed temporary space with specific ownership and permissions at startup.

Related terms