1SYSTEMD-TMPFILES(8)            systemd-tmpfiles            SYSTEMD-TMPFILES(8)
2
3
4

NAME

6       systemd-tmpfiles, systemd-tmpfiles-setup.service, systemd-tmpfiles-
7       setup-dev.service, systemd-tmpfiles-clean.service, systemd-tmpfiles-
8       clean.timer - Creates, deletes and cleans up volatile and temporary
9       files and directories
10

SYNOPSIS

12       systemd-tmpfiles [OPTIONS...] [CONFIGFILE...]
13
14       System units:
15
16       systemd-tmpfiles-setup.service
17       systemd-tmpfiles-setup-dev.service
18       systemd-tmpfiles-clean.service
19       systemd-tmpfiles-clean.timer
20
21       User units:
22
23       systemd-tmpfiles-setup.service
24       systemd-tmpfiles-clean.service
25       systemd-tmpfiles-clean.timer
26

DESCRIPTION

28       systemd-tmpfiles creates, deletes, and cleans up volatile and temporary
29       files and directories, using the configuration file format and location
30       specified in tmpfiles.d(5). It must be invoked with one or more options
31       --create, --remove, and --clean, to select the respective subset of
32       operations.
33
34       By default, directives from all configuration files are applied. When
35       invoked with --replace=PATH, arguments specified on the command line
36       are used instead of the configuration file PATH. Otherwise, if one or
37       more absolute filenames are passed on the command line, only the
38       directives in these files are applied. If "-" is specified instead of a
39       filename, directives are read from standard input. If only the basename
40       of a configuration file is specified, all configuration directories as
41       specified in tmpfiles.d(5) are searched for a matching file and the
42       file found that has the highest priority is executed.
43
44       System services (systemd-tmpfiles-setup.service,
45       systemd-tmpfiles-setup-dev.service, systemd-tmpfiles-clean.service)
46       invoke systemd-tmpfiles to create system files and to perform system
47       wide cleanup. Those services read administrator-controlled
48       configuration files in tmpfiles.d/ directories. User services
49       (systemd-tmpfiles-setup.service, systemd-tmpfiles-clean.service) also
50       invoke systemd-tmpfiles, but it reads a separate set of files, which
51       includes user-controlled files under ~/.config/user-tmpfiles.d/ and
52       ~/.local/share/user-tmpfiles.d/, and administrator-controlled files
53       under /usr/share/user-tmpfiles.d/. Users may use this to create and
54       clean up files under their control, but the system instance performs
55       global cleanup and is not influenced by user configuration. Note that
56       this means a time-based cleanup configured in the system instance, such
57       as the one typically configured for /tmp/, will thus also affect files
58       created by the user instance if they are placed in /tmp/, even if the
59       user instance's time-based cleanup is turned off.
60
61       To re-apply settings after configuration has been modified, simply
62       restart systemd-tmpfiles-clean.service, which will apply any settings
63       which can be safely executed at runtime. To debug systemd-tmpfiles, it
64       may be useful to invoke it directly from the command line with
65       increased log level (see $SYSTEMD_LOG_LEVEL below).
66

OPTIONS

68       The following options are understood:
69
70       --create
71           If this option is passed, all files and directories marked with f,
72           F, w, d, D, v, p, L, c, b, m in the configuration files are created
73           or written to. Files and directories marked with z, Z, t, T, a, and
74           A have their ownership, access mode and security labels set.
75
76       --clean
77           If this option is passed, all files and directories with an age
78           parameter configured will be cleaned up.
79
80       --remove
81           If this option is passed, the contents of directories marked with D
82           or R, and files or directories themselves marked with r or R are
83           removed.
84
85       --user
86           Execute "user" configuration, i.e.  tmpfiles.d files in user
87           configuration directories.
88
89       --boot
90           Also execute lines with an exclamation mark.
91
92       --prefix=path
93           Only apply rules with paths that start with the specified prefix.
94           This option can be specified multiple times.
95
96       --exclude-prefix=path
97           Ignore rules with paths that start with the specified prefix. This
98           option can be specified multiple times.
99
100       -E
101           A shortcut for "--exclude-prefix=/dev --exclude-prefix=/proc
102           --exclude-prefix=/run --exclude-prefix=/sys", i.e. exclude the
103           hierarchies typically backed by virtual or memory file systems.
104           This is useful in combination with --root=, if the specified
105           directory tree contains an OS tree without these virtual/memory
106           file systems mounted in, as it is typically not desirable to create
107           any files and directories below these subdirectories if they are
108           supposed to be overmounted during runtime.
109
110       --root=root
111           Takes a directory path as an argument. All paths will be prefixed
112           with the given alternate root path, including config search paths.
113
114           When this option is used, the libc Name Service Switch (NSS) is
115           bypassed for resolving users and groups. Instead the files
116           /etc/passwd and /etc/group inside the alternate root are read
117           directly. This means that users/groups not listed in these files
118           will not be resolved, i.e. LDAP NIS and other complex databases are
119           not considered.
120
121           Consider combining this with -E to ensure the invocation does not
122           create files or directories below mount points in the OS image
123           operated on that are typically overmounted during runtime.
124
125       --image=image
126           Takes a path to a disk image file or block device node. If
127           specified all operations are applied to file system in the
128           indicated disk image. This is similar to --root= but operates on
129           file systems stored in disk images or block devices. The disk image
130           should either contain just a file system or a set of file systems
131           within a GPT partition table, following the Discoverable Partitions
132           Specification[1]. For further information on supported disk images,
133           see systemd-nspawn(1)'s switch of the same name.
134
135           Implies -E.
136
137       --replace=PATH
138           When this option is given, one ore more positional arguments must
139           be specified. All configuration files found in the directories
140           listed in tmpfiles.d(5) will be read, and the configuration given
141           on the command line will be handled instead of and with the same
142           priority as the configuration file PATH.
143
144           This option is intended to be used when package installation
145           scripts are running and files belonging to that package are not yet
146           available on disk, so their contents must be given on the command
147           line, but the admin configuration might already exist and should be
148           given higher priority.
149
150       --cat-config
151           Copy the contents of config files to standard output. Before each
152           file, the filename is printed as a comment.
153
154       --no-pager
155           Do not pipe output into a pager.
156
157       -h, --help
158           Print a short help text and exit.
159
160       --version
161           Print a short version string and exit.
162
163       It is possible to combine --create, --clean, and --remove in one
164       invocation (in which case removal and cleanup are executed before
165       creation of new files). For example, during boot the following command
166       line is executed to ensure that all temporary and volatile directories
167       are removed and created according to the configuration file:
168
169           systemd-tmpfiles --remove --create
170

ENVIRONMENT

172       $SYSTEMD_LOG_LEVEL
173           The maximum log level of emitted messages (messages with a higher
174           log level, i.e. less important ones, will be suppressed). Either
175           one of (in order of decreasing importance) emerg, alert, crit, err,
176           warning, notice, info, debug, or an integer in the range 0...7. See
177           syslog(3) for more information.
178
179       $SYSTEMD_LOG_COLOR
180           A boolean. If true, messages written to the tty will be colored
181           according to priority.
182
183           This setting is only useful when messages are written directly to
184           the terminal, because journalctl(1) and other tools that display
185           logs will color messages based on the log level on their own.
186
187       $SYSTEMD_LOG_TIME
188           A boolean. If true, console log messages will be prefixed with a
189           timestamp.
190
191           This setting is only useful when messages are written directly to
192           the terminal or a file, because journalctl(1) and other tools that
193           display logs will attach timestamps based on the entry metadata on
194           their own.
195
196       $SYSTEMD_LOG_LOCATION
197           A boolean. If true, messages will be prefixed with a filename and
198           line number in the source code where the message originates.
199
200           Note that the log location is often attached as metadata to journal
201           entries anyway. Including it directly in the message text can
202           nevertheless be convenient when debugging programs.
203
204       $SYSTEMD_LOG_TARGET
205           The destination for log messages. One of console (log to the
206           attached tty), console-prefixed (log to the attached tty but with
207           prefixes encoding the log level and "facility", see syslog(3), kmsg
208           (log to the kernel circular log buffer), journal (log to the
209           journal), journal-or-kmsg (log to the journal if available, and to
210           kmsg otherwise), auto (determine the appropriate log target
211           automatically, the default), null (disable log output).
212
213       $SYSTEMD_PAGER
214           Pager to use when --no-pager is not given; overrides $PAGER. If
215           neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
216           pager implementations are tried in turn, including less(1) and
217           more(1), until one is found. If no pager implementation is
218           discovered no pager is invoked. Setting this environment variable
219           to an empty string or the value "cat" is equivalent to passing
220           --no-pager.
221
222       $SYSTEMD_LESS
223           Override the options passed to less (by default "FRSXMK").
224
225           Users might want to change two options in particular:
226
227           K
228               This option instructs the pager to exit immediately when Ctrl+C
229               is pressed. To allow less to handle Ctrl+C itself to switch
230               back to the pager command prompt, unset this option.
231
232               If the value of $SYSTEMD_LESS does not include "K", and the
233               pager that is invoked is less, Ctrl+C will be ignored by the
234               executable, and needs to be handled by the pager.
235
236           X
237               This option instructs the pager to not send termcap
238               initialization and deinitialization strings to the terminal. It
239               is set by default to allow command output to remain visible in
240               the terminal even after the pager exits. Nevertheless, this
241               prevents some pager functionality from working, in particular
242               paged output cannot be scrolled with the mouse.
243
244           See less(1) for more discussion.
245
246       $SYSTEMD_LESSCHARSET
247           Override the charset passed to less (by default "utf-8", if the
248           invoking terminal is determined to be UTF-8 compatible).
249
250       $SYSTEMD_PAGERSECURE
251           Takes a boolean argument. When true, the "secure" mode of the pager
252           is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
253           at all, secure mode is enabled if the effective UID is not the same
254           as the owner of the login session, see geteuid(2) and
255           sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
256           when invoking the pager, and the pager shall disable commands that
257           open or create new files or start new subprocesses. When
258           $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
259           to implement secure mode will not be used. (Currently only less(1)
260           implements secure mode.)
261
262           Note: when commands are invoked with elevated privileges, for
263           example under sudo(8) or pkexec(1), care must be taken to ensure
264           that unintended interactive features are not enabled. "Secure" mode
265           for the pager may be enabled automatically as describe above.
266           Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
267           environment allows the user to invoke arbitrary commands. Note that
268           if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
269           $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
270           completely disable the pager using --no-pager instead.
271
272       $SYSTEMD_COLORS
273           Takes a boolean argument. When true, systemd and related utilities
274           will use colors in their output, otherwise the output will be
275           monochrome. Additionally, the variable can take one of the
276           following special values: "16", "256" to restrict the use of colors
277           to the base 16 or 256 ANSI colors, respectively. This can be
278           specified to override the automatic decision based on $TERM and
279           what the console is connected to.
280
281       $SYSTEMD_URLIFY
282           The value must be a boolean. Controls whether clickable links
283           should be generated in the output for terminal emulators supporting
284           this. This can be specified to override the decision that systemd
285           makes based on $TERM and other conditions.
286

UNPRIVILEGED --CLEANUP OPERATION

288       systemd-tmpfiles tries to avoid changing the access and modification
289       times on the directories it accesses, which requires CAP_FOWNER
290       privileges. When running as non-root, directories which are checked for
291       files to clean up will have their access time bumped, which might
292       prevent their cleanup.
293

EXIT STATUS

295       On success, 0 is returned. If the configuration was syntactically
296       invalid (syntax errors, missing arguments, ...), so some lines had to
297       be ignored, but no other errors occurred, 65 is returned (EX_DATAERR
298       from /usr/include/sysexits.h). If the configuration was syntactically
299       valid, but could not be executed (lack of permissions, creation of
300       files in missing directories, invalid contents when writing to /sys/
301       values, ...), 73 is returned (EX_CANTCREAT from
302       /usr/include/sysexits.h). Otherwise, 1 is returned (EXIT_FAILURE from
303       /usr/include/stdlib.h).
304
305       Note: when creating items, if the target already exists, but is of the
306       wrong type or otherwise does not match the requested state, and forced
307       operation has not been requested with "+", a message is emitted, but
308       the failure is otherwise ignored.
309

SEE ALSO

311       systemd(1), tmpfiles.d(5)
312

NOTES

314        1. Discoverable Partitions Specification
315           https://systemd.io/DISCOVERABLE_PARTITIONS
316
317
318
319systemd 249                                                SYSTEMD-TMPFILES(8)
Impressum