Debian Codegraph @

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

raw
1 '\" t
2 .TH "TMPFILES\&.D" "5" "" "systemd 261~rc3" "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 k /path\-or\-glob/to/set/caps \- \- \- \- file capabilities
95 k+ /path\-or\-glob/to/adjust/caps \- \- \- \- file capabilities
96 K /path\-or\-glob/to/set/caps/recursively \- \- \- \- file capabilities
97 K+ /path\-or\-glob/to/adjust/caps/recursively \- \- \- \- file capabilities
98
99 .fi
100 .SH "DESCRIPTION"
101 .PP
102 tmpfiles\&.d
103 configuration files provide a generic mechanism to define the
104 \fIcreation\fR
105 of regular files, directories, pipes, and device nodes, adjustments to their
106 \fIaccess mode, ownership, attributes, quota assignments, and contents\fR, and finally their time\-based
107 \fIremoval\fR\&. It is mostly commonly used for volatile and temporary files and directories (such as those located under
108 /run/,
109 /tmp/,
110 /var/tmp/, the API file systems such as
111 /sys/
112 or
113 /proc/, as well as some other directories below
114 /var/)\&.
115 .PP
116 \fBsystemd-tmpfiles\fR(8)
117 uses this configuration to create volatile files and directories during boot and to do periodic cleanup afterwards\&. See
118 \fBsystemd-tmpfiles\fR(8)
119 for the description of
120 systemd\-tmpfiles\-setup\&.service,
121 systemd\-tmpfiles\-clean\&.service, and associated units\&.
122 .PP
123 System daemons frequently require private runtime directories below
124 /run/
125 to store communication sockets and similar\&. For these, it is better to use
126 \fIRuntimeDirectory=\fR
127 in their unit files (see
128 \fBsystemd.exec\fR(5)
129 for details), if the flexibility provided by
130 tmpfiles\&.d
131 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,
132 \fIStateDirectory=\fR,
133 \fICacheDirectory=\fR,
134 \fILogsDirectory=\fR, and
135 \fIConfigurationDirectory=\fR
136 should be used to create directories under
137 /var/lib/,
138 /var/cache/,
139 /var/log/, and
140 /etc/\&.
141 tmpfiles\&.d
142 should be used for files whose lifetime is independent of any service or requires more complicated configuration\&.
143 .SH "CONFIGURATION DIRECTORIES AND PRECEDENCE"
144 .PP
145 Each configuration file shall be named in the style of
146 \fIpackage\fR\&.conf
147 or
148 \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\&.
149 .PP
150 Files in
151 /etc/tmpfiles\&.d
152 override files with the same name in
153 /usr/lib/tmpfiles\&.d
154 and
155 /run/tmpfiles\&.d\&. Files in
156 /run/tmpfiles\&.d
157 override files with the same name in
158 /usr/lib/tmpfiles\&.d\&. Packages should install their configuration files in
159 /usr/lib/tmpfiles\&.d\&. Files in
160 /etc/tmpfiles\&.d
161 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
162 "!"
163 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\&.
164 .PP
165 If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to
166 /dev/null
167 in
168 /etc/tmpfiles\&.d/
169 bearing the same filename\&.
170 .SH "CONFIGURATION FILE FORMAT"
171 .PP
172 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:
173 .sp
174 .if n \{\
175 .RS 4
176 .\}
177 .nf
178 #Type Path Mode User Group Age Argument\&...
179 d /run/user 0755 root root 10d \-
180 L /tmp/foobar \- \- \- \- /dev/null
181 .fi
182 .if n \{\
183 .RE
184 .\}
185 .PP
186 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\&.
187 "\ex20")\&.
188 .SS "Type"
189 .PP
190 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 ("^")\&.
191 .PP
192 The following line types are understood:
193 .PP
194 \fIf\fR, \fIf+\fR
195 .RS 4
196 \fIf\fR
197 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\&.
198 \fIf+\fR
199 will create or truncate the file\&. If the argument parameter is given, it will be written to the file\&. Does not follow symlinks\&.
200 .RE
201 .PP
202 \fIw\fR, \fIw+\fR
203 .RS 4
204 Write the argument parameter to a file, if the file exists\&. If suffixed with
205 \fI+\fR, the line will be appended to the file\&. If your configuration writes multiple lines to the same file, use
206 \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\&.
207 .RE
208 .PP
209 \fId\fR
210 .RS 4
211 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\&.
212 .RE
213 .PP
214 \fID\fR
215 .RS 4
216 Similar to
217 \fId\fR, but in addition the contents of the directory will be removed when
218 \fB\-\-remove\fR
219 is used\&.
220 .RE
221 .PP
222 \fIe\fR
223 .RS 4
224 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
225 "0", contents will be unconditionally deleted every time
226 \fBsystemd-tmpfiles\fR(8)
227 \fB\-\-clean\fR
228 is run\&.
229 .sp
230 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
231 \fI!\fR, see the examples\&.
232 .sp
233 Added in version 230\&.
234 .RE
235 .PP
236 \fIv\fR
237 .RS 4
238 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
239 /
240 is itself a subvolume)\&. Otherwise, create a normal directory, in the same way as
241 \fId\fR\&.
242 .sp
243 A subvolume created with this line type is not assigned to any higher\-level quota group\&. For that, use
244 \fIq\fR
245 or
246 \fIQ\fR, which allow creating simple quota group hierarchies, see below\&.
247 .sp
248 Added in version 219\&.
249 .RE
250 .PP
251 \fIq\fR
252 .RS 4
253 Create a subvolume or directory the same as
254 \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
255 \fId\fR\&.
256 .sp
257 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
258 \fIQ\fR
259 below\&. See
260 \fBbtrfs-qgroup\fR(8)
261 for details about the btrfs quota group concept\&.
262 .sp
263 Added in version 228\&.
264 .RE
265 .PP
266 \fIQ\fR
267 .RS 4
268 Create the subvolume or directory the same as
269 \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
270 \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\&.
271 .sp
272 Effectively, this has a similar effect as
273 \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
274 \fIq\fR
275 and
276 \fIQ\fR, a concept of "subtree quotas" is implemented\&. Each subvolume for which
277 \fIQ\fR
278 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
279 \fIq\fR
280 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\&.
281 .sp
282 It is recommended to use
283 \fIQ\fR
284 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
285 \fIQ\fR
286 are typically
287 /home/
288 or
289 /var/lib/machines/\&. In contrast,
290 \fIq\fR
291 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
292 \fIq\fR
293 are typically
294 /var/
295 or
296 /var/tmp/\&.
297 .sp
298 As with
299 \fIq\fR,
300 \fIQ\fR
301 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\&.
302 .sp
303 Added in version 228\&.
304 .RE
305 .PP
306 \fIp\fR, \fIp+\fR
307 .RS 4
308 Create a named pipe (FIFO) if it does not exist yet\&. If suffixed with
309 \fI+\fR
310 and a file already exists where the pipe is to be created, it will be removed and be replaced by the pipe\&.
311 .RE
312 .PP
313 \fIL\fR, \fIL+\fR, \fIL?\fR
314 .RS 4
315 Create a symlink if it does not exist yet\&. If suffixed with
316 \fI+\fR
317 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
318 \fI?\fR
319 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
320 /usr/share/factory/
321 are created\&. Note that permissions on symlinks are ignored\&.
322 .RE
323 .PP
324 \fIc\fR, \fIc+\fR
325 .RS 4
326 Create a character device node if it does not exist yet\&. If suffixed with
327 \fI+\fR
328 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\&.
329 .RE
330 .PP
331 \fIb\fR, \fIb+\fR
332 .RS 4
333 Create a block device node if it does not exist yet\&. If suffixed with
334 \fI+\fR
335 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\&.
336 .RE
337 .PP
338 \fIC\fR, \fIC+\fR
339 .RS 4
340 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
341 \fI+\fR\&. Instead, the entire copy operation is skipped\&. If the argument is omitted, files from the source directory
342 /usr/share/factory/
343 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\&.
344 .sp
345 Added in version 214\&.
346 .RE
347 .PP
348 \fIx\fR
349 .RS 4
350 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\&.
351 .RE
352 .PP
353 \fIX\fR
354 .RS 4
355 Ignore a path during cleaning\&. Use this type to exclude paths from clean\-up as controlled with the Age parameter\&. Unlike
356 \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\&.
357 .sp
358 Added in version 198\&.
359 .RE
360 .PP
361 \fIr\fR
362 .RS 4
363 Remove a file or directory if it exists\&. This may not be used to remove non\-empty directories, use
364 \fIR\fR
365 for that\&. Lines of this type accept shell\-style globs in place of normal path names\&. Does not follow symlinks\&.
366 .RE
367 .PP
368 \fIR\fR
369 .RS 4
370 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\&.
371 .RE
372 .PP
373 \fIz\fR
374 .RS 4
375 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\&.
376 .RE
377 .PP
378 \fIZ\fR
379 .RS 4
380 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\&.
381 .RE
382 .PP
383 \fIt\fR
384 .RS 4
385 Set extended attributes, see
386 \fBattr\fR(5)
387 for details\&. The argument field should take one or more assignment expressions in the form
388 \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\&.
389 .sp
390 Please note that extended attributes settable with this line type are a different concept from the Linux file attributes settable with
391 \fIh\fR/\fIH\fR, see below\&.
392 .sp
393 Added in version 218\&.
394 .RE
395 .PP
396 \fIT\fR
397 .RS 4
398 Same as
399 \fIt\fR, but operates recursively\&.
400 .sp
401 Added in version 219\&.
402 .RE
403 .PP
404 \fIh\fR
405 .RS 4
406 Set Linux file/directory attributes\&. Lines of this type accept shell\-style globs in place of normal path names\&.
407 .sp
408 The format of the argument field is
409 \fI[+\-=][aAcCdDeijPsStTu]\fR\&. The prefix
410 \fI+\fR
411 (the default one) causes the attributes to be added;
412 \fI\-\fR
413 causes the attributes to be removed;
414 \fI=\fR
415 causes the attributes to be set exactly as the following letters\&. The letters
416 "aAcCdDeijPsStTu"
417 select the new attributes for the files, see
418 \fBchattr\fR(1)
419 for further information\&.
420 .sp
421 Passing only
422 \fI=\fR
423 as argument resets all the file attributes listed above\&. It has to be pointed out that the
424 \fI=\fR
425 prefix limits itself to the attributes corresponding to the letters listed here\&. All other attributes will be left untouched\&. Does not follow symlinks\&.
426 .sp
427 Please note that the Linux file attributes settable with this line type are a different concept from the extended attributes settable with
428 \fIt\fR/\fIT\fR, see above\&.
429 .RE
430 .PP
431 \fIH\fR
432 .RS 4
433 Sames as
434 \fIh\fR, but operates recursively\&.
435 .sp
436 Added in version 220\&.
437 .RE
438 .PP
439 \fIa\fR, \fIa+\fR
440 .RS 4
441 Set POSIX ACLs (access control lists), see
442 \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
443 \fBsetfacl\fR(1)\&. If suffixed with
444 \fI+\fR, the specified entries will be added to the existing set\&.
445 \fBsystemd-tmpfiles\fR(8)
446 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\&.
447 .sp
448 Added in version 219\&.
449 .RE
450 .PP
451 \fIA\fR, \fIA+\fR
452 .RS 4
453 Same as
454 \fIa\fR
455 and
456 \fIa+\fR, but recursive\&. Does not follow symlinks\&.
457 .sp
458 Added in version 219\&.
459 .RE
460 .PP
461 \fIk\fR, \fIk+\fR
462 .RS 4
463 Set file capabilities, see
464 \fBcapabilities\fR(7)\&. Lines of this type accept shell\-style globs in place of normal path names\&. Does not follow symlinks\&.
465 .sp
466 The syntax follows
467 \fBcap_text_formats\fR(7)\&. It also supports
468 "rootuid=\fIINT\fR"
469 for the user namespace root user ID\&.
470 .sp
471 If suffixed with
472 \fI+\fR, current capabilities on the file that are not touched by the expression will be kept\&. For example, if all
473 "cap_setuid"
474 capabilities need to be removed but others should be kept, one can use
475 \fIk+\fR
476 with
477 "cap_setuid="
478 or
479 "cap_setuid\-eip"\&.
480 .sp
481 Added in version 261\&.
482 .RE
483 .PP
484 \fIK\fR, \fIK+\fR
485 .RS 4
486 Same as
487 \fIk\fR
488 and
489 \fIk+\fR, but recursive\&. Does not follow symlinks\&.
490 .sp
491 Added in version 261\&.
492 .RE
493 .SS "Type Modifiers"
494 .PP
495 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\&.
496 \fBsystemd-tmpfiles\fR(8)
497 will take lines with an exclamation mark only into consideration, if the
498 \fB\-\-boot\fR
499 option is given\&.
500 .PP
501 For example:
502 .sp
503 .if n \{\
504 .RS 4
505 .\}
506 .nf
507 # Make sure these are created by default so that nobody else can
508 d /tmp/\&.X11\-unix 1777 root root 10d
509
510 # Unlink the X11 lock files
511 r! /tmp/\&.X[0\-9]*\-lock
512 .fi
513 .if n \{\
514 .RE
515 .\}
516 .sp
517 The second line in contrast to the first one would break a running system, and will only be executed with
518 \fB\-\-boot\fR\&.
519 .PP
520 If the minus sign ("\-") is used, this line failing to run successfully during create (and only create) will not cause the execution of
521 \fBsystemd-tmpfiles\fR(8)
522 to return an error\&.
523 .PP
524 For example:
525 .sp
526 .if n \{\
527 .RS 4
528 .\}
529 .nf
530 # Modify sysfs but do not fail if we are in a container with a read\-only /proc
531 w\- /proc/sys/vm/swappiness \- \- \- \- 10
532 .fi
533 .if n \{\
534 .RE
535 .\}
536 .PP
537 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\&.
538 .PP
539 If the tilde character ("~") is used, the argument (i\&.e\&. 6th) column is
540 \m[blue]\fBBase64 decoded\fR\m[]\&\s-2\u[1]\d\s+2
541 before use\&. This modifier is only supported on line types that can write file contents, i\&.e\&.
542 \fIf\fR,
543 \fIf+\fR,
544 \fIw\fR,
545 \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\&.
546 .PP
547 If the caret character ("^") is used, the argument (i\&.e\&. 6th) column takes a service credential name to read the argument data from\&. See
548 \m[blue]\fBSystem and Service Credentials\fR\m[]\&\s-2\u[2]\d\s+2
549 for details about the credentials concept\&. This modifier is only supported on line types that can write file contents, i\&.e\&.
550 \fIf\fR,
551 \fIf+\fR,
552 \fIw\fR,
553 \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
554 \fBsystemd\-tmpfiles\fR
555 service, the line is silently skipped\&. If
556 "^"
557 and
558 "~"
559 are combined Base64 decoding is applied to the credential contents\&.
560 .PP
561 If the dollar sign ("$") is used, the file becomes subject to removal when
562 \fBsystemd\-tmpfiles\fR
563 is invoked with the
564 \fB\-\-purge\fR
565 switch\&. Lines without this character are unaffected by that switch\&.
566 .PP
567 Note that for all line types that result in creation of any kind of file node (i\&.e\&.
568 \fIf\fR,
569 \fId\fR/\fID\fR/\fIv\fR/\fIq\fR/\fIQ\fR,
570 \fIp\fR,
571 \fIL\fR,
572 \fIc\fR/\fIb\fR
573 and
574 \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
575 \fId\fR
576 lines\&.
577 .SS "Path"
578 .PP
579 The file system path specification supports simple specifier expansion, see below\&. The path (after expansion) must be absolute\&.
580 .SS "Mode"
581 .PP
582 The file access mode to use when creating this file or directory\&. If omitted or when set to
583 "\-", the default is used: 0755 for directories, 0644 for all other file objects\&. For
584 \fIz\fR,
585 \fIZ\fR
586 lines, if omitted or when set to
587 "\-", the file access mode will not be modified\&. This parameter is ignored for
588 \fIx\fR,
589 \fIr\fR,
590 \fIR\fR,
591 \fIL\fR,
592 \fIt\fR,
593 \fIa\fR, and
594 \fIk\fR
595 lines\&.
596 .PP
597 Optionally, if prefixed with
598 "~", 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
599 \fIZ\fR\&.
600 .PP
601 By default, the access mode of listed inodes is set to the specified mode regardless of whether it is created anew, or already existed\&. Optionally, if prefixed with
602 ":", 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\&.
603 .SS "User, Group"
604 .PP
605 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
606 "\-", the user and group of the user who invokes
607 \fBsystemd-tmpfiles\fR(8)
608 is used\&. For
609 \fIz\fR
610 and
611 \fIZ\fR
612 lines, when omitted or when set to
613 "\-", the file ownership will not be modified\&. These parameters are ignored for
614 \fIx\fR,
615 \fIr\fR,
616 \fIR\fR,
617 \fIt\fR, and
618 \fIa\fR
619 lines\&.
620 .PP
621 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 resolvable 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
622 \m[blue]\fBNotes on Resolvability of User and Group Names\fR\m[]\&\s-2\u[3]\d\s+2
623 for more information on requirements on system user/group definitions\&.
624 .PP
625 By default, the ownership of listed inodes is set to the specified user/group regardless of whether it is created anew, or already existed\&. Optionally, if prefixed with
626 ":", 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\&.
627 .SS "Age"
628 .PP
629 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:
630 \fBs\fR,
631 \fBm\fR
632 or
633 \fBmin\fR,
634 \fBh\fR,
635 \fBd\fR,
636 \fBw\fR,
637 \fBms\fR, and
638 \fBus\fR, meaning seconds, minutes, hours, days, weeks, milliseconds, and microseconds, respectively\&. Full names of the time units can be used too\&.
639 .PP
640 If multiple integers and units are specified, the time values are summed\&. If an integer is given without a unit,
641 \fBs\fR
642 is assumed\&.
643 .PP
644 When the age is set to zero, the files are cleaned unconditionally\&.
645 .PP
646 The age field only applies to lines starting with
647 \fId\fR,
648 \fID\fR,
649 \fIe\fR,
650 \fIv\fR,
651 \fIq\fR,
652 \fIQ\fR,
653 \fIC\fR,
654 \fIx\fR
655 and
656 \fIX\fR\&. If omitted or set to
657 "\-", no automatic clean\-up is done\&.
658 .PP
659 If the age field starts with a tilde character
660 "~", clean\-up is only applied to files and directories one level inside the directory specified, but not the files and directories immediately inside it\&.
661 .PP
662 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\&.
663 .PP
664 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 (":"):
665 "\fIage\-by\fR\&.\&.\&.:\fIcleanup\-age\fR"\&. The argument can consist of
666 \fBa\fR
667 (\fBA\fR
668 for directories),
669 \fBb\fR
670 (\fBB\fR
671 for directories),
672 \fBc\fR
673 (\fBC\fR
674 for directories), or
675 \fBm\fR
676 (\fBM\fR
677 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
678 \fBstatx\fR(2)
679 file timestamp fields for more details about timestamp types\&.
680 .PP
681 If not specified, the age\-by field defaults to
682 \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\&.
683 .PP
684 For example:
685 .sp
686 .if n \{\
687 .RS 4
688 .\}
689 .nf
690 # Files created and modified, and directories accessed more than
691 # an hour ago in "/tmp/foo/bar", are subject to time\-based cleanup\&.
692 d /tmp/foo/bar \- \- \- bmA:1h \-
693 .fi
694 .if n \{\
695 .RE
696 .\}
697 .PP
698 Note that while the aging algorithm is run an exclusive BSD file lock (see
699 \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\&.
700 .PP
701 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
702 \fBsystemd\-tmpfiles\fR
703 with an age of
704 "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
705 \fBsystemd\-tmpfiles\fR\&.
706 .SS "Argument"
707 .PP
708 For
709 \fIL\fR
710 lines determines the destination path of the symlink\&. For
711 \fIc\fR
712 and
713 \fIb\fR, determines the major/minor of the device node, with major and minor formatted as integers, separated by
714 ":", e\&.g\&.
715 "1:3"\&. For
716 \fIf\fR
717 and
718 \fIw\fR, the argument may be used to specify a short string that is written to the file, suffixed by a newline\&. For
719 \fIC\fR, specifies the source file or directory\&. For
720 \fIt\fR
721 and
722 \fIT\fR, determines extended attributes to be set\&. For
723 \fIa\fR
724 and
725 \fIA\fR, determines ACL attributes to be set\&. For
726 \fIh\fR
727 and
728 \fIH\fR, determines the file attributes to set\&. For
729 \fIk\fR
730 and
731 \fIK\fR, determines file capabilities to be set\&. Ignored for all other lines\&.
732 .PP
733 This field can contain specifiers, see below\&.
734 .SH "SPECIFIERS"
735 .PP
736 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:
737 .sp
738 .it 1 an-trap
739 .nr an-no-space-flag 1
740 .nr an-break-flag 1
741 .br
742 .B Table\ \&1.\ \&Specifiers available
743 .TS
744 allbox tab(:);
745 lB lB lB.
746 T{
747 Specifier
748 T}:T{
749 Meaning
750 T}:T{
751 Details
752 T}
753 .T&
754 l l l
755 l l l
756 l l l
757 l l l
758 l l l
759 l l l
760 l l l
761 l l l
762 l l l
763 l l l
764 l l l
765 l l l
766 l l l
767 l l l
768 l l l
769 l l l
770 l l l
771 l l l
772 l l l
773 l l l
774 l l l
775 l l l
776 l l l
777 l l l
778 l l l.
779 T{
780 "%a"
781 T}:T{
782 Architecture
783 T}:T{
784 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\&.
785 T}
786 T{
787 "%A"
788 T}:T{
789 Operating system image version
790 T}:T{
791 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\&.
792 T}
793 T{
794 "%b"
795 T}:T{
796 Boot ID
797 T}:T{
798 The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
799 T}
800 T{
801 "%B"
802 T}:T{
803 Operating system build ID
804 T}:T{
805 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\&.
806 T}
807 T{
808 "%C"
809 T}:T{
810 System or user cache directory
811 T}:T{
812 In \fB\-\-user\fR mode, this is the same as \fI$XDG_CACHE_HOME\fR, and /var/cache otherwise\&.
813 T}
814 T{
815 "%g"
816 T}:T{
817 User group
818 T}:T{
819 This is the name of the group running the command\&. In case of the system instance this resolves to "root"\&.
820 T}
821 T{
822 "%G"
823 T}:T{
824 User GID
825 T}:T{
826 This is the numeric GID of the group running the command\&. In case of the system instance this resolves to \fB0\fR\&.
827 T}
828 T{
829 "%h"
830 T}:T{
831 User home directory
832 T}:T{
833 This is the home directory of the user running the command\&. In case of the system instance this resolves to "/root"\&.
834 T}
835 T{
836 "%H"
837 T}:T{
838 Host name
839 T}:T{
840 The hostname of the running system\&.
841 T}
842 T{
843 "%l"
844 T}:T{
845 Short host name
846 T}:T{
847 The hostname of the running system, truncated at the first dot to remove any domain component\&.
848 T}
849 T{
850 "%L"
851 T}:T{
852 System or user log directory
853 T}:T{
854 In \fB\-\-user\fR mode, this is the same as \fI$XDG_STATE_HOME\fR with /log appended, and /var/log otherwise\&.
855 T}
856 T{
857 "%m"
858 T}:T{
859 Machine ID
860 T}:T{
861 The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
862 T}
863 T{
864 "%M"
865 T}:T{
866 Operating system image identifier
867 T}:T{
868 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\&.
869 T}
870 T{
871 "%o"
872 T}:T{
873 Operating system ID
874 T}:T{
875 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\&.
876 T}
877 T{
878 "%q"
879 T}:T{
880 Pretty host name
881 T}:T{
882 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\&.
883 T}
884 T{
885 "%S"
886 T}:T{
887 System or user state directory
888 T}:T{
889 In \fB\-\-user\fR mode, this is the same as \fI$XDG_STATE_HOME\fR, and /var/lib otherwise\&.
890 T}
891 T{
892 "%t"
893 T}:T{
894 System or user runtime directory
895 T}:T{
896 In \fB\-\-user\fR mode, this is the same as \fI$XDG_RUNTIME_DIR\fR, and /run/ otherwise\&.
897 T}
898 T{
899 "%T"
900 T}:T{
901 Directory for temporary files
902 T}:T{
903 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\&.)
904 T}
905 T{
906 "%u"
907 T}:T{
908 User name
909 T}:T{
910 This is the name of the user running the command\&. In case of the system instance this resolves to "root"\&.
911 T}
912 T{
913 "%U"
914 T}:T{
915 User UID
916 T}:T{
917 This is the numeric UID of the user running the command\&. In case of the system instance this resolves to \fB0\fR\&.
918 T}
919 T{
920 "%v"
921 T}:T{
922 Kernel release
923 T}:T{
924 Identical to \fBuname \-r\fR output\&.
925 T}
926 T{
927 "%V"
928 T}:T{
929 Directory for larger and persistent temporary files
930 T}:T{
931 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\&.)
932 T}
933 T{
934 "%w"
935 T}:T{
936 Operating system version ID
937 T}:T{
938 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\&.
939 T}
940 T{
941 "%W"
942 T}:T{
943 Operating system variant ID
944 T}:T{
945 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\&.
946 T}
947 T{
948 "%%"
949 T}:T{
950 Single percent sign
951 T}:T{
952 Use "%%" in place of "%" to specify a single percent sign\&.
953 T}
954 .TE
955 .sp 1
956 .SH "EXAMPLES"
957 .PP
958 \fBExample\ \&1.\ \&Create directories with specific mode and ownership\fR
959 .PP
960 \fBscreen\fR(1), needs two directories created at boot with specific modes and ownership:
961 .sp
962 .if n \{\
963 .RS 4
964 .\}
965 .nf
966 # /usr/lib/tmpfiles\&.d/screen\&.conf
967 d /run/screens 1777 root screen 10d
968 d /run/uscreens 0755 root screen 10d12h
969 .fi
970 .if n \{\
971 .RE
972 .\}
973 .PP
974 Contents of
975 /run/screens
976 and /run/uscreens will be cleaned up after 10 and 10\(12 days, respectively\&.
977 .PP
978 \fBExample\ \&2.\ \&Create a directory with a SMACK attribute\fR
979 .sp
980 .if n \{\
981 .RS 4
982 .\}
983 .nf
984 D /run/cups \- \- \- \-
985 t /run/cups \- \- \- \- security\&.SMACK64=printing user\&.attr\-with\-spaces="foo bar"
986 .fi
987 .if n \{\
988 .RE
989 .\}
990 .PP
991 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
992 \fBsystemd\-tmpfiles \-\-remove\fR
993 runs\&.
994 .PP
995 \fBExample\ \&3.\ \&Create a directory and prevent its contents from cleanup\fR
996 .PP
997 \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
998 /var/tmp:
999 .sp
1000 .if n \{\
1001 .RS 4
1002 .\}
1003 .nf
1004 # /usr/lib/tmpfiles\&.d/tmp\&.conf
1005 d /var/tmp 1777 root root 30d
1006 .fi
1007 .if n \{\
1008 .RE
1009 .\}
1010 .sp
1011 .if n \{\
1012 .RS 4
1013 .\}
1014 .nf
1015 # /usr/lib/tmpfiles\&.d/abrt\&.conf
1016 d /var/tmp/abrt 0755 abrt abrt \-
1017 .fi
1018 .if n \{\
1019 .RE
1020 .\}
1021 .PP
1022 \fBExample\ \&4.\ \&Apply clean up during boot and based on time\fR
1023 .sp
1024 .if n \{\
1025 .RS 4
1026 .\}
1027 .nf
1028 # /usr/lib/tmpfiles\&.d/dnf\&.conf
1029 r! /var/cache/dnf/*/*/download_lock\&.pid
1030 r! /var/cache/dnf/*/*/metadata_lock\&.pid
1031 r! /var/lib/dnf/rpmdb_lock\&.pid
1032 e /var/cache/dnf/ \- \- \- 30d
1033 .fi
1034 .if n \{\
1035 .RE
1036 .\}
1037 .PP
1038 The lock files will be removed during boot\&. Any files and directories in
1039 /var/cache/dnf/
1040 will be removed after they have not been accessed in 30 days\&.
1041 .PP
1042 \fBExample\ \&5.\ \&Empty the contents of a cache directory on boot\fR
1043 .sp
1044 .if n \{\
1045 .RS 4
1046 .\}
1047 .nf
1048 # /usr/lib/tmpfiles\&.d/krb5rcache\&.conf
1049 e! /var/cache/krb5rcache \- \- \- 0
1050 .fi
1051 .if n \{\
1052 .RE
1053 .\}
1054 .PP
1055 Any files and subdirectories in
1056 /var/cache/krb5rcache/
1057 will be removed on boot\&. The directory will not be created\&.
1058 .PP
1059 \fBExample\ \&6.\ \&Provision SSH public key access for root user via Credentials in QEMU\fR
1060 .sp
1061 .if n \{\
1062 .RS 4
1063 .\}
1064 .nf
1065 \-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)
1066 .fi
1067 .if n \{\
1068 .RE
1069 .\}
1070 .PP
1071 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
1072 \fBsystemd-tmpfiles\fR(8)
1073 to decode it into
1074 /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\&.
1075 .SH "/RUN/ AND /VAR/RUN/"
1076 .PP
1077 /var/run/
1078 is a deprecated symlink to
1079 /run/, and applications should use the latter\&.
1080 \fBsystemd\-tmpfiles\fR
1081 will warn if
1082 /var/run/
1083 is used\&.
1084 .SH "SEE ALSO"
1085 .PP
1086 \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)
1087 .SH "NOTES"
1088 .IP " 1." 4
1089 Base64 decoded
1090 .RS 4
1091 \%https://www.rfc-editor.org/rfc/rfc4648.html
1092 .RE
1093 .IP " 2." 4
1094 System and Service Credentials
1095 .RS 4
1096 \%https://systemd.io/CREDENTIALS
1097 .RE
1098 .IP " 3." 4
1099 Notes on Resolvability of User and Group Names
1100 .RS 4
1101 \%https://systemd.io/UIDS-GIDS/#notes-on-resolvability-of-user-and-group-names
1102 .RE