Debian Codegraph @

upstream/debian-trixie/man5/tmpfiles.d.5

raw
1 '\" t
2 .TH "TMPFILES\&.D" "5" "" "systemd 257.13" "tmpfiles.d"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 tmpfiles.d \- Configuration for creation, deletion, and cleaning of files and directories
24 .SH "SYNOPSIS"
25 .PP
26 .RS 4
27 /etc/tmpfiles\&.d/*\&.conf
28 .RE
29 .RS 4
30 /run/tmpfiles\&.d/*\&.conf
31 .RE
32 .RS 4
33 /usr/local/lib/tmpfiles\&.d/*\&.conf
34 .RE
35 .RS 4
36 /usr/lib/tmpfiles\&.d/*\&.conf
37 .RE
38 .PP
39 .RS 4
40 ~/\&.config/user\-tmpfiles\&.d/*\&.conf
41 .RE
42 .RS 4
43 $XDG_RUNTIME_DIR/user\-tmpfiles\&.d/*\&.conf
44 .RE
45 .RS 4
46 ~/\&.local/share/user\-tmpfiles\&.d/*\&.conf
47 .RE
48 .RS 4
49 \&...
50 .RE
51 .RS 4
52 /usr/local/share/user\-tmpfiles\&.d/*\&.conf
53 .RE
54 .RS 4
55 /usr/share/user\-tmpfiles\&.d/*\&.conf
56 .RE
57 .sp
58 .nf
59 #Type Path Mode User Group Age Argument
60 f /file/to/create mode user group \- content
61 f+ /file/to/create\-or\-truncate mode user group \- content
62 w /file/to/write\-to \- \- \- \- content
63 w+ /file/to/append\-to \- \- \- \- content
64 d /directory/to/create\-and\-clean\-up mode user group cleanup\-age \-
65 D /directory/to/create\-and\-remove mode user group cleanup\-age \-
66 e /directory/to/clean\-up mode user group cleanup\-age \-
67 v /subvolume\-or\-directory/to/create mode user group cleanup\-age \-
68 q /subvolume\-or\-directory/to/create mode user group cleanup\-age \-
69 Q /subvolume\-or\-directory/to/create mode user group cleanup\-age \-
70 p /fifo/to/create mode user group \- \-
71 p+ /fifo/to/[re]create mode user group \- \-
72 L /symlink/to/create \- \- \- \- symlink/target/path
73 L+ /symlink/to/[re]create \- \- \- \- symlink/target/path
74 c /dev/char\-device\-to\-create mode user group \- major:minor
75 c+ /dev/char\-device\-to\-[re]create mode user group \- major:minor
76 b /dev/block\-device\-to\-create mode user group \- major:minor
77 b+ /dev/block\-device\-to\-[re]create mode user group \- major:minor
78 C /target/to/create \- \- \- cleanup\-age /source/to/copy
79 C+ /target/to/create \- \- \- cleanup\-age /source/to/copy
80 x /path\-or\-glob/to/ignore/recursively \- \- \- cleanup\-age \-
81 X /path\-or\-glob/to/ignore \- \- \- cleanup\-age \-
82 r /path\-or\-glob/to/remove \- \- \- \- \-
83 R /path\-or\-glob/to/remove/recursively \- \- \- \- \-
84 z /path\-or\-glob/to/adjust/mode mode user group \- \-
85 Z /path\-or\-glob/to/adjust/mode/recursively mode user group \- \-
86 t /path\-or\-glob/to/set/xattrs \- \- \- \- xattrs
87 T /path\-or\-glob/to/set/xattrs/recursively \- \- \- \- xattrs
88 h /path\-or\-glob/to/set/attrs \- \- \- \- file attrs
89 H /path\-or\-glob/to/set/attrs/recursively \- \- \- \- file attrs
90 a /path\-or\-glob/to/set/acls \- \- \- \- POSIX ACLs
91 a+ /path\-or\-glob/to/append/acls \- \- \- \- POSIX ACLs
92 A /path\-or\-glob/to/set/acls/recursively \- \- \- \- POSIX ACLs
93 A+ /path\-or\-glob/to/append/acls/recursively \- \- \- \- POSIX ACLs
94
95 .fi
96 .SH "DESCRIPTION"
97 .PP
98 tmpfiles\&.d
99 configuration files provide a generic mechanism to define the
100 \fIcreation\fR
101 of regular files, directories, pipes, and device nodes, adjustments to their
102 \fIaccess mode, ownership, attributes, quota assignments, and contents\fR, and finally their time\-based
103 \fIremoval\fR\&. It is mostly commonly used for volatile and temporary files and directories (such as those located under
104 /run/,
105 /tmp/,
106 /var/tmp/, the API file systems such as
107 /sys/
108 or
109 /proc/, as well as some other directories below
110 /var/)\&.
111 .PP
112 \fBsystemd-tmpfiles\fR(8)
113 uses this configuration to create volatile files and directories during boot and to do periodic cleanup afterwards\&. See
114 \fBsystemd-tmpfiles\fR(8)
115 for the description of
116 systemd\-tmpfiles\-setup\&.service,
117 systemd\-tmpfiles\-clean\&.service, and associated units\&.
118 .PP
119 System daemons frequently require private runtime directories below
120 /run/
121 to store communication sockets and similar\&. For these, it is better to use
122 \fIRuntimeDirectory=\fR
123 in their unit files (see
124 \fBsystemd.exec\fR(5)
125 for details), if the flexibility provided by
126 tmpfiles\&.d
127 is not required\&. The advantages are that the configuration required by the unit is centralized in one place, and that the lifetime of the directory is tied to the lifetime of the service itself\&. Similarly,
128 \fIStateDirectory=\fR,
129 \fICacheDirectory=\fR,
130 \fILogsDirectory=\fR, and
131 \fIConfigurationDirectory=\fR
132 should be used to create directories under
133 /var/lib/,
134 /var/cache/,
135 /var/log/, and
136 /etc/\&.
137 tmpfiles\&.d
138 should be used for files whose lifetime is independent of any service or requires more complicated configuration\&.
139 .SH "CONFIGURATION DIRECTORIES AND PRECEDENCE"
140 .PP
141 Each configuration file shall be named in the style of
142 \fIpackage\fR\&.conf
143 or
144 \fIpackage\fR\-\fIpart\fR\&.conf\&. The second variant should be used when it is desirable to make it easy to override just this part of configuration\&.
145 .PP
146 Files in
147 /etc/tmpfiles\&.d
148 override files with the same name in
149 /usr/lib/tmpfiles\&.d
150 and
151 /run/tmpfiles\&.d\&. Files in
152 /run/tmpfiles\&.d
153 override files with the same name in
154 /usr/lib/tmpfiles\&.d\&. Packages should install their configuration files in
155 /usr/lib/tmpfiles\&.d\&. Files in
156 /etc/tmpfiles\&.d
157 are reserved for the local administrator, who may use this logic to override the configuration files installed by vendor packages\&. All configuration files are sorted by their filename in lexicographic order, regardless of which of the directories they reside in\&. If multiple files specify the same path, the entry in the file with the lexicographically earliest name will be applied (note that lines suppressed due to the
158 "!"
159 are filtered before application, meaning that if an early line carries the exclamation mark and is suppressed because of that, a later line matching in path will be applied)\&. All other conflicting entries will be logged as errors\&. When two lines are prefix path and suffix path of each other, then the prefix line is always created first, the suffix later (and if removal applies to the line, the order is reversed: the suffix is removed first, the prefix later)\&. Lines that take globs are applied after those accepting no globs\&. If multiple operations shall be applied on the same file (such as ACL, xattr, file attribute adjustments), these are always done in the same fixed order\&. Except for those cases, the files/directories are processed in the order they are listed\&.
160 .PP
161 If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to
162 /dev/null
163 in
164 /etc/tmpfiles\&.d/
165 bearing the same filename\&.
166 .SH "CONFIGURATION FILE FORMAT"
167 .PP
168 The configuration format is one line per path, containing type, path, mode, ownership, age, and argument fields\&. The lines are separated by newlines, the fields by whitespace:
169 .sp
170 .if n \{\
171 .RS 4
172 .\}
173 .nf
174 #Type Path Mode User Group Age Argument\&...
175 d /run/user 0755 root root 10d \-
176 L /tmp/foobar \- \- \- \- /dev/null
177 .fi
178 .if n \{\
179 .RE
180 .\}
181 .PP
182 Fields may contain C\-style escapes\&. With the exception of the seventh field (the "argument") all fields may be enclosed in quotes\&. Note that any whitespace found in the line after the beginning of the argument field will be considered part of the argument field\&. To begin the argument field with a whitespace character, use C\-style escapes (e\&.g\&.
183 "\ex20")\&.
184 .SS "Type"
185 .PP
186 The type consists of a single letter and optionally one or more modifier characters: a plus sign ("+"), exclamation mark ("!"), minus sign ("\-"), equals sign ("="), tilde character ("~") and/or caret ("^")\&.
187 .PP
188 The following line types are understood:
189 .PP
190 \fIf\fR, \fIf+\fR
191 .RS 4
192 \fIf\fR
193 will create a file if it does not exist yet\&. If the argument parameter is given and the file did not exist yet, it will be written to the file\&.
194 \fIf+\fR
195 will create or truncate the file\&. If the argument parameter is given, it will be written to the file\&. Does not follow symlinks\&.
196 .RE
197 .PP
198 \fIw\fR, \fIw+\fR
199 .RS 4
200 Write the argument parameter to a file, if the file exists\&. If suffixed with
201 \fI+\fR, the line will be appended to the file\&. If your configuration writes multiple lines to the same file, use
202 \fIw+\fR\&. Lines of this type accept shell\-style globs in place of normal path names\&. The argument parameter will be written without a trailing newline\&. C\-style backslash escapes are interpreted\&. Follows symlinks\&.
203 .RE
204 .PP
205 \fId\fR
206 .RS 4
207 Create a directory\&. The mode and ownership will be adjusted if specified\&. Contents of this directory are subject to time\-based cleanup if the age argument is specified\&.
208 .RE
209 .PP
210 \fID\fR
211 .RS 4
212 Similar to
213 \fId\fR, but in addition the contents of the directory will be removed when
214 \fB\-\-remove\fR
215 is used\&.
216 .RE
217 .PP
218 \fIe\fR
219 .RS 4
220 Adjust the mode and ownership of existing directories and remove their contents based on age\&. Lines of this type accept shell\-style globs in place of normal path names\&. Contents of the directories are subject to time\-based cleanup if the age argument is specified\&. If the age argument is
221 "0", contents will be unconditionally deleted every time
222 \fBsystemd-tmpfiles\fR(8)
223 \fB\-\-clean\fR
224 is run\&.
225 .sp
226 For this entry to be useful, at least one of the mode, user, group, or age arguments must be specified, since otherwise this entry has no effect\&. As an exception, an entry with no effect may be useful when combined with
227 \fI!\fR, see the examples\&.
228 .sp
229 Added in version 230\&.
230 .RE
231 .PP
232 \fIv\fR
233 .RS 4
234 Create a subvolume if the path does not exist yet, the file system supports subvolumes (btrfs), and the system itself is installed into a subvolume (specifically: the root directory
235 /
236 is itself a subvolume)\&. Otherwise, create a normal directory, in the same way as
237 \fId\fR\&.
238 .sp
239 A subvolume created with this line type is not assigned to any higher\-level quota group\&. For that, use
240 \fIq\fR
241 or
242 \fIQ\fR, which allow creating simple quota group hierarchies, see below\&.
243 .sp
244 Added in version 219\&.
245 .RE
246 .PP
247 \fIq\fR
248 .RS 4
249 Create a subvolume or directory the same as
250 \fIv\fR, but assign the subvolume to the same higher\-level quota groups as the parent\&. This ensures that higher\-level limits and accounting applied to the parent subvolume also include the specified subvolume\&. On non\-btrfs file systems, this line type is identical to
251 \fId\fR\&.
252 .sp
253 If the subvolume already exists, no change to the quota hierarchy is made, regardless of whether the subvolume is already attached to a quota group or not\&. Also see
254 \fIQ\fR
255 below\&. See
256 \fBbtrfs-qgroup\fR(8)
257 for details about the btrfs quota group concept\&.
258 .sp
259 Added in version 228\&.
260 .RE
261 .PP
262 \fIQ\fR
263 .RS 4
264 Create the subvolume or directory the same as
265 \fIv\fR, but assign the new subvolume to a new leaf quota group\&. Instead of copying the higher\-level quota group assignments from the parent as is done with
266 \fIq\fR, the lowest quota group of the parent subvolume is determined that is not the leaf quota group\&. Then, an "intermediary" quota group is inserted that is one level below this level, and shares the same ID part as the specified subvolume\&. If no higher\-level quota group exists for the parent subvolume, a new quota group at level 255 sharing the same ID as the specified subvolume is inserted instead\&. This new intermediary quota group is then assigned to the parent subvolume\*(Aqs higher\-level quota groups, and the specified subvolume\*(Aqs leaf quota group is assigned to it\&.
267 .sp
268 Effectively, this has a similar effect as
269 \fIq\fR, however introduces a new higher\-level quota group for the specified subvolume that may be used to enforce limits and accounting to the specified subvolume and children subvolume created within it\&. Thus, by creating subvolumes only via
270 \fIq\fR
271 and
272 \fIQ\fR, a concept of "subtree quotas" is implemented\&. Each subvolume for which
273 \fIQ\fR
274 is set will get a "subtree" quota group created, and all child subvolumes created within it will be assigned to it\&. Each subvolume for which
275 \fIq\fR
276 is set will not get such a "subtree" quota group, but it is ensured that they are added to the same "subtree" quota group as their immediate parents\&.
277 .sp
278 It is recommended to use
279 \fIQ\fR
280 for subvolumes that typically contain further subvolumes, and where it is desirable to have accounting and quota limits on all child subvolumes together\&. Examples for
281 \fIQ\fR
282 are typically
283 /home/
284 or
285 /var/lib/machines/\&. In contrast,
286 \fIq\fR
287 should be used for subvolumes that either usually do not include further subvolumes or where no accounting and quota limits are needed that apply to all child subvolumes together\&. Examples for
288 \fIq\fR
289 are typically
290 /var/
291 or
292 /var/tmp/\&.
293 .sp
294 As with
295 \fIq\fR,
296 \fIQ\fR
297 has no effect on the quota group hierarchy if the subvolume already exists, regardless of whether the subvolume already belong to a quota group or not\&.
298 .sp
299 Added in version 228\&.
300 .RE
301 .PP
302 \fIp\fR, \fIp+\fR
303 .RS 4
304 Create a named pipe (FIFO) if it does not exist yet\&. If suffixed with
305 \fI+\fR
306 and a file already exists where the pipe is to be created, it will be removed and be replaced by the pipe\&.
307 .RE
308 .PP
309 \fIL\fR, \fIL+\fR, \fIL?\fR
310 .RS 4
311 Create a symlink if it does not exist yet\&. If suffixed with
312 \fI+\fR
313 and a file or directory already exists where the symlink is to be created, it will be removed and be replaced by the symlink\&. If suffixed with
314 \fI?\fR
315 and the source path does not exist, the symlink is not created\&. If the argument is omitted, symlinks to files with the same name residing in the directory
316 /usr/share/factory/
317 are created\&. Note that permissions on symlinks are ignored\&.
318 .RE
319 .PP
320 \fIc\fR, \fIc+\fR
321 .RS 4
322 Create a character device node if it does not exist yet\&. If suffixed with
323 \fI+\fR
324 and a file already exists where the device node is to be created, it will be removed and be replaced by the device node\&. It is recommended to suffix this entry with an exclamation mark to only create static device nodes at boot, as udev will not manage static device nodes that are created at runtime\&.
325 .RE
326 .PP
327 \fIb\fR, \fIb+\fR
328 .RS 4
329 Create a block device node if it does not exist yet\&. If suffixed with
330 \fI+\fR
331 and a file already exists where the device node is to be created, it will be removed and be replaced by the device node\&. It is recommended to suffix this entry with an exclamation mark to only create static device nodes at boot, as udev will not manage static device nodes that are created at runtime\&.
332 .RE
333 .PP
334 \fIC\fR, \fIC+\fR
335 .RS 4
336 Recursively copy a file or directory, if the destination files or directories do not exist yet or the destination directory is empty\&. Note that this command will not descend into subdirectories if the destination directory already exists and is not empty, unless the action is suffixed with
337 \fI+\fR\&. Instead, the entire copy operation is skipped\&. If the argument is omitted, files from the source directory
338 /usr/share/factory/
339 with the same name are copied\&. Does not follow symlinks\&. Contents of the directories are subject to time\-based cleanup if the age argument is specified\&.
340 .sp
341 Added in version 214\&.
342 .RE
343 .PP
344 \fIx\fR
345 .RS 4
346 Ignore a path during cleaning\&. Use this type to exclude paths from clean\-up as controlled with the Age parameter\&. Lines of this type accept shell\-style globs in place of normal path names\&.
347 .RE
348 .PP
349 \fIX\fR
350 .RS 4
351 Ignore a path during cleaning\&. Use this type to exclude paths from clean\-up as controlled with the Age parameter\&. Unlike
352 \fIx\fR, this parameter will not exclude the content if path is a directory, but only directory itself\&. Lines of this type accept shell\-style globs in place of normal path names\&.
353 .sp
354 Added in version 198\&.
355 .RE
356 .PP
357 \fIr\fR
358 .RS 4
359 Remove a file or directory if it exists\&. This may not be used to remove non\-empty directories, use
360 \fIR\fR
361 for that\&. Lines of this type accept shell\-style globs in place of normal path names\&. Does not follow symlinks\&.
362 .RE
363 .PP
364 \fIR\fR
365 .RS 4
366 Recursively remove a path and all its subdirectories (if it is a directory)\&. Lines of this type accept shell\-style globs in place of normal path names\&. Does not follow symlinks\&.
367 .RE
368 .PP
369 \fIz\fR
370 .RS 4
371 Adjust the access mode, user and group ownership, and restore the SELinux security context of a file or directory, if it exists\&. Lines of this type accept shell\-style globs in place of normal path names\&. Does not follow symlinks\&.
372 .RE
373 .PP
374 \fIZ\fR
375 .RS 4
376 Recursively set the access mode, user and group ownership, and restore the SELinux security context of a file or directory if it exists, as well as of its subdirectories and the files contained therein (if applicable)\&. Lines of this type accept shell\-style globs in place of normal path names\&. Does not follow symlinks\&.
377 .RE
378 .PP
379 \fIt\fR
380 .RS 4
381 Set extended attributes, see
382 \fBattr\fR(5)
383 for details\&. The argument field should take one or more assignment expressions in the form
384 \fInamespace\fR\&.\fIattribute\fR=\fIvalue\fR, for examples see below\&. Lines of this type accept shell\-style globs in place of normal path names\&. This can be useful for setting SMACK labels\&. Does not follow symlinks\&.
385 .sp
386 Please note that extended attributes settable with this line type are a different concept from the Linux file attributes settable with
387 \fIh\fR/\fIH\fR, see below\&.
388 .sp
389 Added in version 218\&.
390 .RE
391 .PP
392 \fIT\fR
393 .RS 4
394 Same as
395 \fIt\fR, but operates recursively\&.
396 .sp
397 Added in version 219\&.
398 .RE
399 .PP
400 \fIh\fR
401 .RS 4
402 Set Linux file/directory attributes\&. Lines of this type accept shell\-style globs in place of normal path names\&.
403 .sp
404 The format of the argument field is
405 \fI[+\-=][aAcCdDeijPsStTu]\fR\&. The prefix
406 \fI+\fR
407 (the default one) causes the attributes to be added;
408 \fI\-\fR
409 causes the attributes to be removed;
410 \fI=\fR
411 causes the attributes to be set exactly as the following letters\&. The letters
412 "aAcCdDeijPsStTu"
413 select the new attributes for the files, see
414 \fBchattr\fR(1)
415 for further information\&.
416 .sp
417 Passing only
418 \fI=\fR
419 as argument resets all the file attributes listed above\&. It has to be pointed out that the
420 \fI=\fR
421 prefix limits itself to the attributes corresponding to the letters listed here\&. All other attributes will be left untouched\&. Does not follow symlinks\&.
422 .sp
423 Please note that the Linux file attributes settable with this line type are a different concept from the extended attributes settable with
424 \fIt\fR/\fIT\fR, see above\&.
425 .RE
426 .PP
427 \fIH\fR
428 .RS 4
429 Sames as
430 \fIh\fR, but operates recursively\&.
431 .sp
432 Added in version 220\&.
433 .RE
434 .PP
435 \fIa\fR, \fIa+\fR
436 .RS 4
437 Set POSIX ACLs (access control lists), see
438 \fBacl\fR(5)\&. Additionally, if \*(AqX\*(Aq is used, the execute bit is set only if the file is a directory or already has execute permission for some user, as mentioned in
439 \fBsetfacl\fR(1)\&. If suffixed with
440 \fI+\fR, the specified entries will be added to the existing set\&.
441 \fBsystemd-tmpfiles\fR(8)
442 will automatically add the required base entries for user and group based on the access mode of the file, unless base entries already exist or are explicitly specified\&. The mask will be added if not specified explicitly or already present\&. Lines of this type accept shell\-style globs in place of normal path names\&. This can be useful for allowing additional access to certain files\&. Does not follow symlinks\&.
443 .sp
444 Added in version 219\&.
445 .RE
446 .PP
447 \fIA\fR, \fIA+\fR
448 .RS 4
449 Same as
450 \fIa\fR
451 and
452 \fIa+\fR, but recursive\&. Does not follow symlinks\&.
453 .sp
454 Added in version 219\&.
455 .RE
456 .SS "Type Modifiers"
457 .PP
458 If the exclamation mark ("!") is used, this line is only safe to execute during boot, and can break a running system\&. Lines without the exclamation mark are presumed to be safe to execute at any time, e\&.g\&. on package upgrades\&.
459 \fBsystemd-tmpfiles\fR(8)
460 will take lines with an exclamation mark only into consideration, if the
461 \fB\-\-boot\fR
462 option is given\&.
463 .PP
464 For example:
465 .sp
466 .if n \{\
467 .RS 4
468 .\}
469 .nf
470 # Make sure these are created by default so that nobody else can
471 d /tmp/\&.X11\-unix 1777 root root 10d
472
473 # Unlink the X11 lock files
474 r! /tmp/\&.X[0\-9]*\-lock
475 .fi
476 .if n \{\
477 .RE
478 .\}
479 .sp
480 The second line in contrast to the first one would break a running system, and will only be executed with
481 \fB\-\-boot\fR\&.
482 .PP
483 If the minus sign ("\-") is used, this line failing to run successfully during create (and only create) will not cause the execution of
484 \fBsystemd-tmpfiles\fR(8)
485 to return an error\&.
486 .PP
487 For example:
488 .sp
489 .if n \{\
490 .RS 4
491 .\}
492 .nf
493 # Modify sysfs but do not fail if we are in a container with a read\-only /proc
494 w\- /proc/sys/vm/swappiness \- \- \- \- 10
495 .fi
496 .if n \{\
497 .RE
498 .\}
499 .PP
500 If the equals sign ("=") is used, the file types of existing objects in the specified path are checked, and removed if they do not match\&. This includes any implicitly created parent directories (which can be either directories or directory symlinks)\&. For example, if there is a FIFO in place of one of the parent path components it will be replaced with a directory\&.
501 .PP
502 If the tilde character ("~") is used, the argument (i\&.e\&. 6th) column is
503 \m[blue]\fBBase64 decoded\fR\m[]\&\s-2\u[1]\d\s+2
504 before use\&. This modifier is only supported on line types that can write file contents, i\&.e\&.
505 \fIf\fR,
506 \fIf+\fR,
507 \fIw\fR,
508 \fI+\fR\&. This is useful for writing arbitrary binary data (including newlines and NUL bytes) to files\&. Note that if this switch is used, the argument is not subject to specifier expansion, neither before nor after Base64 decoding\&.
509 .PP
510 If the caret character ("^") is used, the argument (i\&.e\&. 6th) column takes a service credential name to read the argument data from\&. See
511 \m[blue]\fBSystem and Service Credentials\fR\m[]\&\s-2\u[2]\d\s+2
512 for details about the credentials concept\&. This modifier is only supported on line types that can write file contents, i\&.e\&.
513 \fIf\fR,
514 \fIf+\fR,
515 \fIw\fR,
516 \fIw+\fR\&. This is useful for writing arbitrary files with contents sourced from elsewhere, including from VM or container managers further up\&. If the specified credential is not set for the
517 \fBsystemd\-tmpfiles\fR
518 service, the line is silently skipped\&. If
519 "^"
520 and
521 "~"
522 are combined Base64 decoding is applied to the credential contents\&.
523 .PP
524 If the dollar sign ("$") is used, the file becomes subject to removal when
525 \fBsystemd\-tmpfiles\fR
526 is invoked with the
527 \fB\-\-purge\fR
528 switch\&. Lines without this character are unaffected by that switch\&.
529 .PP
530 Note that for all line types that result in creation of any kind of file node (i\&.e\&.
531 \fIf\fR,
532 \fId\fR/\fID\fR/\fIv\fR/\fIq\fR/\fIQ\fR,
533 \fIp\fR,
534 \fIL\fR,
535 \fIc\fR/\fIb\fR
536 and
537 \fIC\fR) leading directories are implicitly created if needed, owned by root with an access mode of 0755\&. In order to create them with different modes or ownership make sure to add appropriate
538 \fId\fR
539 lines\&.
540 .SS "Path"
541 .PP
542 The file system path specification supports simple specifier expansion, see below\&. The path (after expansion) must be absolute\&.
543 .SS "Mode"
544 .PP
545 The file access mode to use when creating this file or directory\&. If omitted or when set to
546 "\-", the default is used: 0755 for directories, 0644 for all other file objects\&. For
547 \fIz\fR,
548 \fIZ\fR
549 lines, if omitted or when set to
550 "\-", the file access mode will not be modified\&. This parameter is ignored for
551 \fIx\fR,
552 \fIr\fR,
553 \fIR\fR,
554 \fIL\fR,
555 \fIt\fR, and
556 \fIa\fR
557 lines\&.
558 .PP
559 Optionally, if prefixed with
560 "~", the access mode is masked based on the already set access bits for existing file or directories: if the existing file has all executable bits unset, all executable bits are removed from the new access mode, too\&. Similarly, if all read bits are removed from the old access mode, they will be removed from the new access mode too, and if all write bits are removed, they will be removed from the new access mode too\&. In addition, the sticky/SUID/SGID bit is removed unless applied to a directory\&. This functionality is particularly useful in conjunction with
561 \fIZ\fR\&.
562 .PP
563 By default the access mode of listed inodes is set to the specified mode regardless if it is created anew, or already existed\&. Optionally, if prefixed with
564 ":", the configured access mode is only applied when creating new inodes, and if the inode the line refers to already exists, its access mode is left in place unmodified\&.
565 .SS "User, Group"
566 .PP
567 The user and group to use for this file or directory\&. This may either be a numeric ID or a user/group name\&. If omitted or when set to
568 "\-", the user and group of the user who invokes
569 \fBsystemd-tmpfiles\fR(8)
570 is used\&. For
571 \fIz\fR
572 and
573 \fIZ\fR
574 lines, when omitted or when set to
575 "\-", the file ownership will not be modified\&. These parameters are ignored for
576 \fIx\fR,
577 \fIr\fR,
578 \fIR\fR,
579 \fIt\fR, and
580 \fIa\fR
581 lines\&.
582 .PP
583 This field should generally only reference system users/groups, i\&.e\&. users/groups that are guaranteed to be resolvable during early boot\&. If this field references users/groups that only become resolveable during later boot (i\&.e\&. after NIS, LDAP or a similar networked directory service become available), execution of the operations declared by the line will likely fail\&. Also see
584 \m[blue]\fBNotes on Resolvability of User and Group Names\fR\m[]\&\s-2\u[3]\d\s+2
585 for more information on requirements on system user/group definitions\&.
586 .PP
587 By default the ownership of listed inodes is set to the specified user/group regardless if it is created anew, or already existed\&. Optionally, if prefixed with
588 ":", the configured user/group information is only applied when creating new inodes, and if the inode the line refers to already exists, its user/group is left in place unmodified\&.
589 .SS "Age"
590 .PP
591 The date field, when set, is used to decide what files to delete when cleaning\&. If a file or directory is older than the current time minus the age field, it is deleted\&. The field format is a series of integers each followed by one of the following suffixes for the respective time units:
592 \fBs\fR,
593 \fBm\fR
594 or
595 \fBmin\fR,
596 \fBh\fR,
597 \fBd\fR,
598 \fBw\fR,
599 \fBms\fR, and
600 \fBus\fR, meaning seconds, minutes, hours, days, weeks, milliseconds, and microseconds, respectively\&. Full names of the time units can be used too\&.
601 .PP
602 If multiple integers and units are specified, the time values are summed\&. If an integer is given without a unit,
603 \fBs\fR
604 is assumed\&.
605 .PP
606 When the age is set to zero, the files are cleaned unconditionally\&.
607 .PP
608 The age field only applies to lines starting with
609 \fId\fR,
610 \fID\fR,
611 \fIe\fR,
612 \fIv\fR,
613 \fIq\fR,
614 \fIQ\fR,
615 \fIC\fR,
616 \fIx\fR
617 and
618 \fIX\fR\&. If omitted or set to
619 "\-", no automatic clean\-up is done\&.
620 .PP
621 If the age field starts with a tilde character
622 "~", clean\-up is only applied to files and directories one level inside the directory specified, but not the files and directories immediately inside it\&.
623 .PP
624 The age of a file system entry is determined from its last modification timestamp (mtime), its last access timestamp (atime), and (except for directories) its last status change timestamp (ctime)\&. By default, any of these three (or two) values will prevent cleanup if it is more recent than the current time minus the age field\&. To restrict the deletion based on particular type of file timestamps, the age\-by argument can be used\&.
625 .PP
626 The age\-by argument overrides the timestamp types to be used for the age check\&. It can be specified by prefixing the age argument with a sequence of characters to specify the timestamp types and a colon (":"):
627 "\fIage\-by\fR\&.\&.\&.:\fIcleanup\-age\fR"\&. The argument can consist of
628 \fBa\fR
629 (\fBA\fR
630 for directories),
631 \fBb\fR
632 (\fBB\fR
633 for directories),
634 \fBc\fR
635 (\fBC\fR
636 for directories), or
637 \fBm\fR
638 (\fBM\fR
639 for directories)\&. Those respectively indicate access, creation, last status change, and last modification time of a file system entry\&. The lower\-case letter signifies that the given timestamp type should be considered for files, while the upper\-case letter signifies that the given timestamp type should be considered for directories\&. See
640 \fBstatx\fR(2)
641 file timestamp fields for more details about timestamp types\&.
642 .PP
643 If not specified, the age\-by field defaults to
644 \fBabcmABM\fR, i\&.e\&. by default all file timestamps are taken into consideration, with the exception of the last status change timestamp (ctime) for directories\&. This is because the aging logic itself will alter the ctime whenever it deletes a file inside it\&. To ensure that running the aging logic does not feed back into the next iteration of itself, ctime for directories is ignored by default\&.
645 .PP
646 For example:
647 .sp
648 .if n \{\
649 .RS 4
650 .\}
651 .nf
652 # Files created and modified, and directories accessed more than
653 # an hour ago in "/tmp/foo/bar", are subject to time\-based cleanup\&.
654 d /tmp/foo/bar \- \- \- bmA:1h \-
655 .fi
656 .if n \{\
657 .RE
658 .\}
659 .PP
660 Note that while the aging algorithm is run an exclusive BSD file lock (see
661 \fBflock\fR(2)) is taken on each directory/file the algorithm decides to remove\&. If the aging algorithm finds a lock (shared or exclusive) is already taken on some directory/file, it (and everything below it) is skipped\&. Applications may use this to temporarily exclude certain directory subtrees from the aging algorithm: the applications can take a BSD file lock themselves, and as long as they keep it aging of the directory/file and everything below it is disabled\&.
662 .PP
663 This behavior can be used to ensure guaranteed cleanup of files or directories whose lifetime should be aligned with the process that created them by having that process create them in a location monitored by
664 \fBsystemd\-tmpfiles\fR
665 with an age of
666 "0", and having the process immediately lock the directory or file before using it\&. Because the BSD lock is process specific, the file is guaranteed to be unlocked as soon as the process exits, meaning that even if the process crashes, those files and directories will be unlocked and cleaned up by
667 \fBsystemd\-tmpfiles\fR\&.
668 .SS "Argument"
669 .PP
670 For
671 \fIL\fR
672 lines determines the destination path of the symlink\&. For
673 \fIc\fR
674 and
675 \fIb\fR, determines the major/minor of the device node, with major and minor formatted as integers, separated by
676 ":", e\&.g\&.
677 "1:3"\&. For
678 \fIf\fR
679 and
680 \fIw\fR, the argument may be used to specify a short string that is written to the file, suffixed by a newline\&. For
681 \fIC\fR, specifies the source file or directory\&. For
682 \fIt\fR
683 and
684 \fIT\fR, determines extended attributes to be set\&. For
685 \fIa\fR
686 and
687 \fIA\fR, determines ACL attributes to be set\&. For
688 \fIh\fR
689 and
690 \fIH\fR, determines the file attributes to set\&. Ignored for all other lines\&.
691 .PP
692 This field can contain specifiers, see below\&.
693 .SH "SPECIFIERS"
694 .PP
695 Specifiers can be used in the "path" and "argument" fields\&. An unknown or unresolvable specifier is treated as invalid configuration\&. The following expansions are understood:
696 .sp
697 .it 1 an-trap
698 .nr an-no-space-flag 1
699 .nr an-break-flag 1
700 .br
701 .B Table\ \&1.\ \&Specifiers available
702 .TS
703 allbox tab(:);
704 lB lB lB.
705 T{
706 Specifier
707 T}:T{
708 Meaning
709 T}:T{
710 Details
711 T}
712 .T&
713 l l l
714 l l l
715 l l l
716 l l l
717 l l l
718 l l l
719 l l l
720 l l l
721 l l l
722 l l l
723 l l l
724 l l l
725 l l l
726 l l l
727 l l l
728 l l l
729 l l l
730 l l l
731 l l l
732 l l l
733 l l l
734 l l l
735 l l l
736 l l l
737 l l l.
738 T{
739 "%a"
740 T}:T{
741 Architecture
742 T}:T{
743 A short string identifying the architecture of the local system\&. A string such as \fBx86\fR, \fBx86\-64\fR or \fBarm64\fR\&. See the architectures defined for \fIConditionArchitecture=\fR in \fBsystemd.unit\fR(5) for a full list\&.
744 T}
745 T{
746 "%A"
747 T}:T{
748 Operating system image version
749 T}:T{
750 The operating system image version identifier of the running system, as read from the \fIIMAGE_VERSION=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
751 T}
752 T{
753 "%b"
754 T}:T{
755 Boot ID
756 T}:T{
757 The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
758 T}
759 T{
760 "%B"
761 T}:T{
762 Operating system build ID
763 T}:T{
764 The operating system build identifier of the running system, as read from the \fIBUILD_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
765 T}
766 T{
767 "%C"
768 T}:T{
769 System or user cache directory
770 T}:T{
771 In \fB\-\-user\fR mode, this is the same as \fI$XDG_CACHE_HOME\fR, and /var/cache otherwise\&.
772 T}
773 T{
774 "%g"
775 T}:T{
776 User group
777 T}:T{
778 This is the name of the group running the command\&. In case of the system instance this resolves to "root"\&.
779 T}
780 T{
781 "%G"
782 T}:T{
783 User GID
784 T}:T{
785 This is the numeric GID of the group running the command\&. In case of the system instance this resolves to \fB0\fR\&.
786 T}
787 T{
788 "%h"
789 T}:T{
790 User home directory
791 T}:T{
792 This is the home directory of the user running the command\&. In case of the system instance this resolves to "/root"\&.
793 T}
794 T{
795 "%H"
796 T}:T{
797 Host name
798 T}:T{
799 The hostname of the running system\&.
800 T}
801 T{
802 "%l"
803 T}:T{
804 Short host name
805 T}:T{
806 The hostname of the running system, truncated at the first dot to remove any domain component\&.
807 T}
808 T{
809 "%L"
810 T}:T{
811 System or user log directory
812 T}:T{
813 In \fB\-\-user\fR mode, this is the same as \fI$XDG_STATE_HOME\fR with /log appended, and /var/log otherwise\&.
814 T}
815 T{
816 "%m"
817 T}:T{
818 Machine ID
819 T}:T{
820 The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
821 T}
822 T{
823 "%M"
824 T}:T{
825 Operating system image identifier
826 T}:T{
827 The operating system image identifier of the running system, as read from the \fIIMAGE_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
828 T}
829 T{
830 "%o"
831 T}:T{
832 Operating system ID
833 T}:T{
834 The operating system identifier of the running system, as read from the \fIID=\fR field of /etc/os\-release\&. See \fBos-release\fR(5) for more information\&.
835 T}
836 T{
837 "%q"
838 T}:T{
839 Pretty host name
840 T}:T{
841 The pretty hostname of the running system, as read from the \fIPRETTY_HOSTNAME=\fR field of /etc/machine\-info\&. If not set, resolves to the short hostname\&. See \fBmachine-info\fR(5) for more information\&.
842 T}
843 T{
844 "%S"
845 T}:T{
846 System or user state directory
847 T}:T{
848 In \fB\-\-user\fR mode, this is the same as \fI$XDG_STATE_HOME\fR, and /var/lib otherwise\&.
849 T}
850 T{
851 "%t"
852 T}:T{
853 System or user runtime directory
854 T}:T{
855 In \fB\-\-user\fR mode, this is the same \fI$XDG_RUNTIME_DIR\fR, and /run/ otherwise\&.
856 T}
857 T{
858 "%T"
859 T}:T{
860 Directory for temporary files
861 T}:T{
862 This is either /tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to\&. (Note that the directory may be specified without a trailing slash\&.)
863 T}
864 T{
865 "%u"
866 T}:T{
867 User name
868 T}:T{
869 This is the name of the user running the command\&. In case of the system instance this resolves to "root"\&.
870 T}
871 T{
872 "%U"
873 T}:T{
874 User UID
875 T}:T{
876 This is the numeric UID of the user running the command\&. In case of the system instance this resolves to \fB0\fR\&.
877 T}
878 T{
879 "%v"
880 T}:T{
881 Kernel release
882 T}:T{
883 Identical to \fBuname \-r\fR output\&.
884 T}
885 T{
886 "%V"
887 T}:T{
888 Directory for larger and persistent temporary files
889 T}:T{
890 This is either /var/tmp or the path "$TMPDIR", "$TEMP" or "$TMP" are set to\&. (Note that the directory may be specified without a trailing slash\&.)
891 T}
892 T{
893 "%w"
894 T}:T{
895 Operating system version ID
896 T}:T{
897 The operating system version identifier of the running system, as read from the \fIVERSION_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
898 T}
899 T{
900 "%W"
901 T}:T{
902 Operating system variant ID
903 T}:T{
904 The operating system variant identifier of the running system, as read from the \fIVARIANT_ID=\fR field of /etc/os\-release\&. If not set, resolves to an empty string\&. See \fBos-release\fR(5) for more information\&.
905 T}
906 T{
907 "%%"
908 T}:T{
909 Single percent sign
910 T}:T{
911 Use "%%" in place of "%" to specify a single percent sign\&.
912 T}
913 .TE
914 .sp 1
915 .SH "EXAMPLES"
916 .PP
917 \fBExample\ \&1.\ \&Create directories with specific mode and ownership\fR
918 .PP
919 \fBscreen\fR(1), needs two directories created at boot with specific modes and ownership:
920 .sp
921 .if n \{\
922 .RS 4
923 .\}
924 .nf
925 # /usr/lib/tmpfiles\&.d/screen\&.conf
926 d /run/screens 1777 root screen 10d
927 d /run/uscreens 0755 root screen 10d12h
928 .fi
929 .if n \{\
930 .RE
931 .\}
932 .PP
933 Contents of
934 /run/screens
935 and /run/uscreens will be cleaned up after 10 and 10\(12 days, respectively\&.
936 .PP
937 \fBExample\ \&2.\ \&Create a directory with a SMACK attribute\fR
938 .sp
939 .if n \{\
940 .RS 4
941 .\}
942 .nf
943 D /run/cups \- \- \- \-
944 t /run/cups \- \- \- \- security\&.SMACK64=printing user\&.attr\-with\-spaces="foo bar"
945 .fi
946 .if n \{\
947 .RE
948 .\}
949 .PP
950 The directory will be owned by root and have default mode\&. Its contents are not subject to time\-based cleanup, but will be obliterated when
951 \fBsystemd\-tmpfiles \-\-remove\fR
952 runs\&.
953 .PP
954 \fBExample\ \&3.\ \&Create a directory and prevent its contents from cleanup\fR
955 .PP
956 \fBabrt\fR(1), needs a directory created at boot with specific mode and ownership and its content should be preserved from the automatic cleanup applied to the contents of
957 /var/tmp:
958 .sp
959 .if n \{\
960 .RS 4
961 .\}
962 .nf
963 # /usr/lib/tmpfiles\&.d/tmp\&.conf
964 d /var/tmp 1777 root root 30d
965 .fi
966 .if n \{\
967 .RE
968 .\}
969 .sp
970 .if n \{\
971 .RS 4
972 .\}
973 .nf
974 # /usr/lib/tmpfiles\&.d/abrt\&.conf
975 d /var/tmp/abrt 0755 abrt abrt \-
976 .fi
977 .if n \{\
978 .RE
979 .\}
980 .PP
981 \fBExample\ \&4.\ \&Apply clean up during boot and based on time\fR
982 .sp
983 .if n \{\
984 .RS 4
985 .\}
986 .nf
987 # /usr/lib/tmpfiles\&.d/dnf\&.conf
988 r! /var/cache/dnf/*/*/download_lock\&.pid
989 r! /var/cache/dnf/*/*/metadata_lock\&.pid
990 r! /var/lib/dnf/rpmdb_lock\&.pid
991 e /var/cache/dnf/ \- \- \- 30d
992 .fi
993 .if n \{\
994 .RE
995 .\}
996 .PP
997 The lock files will be removed during boot\&. Any files and directories in
998 /var/cache/dnf/
999 will be removed after they have not been accessed in 30 days\&.
1000 .PP
1001 \fBExample\ \&5.\ \&Empty the contents of a cache directory on boot\fR
1002 .sp
1003 .if n \{\
1004 .RS 4
1005 .\}
1006 .nf
1007 # /usr/lib/tmpfiles\&.d/krb5rcache\&.conf
1008 e! /var/cache/krb5rcache \- \- \- 0
1009 .fi
1010 .if n \{\
1011 .RE
1012 .\}
1013 .PP
1014 Any files and subdirectories in
1015 /var/cache/krb5rcache/
1016 will be removed on boot\&. The directory will not be created\&.
1017 .PP
1018 \fBExample\ \&6.\ \&Provision SSH public key access for root user via Credentials in QEMU\fR
1019 .sp
1020 .if n \{\
1021 .RS 4
1022 .\}
1023 .nf
1024 \-smbios type=11,value=io\&.systemd\&.credential\&.binary:tmpfiles\&.extra=$(echo \-e "d /root/\&.ssh 0750 root root \-\enf~ /root/\&.ssh/authorized_keys 0600 root root \- $(ssh\-add \-L | base64 \-w 0)" | base64 \-w 0)
1025 .fi
1026 .if n \{\
1027 .RE
1028 .\}
1029 .PP
1030 By passing this line to QEMU, the public key of the current user will be encoded in base64, added to a tmpfiles\&.d line that tells
1031 \fBsystemd-tmpfiles\fR(8)
1032 to decode it into
1033 /root/\&.ssh/authorized_keys, encode that line itself in base64 and pass it as a Credential that will be picked up by systemd from SMBIOS on boot\&.
1034 .SH "/RUN/ AND /VAR/RUN/"
1035 .PP
1036 /var/run/
1037 is a deprecated symlink to
1038 /run/, and applications should use the latter\&.
1039 \fBsystemd\-tmpfiles\fR
1040 will warn if
1041 /var/run/
1042 is used\&.
1043 .SH "SEE ALSO"
1044 .PP
1045 \fBsystemd\fR(1), \fBsystemd-tmpfiles\fR(8), \fBsystemd-delta\fR(1), \fBsystemd.exec\fR(5), \fBattr\fR(5), \fBgetfattr\fR(1), \fBsetfattr\fR(1), \fBsetfacl\fR(1), \fBgetfacl\fR(1), \fBchattr\fR(1), \fBbtrfs-subvolume\fR(8), \fBbtrfs-qgroup\fR(8)
1046 .SH "NOTES"
1047 .IP " 1." 4
1048 Base64 decoded
1049 .RS 4
1050 \%https://www.rfc-editor.org/rfc/rfc4648.html
1051 .RE
1052 .IP " 2." 4
1053 System and Service Credentials
1054 .RS 4
1055 \%https://systemd.io/CREDENTIALS
1056 .RE
1057 .IP " 3." 4
1058 Notes on Resolvability of User and Group Names
1059 .RS 4
1060 \%https://systemd.io/UIDS-GIDS/#notes-on-resolvability-of-user-and-group-names
1061 .RE