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

SPECIFIERS

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

EXAMPLES

746       Example 1. Create directories with specific mode and ownership
747
748       screen(1), needs two directories created at boot with specific modes
749       and ownership:
750
751           # /usr/lib/tmpfiles.d/screen.conf
752           d /run/screens  1777 root screen 10d
753           d /run/uscreens 0755 root screen 10d12h
754
755       Contents of /run/screens and /run/uscreens will be cleaned up after 10
756       and 10½ days, respectively.
757
758       Example 2. Create a directory with a SMACK attribute
759
760           D /run/cups - - - -
761           t /run/cups - - - - security.SMACK64=printing user.attr-with-spaces="foo bar"
762
763
764       The directory will be owned by root and have default mode. Its contents
765       are not subject to time-based cleanup, but will be obliterated when
766       systemd-tmpfiles --remove runs.
767
768       Example 3. Create a directory and prevent its contents from cleanup
769
770       abrt(1), needs a directory created at boot with specific mode and
771       ownership and its content should be preserved from the automatic
772       cleanup applied to the contents of /var/tmp:
773
774           # /usr/lib/tmpfiles.d/tmp.conf
775           d /var/tmp 1777 root root 30d
776
777           # /usr/lib/tmpfiles.d/abrt.conf
778           d /var/tmp/abrt 0755 abrt abrt -
779
780       Example 4. Apply clean up during boot and based on time
781
782           # /usr/lib/tmpfiles.d/dnf.conf
783           r! /var/cache/dnf/*/*/download_lock.pid
784           r! /var/cache/dnf/*/*/metadata_lock.pid
785           r! /var/lib/dnf/rpmdb_lock.pid
786           e  /var/cache/dnf/ - - - 30d
787
788       The lock files will be removed during boot. Any files and directories
789       in /var/cache/dnf/ will be removed after they have not been accessed in
790       30 days.
791
792       Example 5. Empty the contents of a cache directory on boot
793
794           # /usr/lib/tmpfiles.d/krb5rcache.conf
795           e! /var/cache/krb5rcache - - - 0
796
797       Any files and subdirectories in /var/cache/krb5rcache/ will be removed
798       on boot. The directory will not be created.
799
800       Example 6. Provision SSH public key access for root user via
801       Credentials in QEMU
802
803           -smbios type=11,value=io.systemd.credential.binary:tmpfiles.extra=$(echo "f~ /root/.ssh/authorized_keys 700 root root - $(ssh-add -L | base64 -w 0)" | base64 -w 0)
804
805       By passing this line to QEMU, the public key of the current user will
806       be encoded in base64, added to a tmpfiles.d line that tells
807       systemd-tmpfiles to decode it into /root/.ssh/authorized_keys, encode
808       that line itself in base64 and pass it as a Credential that will be
809       picked up by systemd from SMBIOS on boot.
810

/RUN/ AND /VAR/RUN/

812       /var/run/ is a deprecated symlink to /run/, and applications should use
813       the latter.  systemd-tmpfiles will warn if /var/run/ is used.
814

SEE ALSO

816       systemd(1), systemd-tmpfiles(8), systemd-delta(1), systemd.exec(5),
817       attr(5), getfattr(1), setfattr(1), setfacl(1), getfacl(1), chattr(1),
818       btrfs-subvolume(8), btrfs-qgroup(8)
819

NOTES

821        1. Base64 decoded
822           https://www.rfc-editor.org/rfc/rfc4648.html
823
824        2. System and Service Credentials
825           https://systemd.io/CREDENTIALS
826
827        3. Notes on Resolvability of User and Group Names
828           https://systemd.io/UIDS-GIDS/#notes-on-resolvability-of-user-and-group-names
829
830
831
832systemd 253                                                      TMPFILES.D(5)
Impressum