1TMPFILES.D(5)                     tmpfiles.d                     TMPFILES.D(5)
2
3
4

NAME

6       tmpfiles.d - Configuration for creation, deletion and cleaning of
7       volatile and temporary files
8

SYNOPSIS

10       /etc/tmpfiles.d/*.conf
11       /run/tmpfiles.d/*.conf
12       /usr/lib/tmpfiles.d/*.conf
13
14
15       ~/.config/user-tmpfiles.d/*.conf
16       $XDG_RUNTIME_DIR/user-tmpfiles.d/*.conf
17       ~/.local/share/user-tmpfiles.d/*.conf
18       ...
19       /usr/share/user-tmpfiles.d/*.conf
20
21
22
23       #Type Path                                     Mode User Group Age         Argument
24       f     /file/to/create                          mode user group -           content
25       f+    /file/to/create-or-truncate              mode user group -           content
26       w     /file/to/write-to                        -    -    -     -           content
27       w+    /file/to/append-to                       -    -    -     -           content
28       d     /directory/to/create-and-cleanup         mode user group cleanup-age -
29       D     /directory/to/create-and-remove          mode user group cleanup-age -
30       e     /directory/to/cleanup                    mode user group cleanup-age -
31       v     /subvolume-or-directory/to/create        mode user group cleanup-age -
32       q     /subvolume-or-directory/to/create        mode user group cleanup-age -
33       Q     /subvolume-or-directory/to/create        mode user group cleanup-age -
34       p     /fifo/to/create                          mode user group -           -
35       p+    /fifo/to/[re]create                      mode user group -           -
36       L     /symlink/to/create                       -    -    -     -           symlink/target/path
37       L+    /symlink/to/[re]create                   -    -    -     -           symlink/target/path
38       c     /dev/char-device-to-create               mode user group -           major:minor
39       c+    /dev/char-device-to-[re]create           mode user group -           major:minor
40       b     /dev/block-device-to-create              mode user group -           major:minor
41       b+    /dev/block-device-to-[re]create          mode user group -           major:minor
42       C     /target/to/create                        -    -    -     cleanup-age /source/to/copy
43       x     /path-or-glob/to/ignore/recursively      -    -    -     cleanup-age -
44       X     /path-or-glob/to/ignore                  -    -    -     cleanup-age -
45       r     /empty/dir/to/remove                     -    -    -     -           -
46       R     /dir/to/remove/recursively               -    -    -     -           -
47       z     /path-or-glob/to/adjust/mode             mode user group -           -
48       Z     /path-or-glob/to/adjust/mode/recursively mode user group -           -
49       t     /path-or-glob/to/set/xattrs              -    -    -     -           xattrs
50       T     /path-or-glob/to/set/xattrs/recursively  -    -    -     -           xattrs
51       h     /path-or-glob/to/set/attrs               -    -    -     -           file attrs
52       H     /path-or-glob/to/set/attrs/recursively   -    -    -     -           file attrs
53       a     /path-or-glob/to/set/acls                -    -    -     -           POSIX ACLs
54       a+    /path-or-glob/to/append/acls             -    -    -     -           POSIX ACLs
55       A     /path-or-glob/to/set/acls/recursively    -    -    -     -           POSIX ACLs
56       A+    /path-or-glob/to/append/acls/recursively -    -    -     -           POSIX ACLs
57
58

DESCRIPTION

60       tmpfiles.d configuration files provide a generic mechanism to define
61       the creation of regular files, directories, pipes, and device nodes,
62       adjustments to their access mode, ownership, attributes, quota
63       assignments, and contents, and finally their time-based removal. It is
64       mostly commonly used for volatile and temporary files and directories
65       (such as those located under /run/, /tmp/, /var/tmp/, the API file
66       systems such as /sys/ or /proc/, as well as some other directories
67       below /var/).
68
69       systemd-tmpfiles uses this configuration to create volatile files and
70       directories during boot and to do periodic cleanup afterwards. See
71       systemd-tmpfiles(5) for the description of
72       systemd-tmpfiles-setup.service, systemd-tmpfiles-clean.service, and
73       associated units.
74
75       System daemons frequently require private runtime directories below
76       /run/ to store communication sockets and similar. For these, it is
77       better to use RuntimeDirectory= in their unit files (see
78       systemd.exec(5) for details), if the flexibility provided by tmpfiles.d
79       is not required. The advantages are that the configuration required by
80       the unit is centralized in one place, and that the lifetime of the
81       directory is tied to the lifetime of the service itself. Similarly,
82       StateDirectory=, CacheDirectory=, LogsDirectory=, and
83       ConfigurationDirectory= should be used to create directories under
84       /var/lib/, /var/cache/, /var/log/, and /etc/.  tmpfiles.d should be
85       used for files whose lifetime is independent of any service or requires
86       more complicated configuration.
87

CONFIGURATION DIRECTORIES AND PRECEDENCE

89       Each configuration file shall be named in the style of package.conf or
90       package-part.conf. The second variant should be used when it is
91       desirable to make it easy to override just this part of configuration.
92
93       Files in /etc/tmpfiles.d override files with the same name in
94       /usr/lib/tmpfiles.d and /run/tmpfiles.d. Files in /run/tmpfiles.d
95       override files with the same name in /usr/lib/tmpfiles.d. Packages
96       should install their configuration files in /usr/lib/tmpfiles.d. Files
97       in /etc/tmpfiles.d are reserved for the local administrator, who may
98       use this logic to override the configuration files installed by vendor
99       packages. All configuration files are sorted by their filename in
100       lexicographic order, regardless of which of the directories they reside
101       in. If multiple files specify the same path, the entry in the file with
102       the lexicographically earliest name will be applied (note that lines
103       suppressed due to the "!"  are filtered before application, meaning
104       that if an early line carries the exclamation mark and is suppressed
105       because of that, a later line matching in path will be applied). All
106       other conflicting entries will be logged as errors. When two lines are
107       prefix path and suffix path of each other, then the prefix line is
108       always created first, the suffix later (and if removal applies to the
109       line, the order is reversed: the suffix is removed first, the prefix
110       later). Lines that take globs are applied after those accepting no
111       globs. If multiple operations shall be applied on the same file (such
112       as ACL, xattr, file attribute adjustments), these are always done in
113       the same fixed order. Except for those cases, the files/directories are
114       processed in the order they are listed.
115
116       If the administrator wants to disable a configuration file supplied by
117       the vendor, the recommended way is to place a symlink to /dev/null in
118       /etc/tmpfiles.d/ bearing the same filename.
119

CONFIGURATION FILE FORMAT

121       The configuration format is one line per path, containing type, path,
122       mode, ownership, age, and argument fields. The lines are separated by
123       newlines, the fields by whitespace:
124
125           #Type Path        Mode User Group Age Argument...
126           d     /run/user   0755 root root  10d -
127           L     /tmp/foobar -    -    -     -   /dev/null
128
129       Fields may contain C-style escapes. With the exception of the seventh
130       field (the "argument") all fields may be enclosed in quotes. Note that
131       any whitespace found in the line after the beginning of the argument
132       field will be considered part of the argument field. To begin the
133       argument field with a whitespace character, use C-style escapes (e.g.
134       "\x20").
135
136   Type
137       The type consists of a single letter and optionally an exclamation mark
138       ("!") minus sign ("-"), and/or equals sign ("=").
139
140       The following line types are understood:
141
142       f, f+
143           f will create a file if it does not exist yet. If the argument
144           parameter is given and the file did not exist yet, it will be
145           written to the file.  f+ will create or truncate the file. If the
146           argument parameter is given, it will be written to the file. Does
147           not follow symlinks.
148
149       w, w+
150           Write the argument parameter to a file, if the file exists. If
151           suffixed with +, the line will be appended to the file. If your
152           configuration writes multiple lines to the same file, use w+. Lines
153           of this type accept shell-style globs in place of normal path
154           names. The argument parameter will be written without a trailing
155           newline. C-style backslash escapes are interpreted. Follows
156           symlinks.
157
158       d
159           Create a directory. The mode and ownership will be adjusted if
160           specified. Contents of this directory are subject to time based
161           cleanup if the age argument is specified.
162
163       D
164           Similar to d, but in addition the contents of the directory will be
165           removed when --remove is used.
166
167       e
168           Adjust the mode and ownership of existing directories and remove
169           their contents based on age. Lines of this type accept shell-style
170           globs in place of normal path names. Contents of the directories
171           are subject to time based cleanup if the age argument is specified.
172           If the age argument is "0", contents will be unconditionally
173           deleted every time systemd-tmpfiles --clean is run.
174
175           For this entry to be useful, at least one of the mode, user, group,
176           or age arguments must be specified, since otherwise this entry has
177           no effect. As an exception, an entry with no effect may be useful
178           when combined with !, see the examples.
179
180       v
181           Create a subvolume if the path does not exist yet, the file system
182           supports subvolumes (btrfs), and the system itself is installed
183           into a subvolume (specifically: the root directory / is itself a
184           subvolume). Otherwise, create a normal directory, in the same way
185           as d.
186
187           A subvolume created with this line type is not assigned to any
188           higher-level quota group. For that, use q or Q, which allow
189           creating simple quota group hierarchies, see below.
190
191       q
192           Create a subvolume or directory the same as v, but assign the
193           subvolume to the same higher-level quota groups as the parent. This
194           ensures that higher-level limits and accounting applied to the
195           parent subvolume also include the specified subvolume. On non-btrfs
196           file systems, this line type is identical to d.
197
198           If the subvolume already exists, no change to the quota hierarchy
199           is made, regardless of whether the subvolume is already attached to
200           a quota group or not. Also see Q below. See btrfs-qgroup(8) for
201           details about the btrfs quota group concept.
202
203       Q
204           Create the subvolume or directory the same as v, but assign the new
205           subvolume to a new leaf quota group. Instead of copying the
206           higher-level quota group assignments from the parent as is done
207           with q, the lowest quota group of the parent subvolume is
208           determined that is not the leaf quota group. Then, an
209           "intermediary" quota group is inserted that is one level below this
210           level, and shares the same ID part as the specified subvolume. If
211           no higher-level quota group exists for the parent subvolume, a new
212           quota group at level 255 sharing the same ID as the specified
213           subvolume is inserted instead. This new intermediary quota group is
214           then assigned to the parent subvolume's higher-level quota groups,
215           and the specified subvolume's leaf quota group is assigned to it.
216
217           Effectively, this has a similar effect as q, however introduces a
218           new higher-level quota group for the specified subvolume that may
219           be used to enforce limits and accounting to the specified subvolume
220           and children subvolume created within it. Thus, by creating
221           subvolumes only via q and Q, a concept of "subtree quotas" is
222           implemented. Each subvolume for which Q is set will get a "subtree"
223           quota group created, and all child subvolumes created within it
224           will be assigned to it. Each subvolume for which q is set will not
225           get such a "subtree" quota group, but it is ensured that they are
226           added to the same "subtree" quota group as their immediate parents.
227
228           It is recommended to use Q for subvolumes that typically contain
229           further subvolumes, and where it is desirable to have accounting
230           and quota limits on all child subvolumes together. Examples for Q
231           are typically /home/ or /var/lib/machines/. In contrast, q should
232           be used for subvolumes that either usually do not include further
233           subvolumes or where no accounting and quota limits are needed that
234           apply to all child subvolumes together. Examples for q are
235           typically /var/ or /var/tmp/.
236
237           As with q, Q has no effect on the quota group hierarchy if the
238           subvolume already exists, regardless of whether the subvolume
239           already belong to a quota group or not.
240
241       p, p+
242           Create a named pipe (FIFO) if it does not exist yet. If suffixed
243           with + and a file already exists where the pipe is to be created,
244           it will be removed and be replaced by the pipe.
245
246       L, L+
247           Create a symlink if it does not exist yet. If suffixed with + and a
248           file or directory already exists where the symlink is to be
249           created, it will be removed and be replaced by the symlink. If the
250           argument is omitted, symlinks to files with the same name residing
251           in the directory /usr/share/factory/ are created. Note that
252           permissions and ownership on symlinks are ignored.
253
254       c, c+
255           Create a character device node if it does not exist yet. If
256           suffixed with + and a file already exists where the device node is
257           to be created, it will be removed and be replaced by the device
258           node. It is recommended to suffix this entry with an exclamation
259           mark to only create static device nodes at boot, as udev will not
260           manage static device nodes that are created at runtime.
261
262       b, b+
263           Create a block device node if it does not exist yet. If suffixed
264           with + and a file already exists where the device node is to be
265           created, it will be removed and be replaced by the device node. It
266           is recommended to suffix this entry with an exclamation mark to
267           only create static device nodes at boot, as udev will not manage
268           static device nodes that are created at runtime.
269
270       C
271           Recursively copy a file or directory, if the destination files or
272           directories do not exist yet or the destination directory is empty.
273           Note that this command will not descend into subdirectories if the
274           destination directory already exists and is not empty. Instead, the
275           entire copy operation is skipped. If the argument is omitted, files
276           from the source directory /usr/share/factory/ with the same name
277           are copied. Does not follow symlinks. Contents of the directories
278           are subject to time based cleanup if the age argument is specified.
279
280       x
281           Ignore a path during cleaning. Use this type to exclude paths from
282           clean-up as controlled with the Age parameter. Note that lines of
283           this type do not influence the effect of r or R lines. Lines of
284           this type accept shell-style globs in place of normal path names.
285
286       X
287           Ignore a path during cleaning. Use this type to exclude paths from
288           clean-up as controlled with the Age parameter. Unlike x, this
289           parameter will not exclude the content if path is a directory, but
290           only directory itself. Note that lines of this type do not
291           influence the effect of r or R lines. Lines of this type accept
292           shell-style globs in place of normal path names.
293
294       r
295           Remove a file or directory if it exists. This may not be used to
296           remove non-empty directories, use R for that. Lines of this type
297           accept shell-style globs in place of normal path names. Does not
298           follow symlinks.
299
300       R
301           Recursively remove a path and all its subdirectories (if it is a
302           directory). Lines of this type accept shell-style globs in place of
303           normal path names. Does not follow symlinks.
304
305       z
306           Adjust the access mode, user and group ownership, and restore the
307           SELinux security context of a file or directory, if it exists.
308           Lines of this type accept shell-style globs in place of normal path
309           names. Does not follow symlinks.
310
311       Z
312           Recursively set the access mode, user and group ownership, and
313           restore the SELinux security context of a file or directory if it
314           exists, as well as of its subdirectories and the files contained
315           therein (if applicable). Lines of this type accept shell-style
316           globs in place of normal path names. Does not follow symlinks.
317
318       t
319           Set extended attributes, see attr(5) for details. The argument
320           field should take one or more assignment expressions in the form
321           namespace.attribute=value, for examples see below. Lines of this
322           type accept shell-style globs in place of normal path names. This
323           can be useful for setting SMACK labels. Does not follow symlinks.
324
325           Please note that extended attributes settable with this line type
326           are a different concept from the Linux file attributes settable
327           with h/H, see below.
328
329       T
330           Same as t, but operates recursively.
331
332       h
333           Set Linux file/directory attributes. Lines of this type accept
334           shell-style globs in place of normal path names.
335
336           The format of the argument field is [+-=][aAcCdDeijPsStTu]. The
337           prefix + (the default one) causes the attribute(s) to be added; -
338           causes the attribute(s) to be removed; = causes the attributes to
339           be set exactly as the following letters. The letters
340           "aAcCdDeijPsStTu" select the new attributes for the files, see
341           chattr(1) for further information.
342
343           Passing only = as argument resets all the file attributes listed
344           above. It has to be pointed out that the = prefix limits itself to
345           the attributes corresponding to the letters listed here. All other
346           attributes will be left untouched. Does not follow symlinks.
347
348           Please note that the Linux file attributes settable with this line
349           type are a different concept from the extended attributes settable
350           with t/T, see above.
351
352       H
353           Sames as h, but operates recursively.
354
355       a, a+
356           Set POSIX ACLs (access control lists), see acl(5). If suffixed with
357           +, the specified entries will be added to the existing set.
358           systemd-tmpfiles will automatically add the required base entries
359           for user and group based on the access mode of the file, unless
360           base entries already exist or are explicitly specified. The mask
361           will be added if not specified explicitly or already present. Lines
362           of this type accept shell-style globs in place of normal path
363           names. This can be useful for allowing additional access to certain
364           files. Does not follow symlinks.
365
366       A, A+
367           Same as a and a+, but recursive. Does not follow symlinks.
368
369       If the exclamation mark ("!") is used, this line is only safe to
370       execute during boot, and can break a running system. Lines without the
371       exclamation mark are presumed to be safe to execute at any time, e.g.
372       on package upgrades.  systemd-tmpfiles will take lines with an
373       exclamation mark only into consideration, if the --boot option is
374       given.
375
376       For example:
377
378           # Make sure these are created by default so that nobody else can
379           d /tmp/.X11-unix 1777 root root 10d
380
381           # Unlink the X11 lock files
382           r! /tmp/.X[0-9]*-lock
383
384       The second line in contrast to the first one would break a running
385       system, and will only be executed with --boot.
386
387       If the minus sign ("-") is used, this line failing to run successfully
388       during create (and only create) will not cause the execution of
389       systemd-tmpfiles to return an error.
390
391       For example:
392
393           # Modify sysfs but don't fail if we are in a container with a read-only /proc
394           w- /proc/sys/vm/swappiness - - - - 10
395
396       If the equals sign ("=") is used, the file types of existing objects in
397       the specified path are checked, and removed if they do not match. This
398       includes any implicitly created parent directories (which can be either
399       directories or directory symlinks). For example, if there is a FIFO in
400       place of one of the parent path components it will be replaced with a
401       directory.
402
403       Note that for all line types that result in creation of any kind of
404       file node (i.e.  f/F, d/D/v/q/Q, p, L, c/b and C) leading directories
405       are implicitly created if needed, owned by root with an access mode of
406       0755. In order to create them with different modes or ownership make
407       sure to add appropriate d lines.
408
409   Path
410       The file system path specification supports simple specifier expansion,
411       see below. The path (after expansion) must be absolute.
412
413   Mode
414       The file access mode to use when creating this file or directory. If
415       omitted or when set to "-", the default is used: 0755 for directories,
416       0644 for all other file objects. For z, Z lines, if omitted or when set
417       to "-", the file access mode will not be modified. This parameter is
418       ignored for x, r, R, L, t, and a lines.
419
420       Optionally, if prefixed with "~", the access mode is masked based on
421       the already set access bits for existing file or directories: if the
422       existing file has all executable bits unset, all executable bits are
423       removed from the new access mode, too. Similarly, if all read bits are
424       removed from the old access mode, they will be removed from the new
425       access mode too, and if all write bits are removed, they will be
426       removed from the new access mode too. In addition, the sticky/SUID/SGID
427       bit is removed unless applied to a directory. This functionality is
428       particularly useful in conjunction with Z.
429
430   User, Group
431       The user and group to use for this file or directory. This may either
432       be a numeric ID or a user/group name. If omitted or when set to "-",
433       the user and group of the user who invokes systemd-tmpfiles is used.
434       For z and Z lines, when omitted or when set to "-", the file ownership
435       will not be modified. These parameters are ignored for x, r, R, L, t,
436       and a lines.
437
438       This field should generally only reference system users/groups, i.e.
439       users/groups that are guaranteed to be resolvable during early boot. If
440       this field references users/groups that only become resolveable during
441       later boot (i.e. after NIS, LDAP or a similar networked directory
442       service become available), execution of the operations declared by the
443       line will likely fail. Also see Notes on Resolvability of User and
444       Group Names[1] for more information on requirements on system
445       user/group definitions.
446
447   Age
448       The date field, when set, is used to decide what files to delete when
449       cleaning. If a file or directory is older than the current time minus
450       the age field, it is deleted. The field format is a series of integers
451       each followed by one of the following suffixes for the respective time
452       units: s, m or min, h, d, w, ms, and us, meaning seconds, minutes,
453       hours, days, weeks, milliseconds, and microseconds, respectively. Full
454       names of the time units can be used too.
455
456       If multiple integers and units are specified, the time values are
457       summed. If an integer is given without a unit, s is assumed.
458
459       When the age is set to zero, the files are cleaned unconditionally.
460
461       The age field only applies to lines starting with d, D, e, v, q, Q, C,
462       x and X. If omitted or set to "-", no automatic clean-up is done.
463
464       If the age field starts with a tilde character "~", clean-up is only
465       applied to files and directories one level inside the directory
466       specified, but not the files and directories immediately inside it.
467
468       The age of a file system entry is determined from its last modification
469       timestamp (mtime), its last access timestamp (atime), and (except for
470       directories) its last status change timestamp (ctime). By default, any
471       of these three (or two) values will prevent cleanup if it is more
472       recent than the current time minus the age field. To restrict the
473       deletion based on particular type of file timestamps, the age-by
474       argument can be used.
475
476       The age-by argument overrides the timestamp types to be used for the
477       age check. It can be specified by prefixing the age argument with a
478       sequence of characters to specify the timestamp types and a colon
479       (":"): "age-by...:cleanup-age". The argument can consist of a (A for
480       directories), b (B for directories), c (C for directories), or m (M for
481       directories). Those respectively indicate access, creation, last status
482       change, and last modification time of a file system entry. The
483       lower-case letter signifies that the given timestamp type should be
484       considered for files, while the upper-case letter signifies that the
485       given timestamp type should be considered for directories. See statx(2)
486       file timestamp fields for more details about timestamp types.
487
488       If not specified, the age-by field defaults to abcmABM, i.e. by default
489       all file timestamps are taken into consideration, with the exception of
490       the last status change timestamp (ctime) for directories. This is
491       because the aging logic itself will alter the ctime whenever it deletes
492       a file inside it. To ensure that running the aging logic does not feed
493       back into the next iteration of itself, ctime for directories is
494       ignored by default.
495
496       For example:
497
498           # Files created and modified, and directories accessed more than
499           # an hour ago in "/tmp/foo/bar", are subject to time-based cleanup.
500           d /tmp/foo/bar - - - - bmA:1h -
501
502       Note that while the aging algorithm is run a 'shared' BSD file lock
503       (see flock(2)) is taken on each directory the algorithm descends into
504       (and each directory below that, and so on). If the aging algorithm
505       finds a lock is already taken on some directory, it (and everything
506       below it) is skipped. Applications may use this to temporarily exclude
507       certain directory subtrees from the aging algorithm: the applications
508       can take a BSD file lock themselves, and as long as they keep it aging
509       of the directory and everything below it is disabled.
510
511   Argument
512       For L lines determines the destination path of the symlink. For c and
513       b, determines the major/minor of the device node, with major and minor
514       formatted as integers, separated by ":", e.g.  "1:3". For f, F, and w,
515       the argument may be used to specify a short string that is written to
516       the file, suffixed by a newline. For C, specifies the source file or
517       directory. For t and T, determines extended attributes to be set. For a
518       and A, determines ACL attributes to be set. For h and H, determines the
519       file attributes to set. Ignored for all other lines.
520
521       This field can contain specifiers, see below.
522

SPECIFIERS

524       Specifiers can be used in the "path" and "argument" fields. An unknown
525       or unresolvable specifier is treated as invalid configuration. The
526       following expansions are understood:
527
528       Table 1. Specifiers available
529       ┌──────────┬─────────────────────┬────────────────────────┐
530Specifier Meaning             Details                
531       ├──────────┼─────────────────────┼────────────────────────┤
532       │"%a"      │ Architecture        │ A short string         │
533       │          │                     │ identifying the        │
534       │          │                     │ architecture of the    │
535       │          │                     │ local system. A        │
536       │          │                     │ string such as x86,    │
537       │          │                     │ x86-64 or arm64.       │
538       │          │                     │ See the                │
539       │          │                     │ architectures          │
540       │          │                     │ defined for            │
541       │          │                     │ ConditionArchitecture=
542       │          │                     │ in systemd.unit(5)
543       │          │                     │ for a full list.       │
544       ├──────────┼─────────────────────┼────────────────────────┤
545       │"%A"      │ Operating system    │ The operating system   │
546       │          │ image version       │ image version          │
547       │          │                     │ identifier of the      │
548       │          │                     │ running system, as     │
549       │          │                     │ read from the          │
550       │          │                     │ IMAGE_VERSION= field   │
551       │          │                     │ of /etc/os-release. If │
552       │          │                     │ not set, resolves to   │
553       │          │                     │ an empty string. See   │
554       │          │                     │ os-release(5) for more │
555       │          │                     │ information.           │
556       ├──────────┼─────────────────────┼────────────────────────┤
557       │"%b"      │ Boot ID             │ The boot ID of the     │
558       │          │                     │ running system,        │
559       │          │                     │ formatted as string.   │
560       │          │                     │ See random(4) for more │
561       │          │                     │ information.           │
562       ├──────────┼─────────────────────┼────────────────────────┤
563       │"%B"      │ Operating system    │ The operating system   │
564       │          │ build ID            │ build identifier of    │
565       │          │                     │ the running system, as │
566       │          │                     │ read from the          │
567       │          │                     │ BUILD_ID= field of     │
568       │          │                     │ /etc/os-release. If    │
569       │          │                     │ not set, resolves to   │
570       │          │                     │ an empty string. See   │
571       │          │                     │ os-release(5) for more │
572       │          │                     │ information.           │
573       ├──────────┼─────────────────────┼────────────────────────┤
574       │"%C"      │ System or user      │ In --user mode, this   │
575       │          │ cache directory     │ is the same as         │
576       │          │                     │ $XDG_CACHE_HOME, and   │
577       │          │                     │ /var/cache otherwise.  │
578       ├──────────┼─────────────────────┼────────────────────────┤
579       │"%g"      │ User group          │ This is the name of    │
580       │          │                     │ the group running the  │
581       │          │                     │ command. In case of    │
582       │          │                     │ the system instance    │
583       │          │                     │ this resolves to       │
584       │          │                     │ "root".                │
585       ├──────────┼─────────────────────┼────────────────────────┤
586       │"%G"      │ User GID            │ This is the numeric    │
587       │          │                     │ GID of the group       │
588       │          │                     │ running the command.   │
589       │          │                     │ In case of the system  │
590       │          │                     │ instance this resolves │
591       │          │                     │ to 0.                  │
592       ├──────────┼─────────────────────┼────────────────────────┤
593       │"%h"      │ User home directory │ This is the home       │
594       │          │                     │ directory of the user  │
595       │          │                     │ running the command.   │
596       │          │                     │ In case of the system  │
597       │          │                     │ instance this resolves │
598       │          │                     │ to "/root".            │
599       ├──────────┼─────────────────────┼────────────────────────┤
600       │"%H"      │ Host name           │ The hostname of the    │
601       │          │                     │ running system.        │
602       ├──────────┼─────────────────────┼────────────────────────┤
603       │"%l"      │ Short host name     │ The hostname of the    │
604       │          │                     │ running system,        │
605       │          │                     │ truncated at the first │
606       │          │                     │ dot to remove any      │
607       │          │                     │ domain component.      │
608       ├──────────┼─────────────────────┼────────────────────────┤
609       │"%L"      │ System or user log  │ In --user mode, this   │
610       │          │ directory           │ is the same as         │
611       │          │                     │ $XDG_CONFIG_HOME with  │
612       │          │                     │ /log appended, and     │
613       │          │                     │ /var/log otherwise.    │
614       ├──────────┼─────────────────────┼────────────────────────┤
615       │"%m"      │ Machine ID          │ The machine ID of the  │
616       │          │                     │ running system,        │
617       │          │                     │ formatted as string.   │
618       │          │                     │ See machine-id(5) for  │
619       │          │                     │ more information.      │
620       ├──────────┼─────────────────────┼────────────────────────┤
621       │"%M"      │ Operating system    │ The operating system   │
622       │          │ image identifier    │ image identifier of    │
623       │          │                     │ the running system, as │
624       │          │                     │ read from the          │
625       │          │                     │ IMAGE_ID= field of     │
626       │          │                     │ /etc/os-release. If    │
627       │          │                     │ not set, resolves to   │
628       │          │                     │ an empty string. See   │
629       │          │                     │ os-release(5) for more │
630       │          │                     │ information.           │
631       ├──────────┼─────────────────────┼────────────────────────┤
632       │"%o"      │ Operating system ID │ The operating system   │
633       │          │                     │ identifier of the      │
634       │          │                     │ running system, as     │
635       │          │                     │ read from the ID=
636       │          │                     │ field of               │
637       │          │                     │ /etc/os-release. See   │
638       │          │                     │ os-release(5) for more │
639       │          │                     │ information.           │
640       ├──────────┼─────────────────────┼────────────────────────┤
641       │"%S"      │ System or user      │ In --user mode, this   │
642       │          │ state directory     │ is the same as         │
643       │          │                     │ $XDG_CONFIG_HOME, and  │
644       │          │                     │ /var/lib otherwise.    │
645       ├──────────┼─────────────────────┼────────────────────────┤
646       │"%t"      │ System or user      │ In --user mode, this   │
647       │          │ runtime directory   │ is the same            │
648       │          │                     │ $XDG_RUNTIME_DIR, and  │
649       │          │                     │ /run/ otherwise.       │
650       ├──────────┼─────────────────────┼────────────────────────┤
651       │"%T"      │ Directory for       │ This is either /tmp or │
652       │          │ temporary files     │ the path "$TMPDIR",    │
653       │          │                     │ "$TEMP" or "$TMP" are  │
654       │          │                     │ set to. (Note that the │
655       │          │                     │ directory may be       │
656       │          │                     │ specified without a    │
657       │          │                     │ trailing slash.)       │
658       ├──────────┼─────────────────────┼────────────────────────┤
659       │"%u"      │ User name           │ This is the name of    │
660       │          │                     │ the user running the   │
661       │          │                     │ command. In case of    │
662       │          │                     │ the system instance    │
663       │          │                     │ this resolves to       │
664       │          │                     │ "root".                │
665       ├──────────┼─────────────────────┼────────────────────────┤
666       │"%U"      │ User UID            │ This is the numeric    │
667       │          │                     │ UID of the user        │
668       │          │                     │ running the command.   │
669       │          │                     │ In case of the system  │
670       │          │                     │ instance this resolves │
671       │          │                     │ to 0.                  │
672       ├──────────┼─────────────────────┼────────────────────────┤
673       │"%v"      │ Kernel release      │ Identical to uname -r  
674       │          │                     │ output.                │
675       ├──────────┼─────────────────────┼────────────────────────┤
676       │"%V"      │ Directory for       │ This is either         │
677       │          │ larger and          │ /var/tmp or the path   │
678       │          │ persistent          │ "$TMPDIR", "$TEMP" or  │
679       │          │ temporary files     │ "$TMP" are set to.     │
680       │          │                     │ (Note that the         │
681       │          │                     │ directory may be       │
682       │          │                     │ specified without a    │
683       │          │                     │ trailing slash.)       │
684       ├──────────┼─────────────────────┼────────────────────────┤
685       │"%w"      │ Operating system    │ The operating system   │
686       │          │ version ID          │ version identifier of  │
687       │          │                     │ the running system, as │
688       │          │                     │ read from the          │
689       │          │                     │ VERSION_ID= field of   │
690       │          │                     │ /etc/os-release. If    │
691       │          │                     │ not set, resolves to   │
692       │          │                     │ an empty string. See   │
693       │          │                     │ os-release(5) for more │
694       │          │                     │ information.           │
695       ├──────────┼─────────────────────┼────────────────────────┤
696       │"%W"      │ Operating system    │ The operating system   │
697       │          │ variant ID          │ variant identifier of  │
698       │          │                     │ the running system, as │
699       │          │                     │ read from the          │
700       │          │                     │ VARIANT_ID= field of   │
701       │          │                     │ /etc/os-release. If    │
702       │          │                     │ not set, resolves to   │
703       │          │                     │ an empty string. See   │
704       │          │                     │ os-release(5) for more │
705       │          │                     │ information.           │
706       ├──────────┼─────────────────────┼────────────────────────┤
707       │"%%"      │ Single percent sign │ Use "%%" in place of   │
708       │          │                     │ "%" to specify a       │
709       │          │                     │ single percent sign.   │
710       └──────────┴─────────────────────┴────────────────────────┘
711

EXAMPLES

713       Example 1. Create directories with specific mode and ownership
714
715       screen(1), needs two directories created at boot with specific modes
716       and ownership:
717
718           # /usr/lib/tmpfiles.d/screen.conf
719           d /run/screens  1777 root screen 10d
720           d /run/uscreens 0755 root screen 10d12h
721
722       Contents of /run/screens and /run/uscreens will be cleaned up after 10
723       and 10½ days, respectively.
724
725       Example 2. Create a directory with a SMACK attribute
726
727           D /run/cups - - - -
728           t /run/cups - - - - security.SMACK64=printing user.attr-with-spaces="foo bar"
729
730
731       The directory will be owned by root and have default mode. Its contents
732       are not subject to time based cleanup, but will be obliterated when
733       systemd-tmpfiles --remove runs.
734
735       Example 3. Create a directory and prevent its contents from cleanup
736
737       abrt(1), needs a directory created at boot with specific mode and
738       ownership and its content should be preserved from the automatic
739       cleanup applied to the contents of /var/tmp:
740
741           # /usr/lib/tmpfiles.d/tmp.conf
742           d /var/tmp 1777 root root 30d
743
744           # /usr/lib/tmpfiles.d/abrt.conf
745           d /var/tmp/abrt 0755 abrt abrt -
746
747       Example 4. Apply clean up during boot and based on time
748
749           # /usr/lib/tmpfiles.d/dnf.conf
750           r! /var/cache/dnf/*/*/download_lock.pid
751           r! /var/cache/dnf/*/*/metadata_lock.pid
752           r! /var/lib/dnf/rpmdb_lock.pid
753           e  /var/cache/dnf/ - - - 30d
754
755       The lock files will be removed during boot. Any files and directories
756       in /var/cache/dnf/ will be removed after they have not been accessed in
757       30 days.
758
759       Example 5. Empty the contents of a cache directory on boot
760
761           # /usr/lib/tmpfiles.d/krb5rcache.conf
762           e! /var/cache/krb5rcache - - - 0
763
764       Any files and subdirectories in /var/cache/krb5rcache/ will be removed
765       on boot. The directory will not be created.
766

/RUN/ AND /VAR/RUN/

768       /var/run/ is a deprecated symlink to /run/, and applications should use
769       the latter.  systemd-tmpfiles will warn if /var/run/ is used.
770

SEE ALSO

772       systemd(1), systemd-tmpfiles(8), systemd-delta(1), systemd.exec(5),
773       attr(5), getfattr(1), setfattr(1), setfacl(1), getfacl(1), chattr(1),
774       btrfs-subvolume(8), btrfs-qgroup(8)
775

NOTES

777        1. Notes on Resolvability of User and Group Names
778           https://systemd.io/UIDS-GIDS/#notes-on-resolvability-of-user-and-group-names
779
780
781
782systemd 251                                                      TMPFILES.D(5)
Impressum