]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/tmpfiles.d.xml
tree-wide: drop license boilerplate
[thirdparty/systemd.git] / man / tmpfiles.d.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
3 <!--
4 SPDX-License-Identifier: LGPL-2.1+
5
6 This file is part of systemd.
7
8 Copyright 2010 Brandon Philips
9 -->
10 <refentry id="tmpfiles.d">
11
12 <refentryinfo>
13 <title>tmpfiles.d</title>
14 <productname>systemd</productname>
15
16 <authorgroup>
17 <author>
18 <contrib>Documentation</contrib>
19 <firstname>Brandon</firstname>
20 <surname>Philips</surname>
21 <email>brandon@ifup.org</email>
22 </author>
23 </authorgroup>
24 </refentryinfo>
25
26 <refmeta>
27 <refentrytitle>tmpfiles.d</refentrytitle>
28 <manvolnum>5</manvolnum>
29 </refmeta>
30
31 <refnamediv>
32 <refname>tmpfiles.d</refname>
33 <refpurpose>Configuration for creation, deletion and cleaning of
34 volatile and temporary files</refpurpose>
35 </refnamediv>
36
37 <refsynopsisdiv>
38 <para><literallayout><filename>/etc/tmpfiles.d/*.conf</filename>
39 <filename>/run/tmpfiles.d/*.conf</filename>
40 <filename>/usr/lib/tmpfiles.d/*.conf</filename>
41 </literallayout></para>
42
43 <para><literallayout><filename>~/.config/user-tmpfiles.d/*.conf</filename>
44 <filename>$XDG_RUNTIME_DIR/user-tmpfiles.d/*.conf</filename>
45 <filename>~/.local/share/user-tmpfiles.d/*.conf</filename>
46 <filename></filename>
47 <filename>/usr/share/user-tmpfiles.d/*.conf</filename>
48 </literallayout></para>
49 </refsynopsisdiv>
50
51 <refsect1>
52 <title>Description</title>
53
54 <para><command>systemd-tmpfiles</command> uses the configuration
55 files from the above directories to describe the creation,
56 cleaning and removal of volatile and temporary files and
57 directories which usually reside in directories such as
58 <filename>/run</filename> or <filename>/tmp</filename>.</para>
59
60 <para>Volatile and temporary files and directories are those
61 located in <filename>/run</filename> (and its alias
62 <filename>/var/run</filename>), <filename>/tmp</filename>,
63 <filename>/var/tmp</filename>, the API file systems such as
64 <filename>/sys</filename> or <filename>/proc</filename>, as well
65 as some other directories below <filename>/var</filename>.</para>
66
67 <para>System daemons frequently require private runtime
68 directories below <filename>/run</filename> to place communication
69 sockets and similar in. For these, consider declaring them in
70 their unit files using <varname>RuntimeDirectory=</varname> (see
71 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>
72 for details), if this is feasible.</para>
73 </refsect1>
74
75 <refsect1>
76 <title>Configuration Directories and Precedence</title>
77
78 <para>Each configuration file shall be named in the style of
79 <filename><replaceable>package</replaceable>.conf</filename> or
80 <filename><replaceable>package</replaceable>-<replaceable>part</replaceable>.conf</filename>.
81 The second variant should be used when it is desirable to make it
82 easy to override just this part of configuration.</para>
83
84 <para>Files in <filename>/etc/tmpfiles.d</filename> override files
85 with the same name in <filename>/usr/lib/tmpfiles.d</filename> and
86 <filename>/run/tmpfiles.d</filename>. Files in
87 <filename>/run/tmpfiles.d</filename> override files with the same
88 name in <filename>/usr/lib/tmpfiles.d</filename>. Packages should
89 install their configuration files in
90 <filename>/usr/lib/tmpfiles.d</filename>. Files in
91 <filename>/etc/tmpfiles.d</filename> are reserved for the local
92 administrator, who may use this logic to override the
93 configuration files installed by vendor packages. All
94 configuration files are sorted by their filename in lexicographic
95 order, regardless of which of the directories they reside in. If
96 multiple files specify the same path, the entry in the file with
97 the lexicographically earliest name will be applied. All other
98 conflicting entries will be logged as errors. When two lines are
99 prefix and suffix of each other, then the prefix is always
100 processed first, the suffix later. Lines that take globs are
101 applied after those accepting no globs. If multiple operations
102 shall be applied on the same file, (such as ACL, xattr, file
103 attribute adjustments), these are always done in the same fixed
104 order. Otherwise, the files/directories are processed in the order
105 they are listed.</para>
106
107 <para>If the administrator wants to disable a configuration file
108 supplied by the vendor, the recommended way is to place a symlink
109 to <filename>/dev/null</filename> in
110 <filename>/etc/tmpfiles.d/</filename> bearing the same filename.
111 </para>
112 </refsect1>
113
114 <refsect1>
115 <title>Configuration File Format</title>
116
117 <para>The configuration format is one line per path containing
118 type, path, mode, ownership, age, and argument fields:</para>
119
120 <programlisting>#Type Path Mode UID GID Age Argument
121 d /run/user 0755 root root 10d -
122 L /tmp/foobar - - - - /dev/null</programlisting>
123
124 <para>Fields may be enclosed within quotes and contain C-style escapes.</para>
125
126 <refsect2>
127 <title>Type</title>
128
129 <para>The type consists of a single letter and optionally an
130 exclamation mark.</para>
131
132 <para>The following line types are understood:</para>
133
134 <variablelist>
135 <varlistentry>
136 <term><varname>f</varname></term>
137 <listitem><para>Create a file if it does not exist yet. If the argument parameter is given and the file did
138 not exist yet, it will be written to the file. Does not follow symlinks.</para></listitem>
139 </varlistentry>
140
141 <varlistentry>
142 <term><varname>F</varname></term>
143 <listitem><para>Create or truncate a file. If the argument
144 parameter is given, it will be written to the file. Does not follow symlinks.</para>
145 </listitem>
146 </varlistentry>
147
148 <varlistentry>
149 <term><varname>w</varname></term>
150 <listitem><para>Write the argument parameter to a file, if
151 the file exists. Lines of this type accept shell-style
152 globs in place of normal path names. The argument parameter
153 will be written without a trailing newline. C-style
154 backslash escapes are interpreted. Follows
155 symlinks.</para></listitem>
156 </varlistentry>
157
158 <varlistentry>
159 <term><varname>d</varname></term>
160 <listitem><para>Create a directory. The mode and ownership will be adjusted if
161 specified and the directory already exists. Contents of this directory are subject
162 to time based cleanup if the age argument is specified.</para></listitem>
163 </varlistentry>
164
165 <varlistentry>
166 <term><varname>D</varname></term>
167 <listitem><para>Similar to <varname>d</varname>, but in addition the contents
168 of the directory will be removed when <option>--remove</option> is used.
169 </para></listitem>
170 </varlistentry>
171
172 <varlistentry>
173 <term><varname>e</varname></term>
174 <listitem><para>Similar to <varname>d</varname>, but the directory will not be created if
175 it does not exist. Lines of this type accept shell-style globs in place of normal path
176 names. For this entry to be useful, at least one of the mode, uid, gid, or age arguments
177 must be specified, since otherwise this entry has no effect. If the age argument is
178 <literal>0</literal>, contents of the directory will be unconditionally deleted every time
179 <command>systemd-tmpfiles --clean</command> is run. This can be useful when combined with
180 <varname>!</varname>, see the examples.</para></listitem>
181 </varlistentry>
182
183 <varlistentry>
184 <term><varname>v</varname></term>
185 <listitem><para>Create a subvolume if the path does not
186 exist yet, the file system supports subvolumes (btrfs), and
187 the system itself is installed into a subvolume
188 (specifically: the root directory <filename>/</filename> is
189 itself a subvolume). Otherwise, create a normal directory, in
190 the same way as <varname>d</varname>. A subvolume created
191 with this line type is not assigned to any higher-level
192 quota group. For that, use <varname>q</varname> or
193 <varname>Q</varname>, which allow creating simple quota
194 group hierarchies, see below.</para></listitem>
195 </varlistentry>
196
197 <varlistentry>
198 <term><varname>q</varname></term>
199 <listitem><para>Similar to <varname>v</varname>. However,
200 makes sure that the subvolume will be assigned to the same
201 higher-level quota groups as the subvolume it has been
202 created in. This ensures that higher-level limits and
203 accounting applied to the parent subvolume also include the
204 specified subvolume. On non-btrfs file systems, this line
205 type is identical to <varname>d</varname>. If the subvolume
206 already exists and is already assigned to one or more higher
207 level quota groups, no change to the quota hierarchy is
208 made. Also see <varname>Q</varname> below. See <citerefentry
209 project='die-net'><refentrytitle>btrfs-qgroup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
210 for details about the btrfs quota group
211 concept.</para></listitem>
212 </varlistentry>
213
214 <varlistentry>
215 <term><varname>Q</varname></term>
216 <listitem><para>Similar to <varname>q</varname>. However,
217 instead of copying the higher-level quota group assignments
218 from the parent as-is, the lowest quota group of the parent
219 subvolume is determined that is not the leaf quota
220 group. Then, an "intermediary" quota group is inserted that
221 is one level below this level, and shares the same ID part
222 as the specified subvolume. If no higher-level quota group
223 exists for the parent subvolume, a new quota group at level
224 255 sharing the same ID as the specified subvolume is
225 inserted instead. This new intermediary quota group is then
226 assigned to the parent subvolume's higher-level quota
227 groups, and the specified subvolume's leaf quota group is
228 assigned to it.</para>
229
230 <para>Effectively, this has a similar effect as
231 <varname>q</varname>, however introduces a new higher-level
232 quota group for the specified subvolume that may be used to
233 enforce limits and accounting to the specified subvolume and
234 children subvolume created within it. Thus, by creating
235 subvolumes only via <varname>q</varname> and
236 <varname>Q</varname>, a concept of "subtree quotas" is
237 implemented. Each subvolume for which <varname>Q</varname>
238 is set will get a "subtree" quota group created, and all
239 child subvolumes created within it will be assigned to
240 it. Each subvolume for which <varname>q</varname> is set
241 will not get such a "subtree" quota group, but it is ensured
242 that they are added to the same "subtree" quota group as their
243 immediate parents.</para>
244
245 <para>It is recommended to use
246 <varname>Q</varname> for subvolumes that typically contain
247 further subvolumes, and where it is desirable to have
248 accounting and quota limits on all child subvolumes
249 together. Examples for <varname>Q</varname> are typically
250 <filename>/home</filename> or
251 <filename>/var/lib/machines</filename>. In contrast,
252 <varname>q</varname> should be used for subvolumes that
253 either usually do not include further subvolumes or where no
254 accounting and quota limits are needed that apply to all
255 child subvolumes together. Examples for <varname>q</varname>
256 are typically <filename>/var</filename> or
257 <filename>/var/tmp</filename>. As with <varname>Q</varname>,
258 <varname>q</varname> has no effect on the quota group
259 hierarchy if the subvolume exists and already has at least
260 one higher-level quota group assigned.</para></listitem>
261 </varlistentry>
262
263 <varlistentry>
264 <term><varname>p</varname></term>
265 <term><varname>p+</varname></term>
266 <listitem><para>Create a named pipe (FIFO) if it does not
267 exist yet. If suffixed with <varname>+</varname> and a file
268 already exists where the pipe is to be created, it will be
269 removed and be replaced by the pipe.</para></listitem>
270 </varlistentry>
271
272 <varlistentry>
273 <term><varname>L</varname></term>
274 <term><varname>L+</varname></term>
275 <listitem><para>Create a symlink if it does not exist
276 yet. If suffixed with <varname>+</varname> and a file or
277 directory already exists where the symlink is to be created,
278 it will be removed and be replaced by the symlink. If the
279 argument is omitted, symlinks to files with the same name
280 residing in the directory
281 <filename>/usr/share/factory/</filename> are created. Note
282 that permissions and ownership on symlinks are ignored.
283 </para></listitem>
284 </varlistentry>
285
286 <varlistentry>
287 <term><varname>c</varname></term>
288 <term><varname>c+</varname></term>
289 <listitem><para>Create a character device node if it does
290 not exist yet. If suffixed with <varname>+</varname> and a
291 file already exists where the device node is to be created,
292 it will be removed and be replaced by the device node. It is
293 recommended to suffix this entry with an exclamation mark to
294 only create static device nodes at boot, as udev will not
295 manage static device nodes that are created at runtime.
296 </para></listitem>
297 </varlistentry>
298
299 <varlistentry>
300 <term><varname>b</varname></term>
301 <term><varname>b+</varname></term>
302 <listitem><para>Create a block device node if it does not
303 exist yet. If suffixed with <varname>+</varname> and a file
304 already exists where the device node is to be created, it
305 will be removed and be replaced by the device node. It is
306 recommended to suffix this entry with an exclamation mark to
307 only create static device nodes at boot, as udev will not
308 manage static device nodes that are created at runtime.
309 </para></listitem>
310 </varlistentry>
311
312 <varlistentry>
313 <term><varname>C</varname></term>
314 <listitem><para>Recursively copy a file or directory, if the
315 destination files or directories do not exist yet. Note that
316 this command will not descend into subdirectories if the
317 destination directory already exists. Instead, the entire
318 copy operation is skipped. If the argument is omitted, files
319 from the source directory
320 <filename>/usr/share/factory/</filename> with the same name
321 are copied. Does not follow symlinks.</para></listitem>
322 </varlistentry>
323
324 <varlistentry>
325 <term><varname>x</varname></term>
326 <listitem><para>Ignore a path during cleaning. Use this type
327 to exclude paths from clean-up as controlled with the Age
328 parameter. Note that lines of this type do not influence the
329 effect of <varname>r</varname> or <varname>R</varname>
330 lines. Lines of this type accept shell-style globs in place
331 of normal path names. </para></listitem>
332 </varlistentry>
333
334 <varlistentry>
335 <term><varname>X</varname></term>
336 <listitem><para>Ignore a path during cleaning. Use this type
337 to exclude paths from clean-up as controlled with the Age
338 parameter. Unlike <varname>x</varname>, this parameter will
339 not exclude the content if path is a directory, but only
340 directory itself. Note that lines of this type do not
341 influence the effect of <varname>r</varname> or
342 <varname>R</varname> lines. Lines of this type accept
343 shell-style globs in place of normal path names.
344 </para></listitem>
345 </varlistentry>
346
347 <varlistentry>
348 <term><varname>r</varname></term>
349 <listitem><para>Remove a file or directory if it exists.
350 This may not be used to remove non-empty directories, use
351 <varname>R</varname> for that. Lines of this type accept
352 shell-style globs in place of normal path
353 names. Does not follow symlinks.</para></listitem>
354 </varlistentry>
355
356 <varlistentry>
357 <term><varname>R</varname></term>
358 <listitem><para>Recursively remove a path and all its
359 subdirectories (if it is a directory). Lines of this type
360 accept shell-style globs in place of normal path
361 names. Does not follow symlinks.</para></listitem>
362 </varlistentry>
363
364 <varlistentry>
365 <term><varname>z</varname></term>
366 <listitem><para>Adjust the access mode, group and user, and
367 restore the SELinux security context of a file or directory,
368 if it exists. Lines of this type accept shell-style globs in
369 place of normal path names. Does not follow symlinks.</para></listitem>
370 </varlistentry>
371
372 <varlistentry>
373 <term><varname>Z</varname></term>
374 <listitem><para>Recursively set the access mode, group and
375 user, and restore the SELinux security context of a file or
376 directory if it exists, as well as of its subdirectories and
377 the files contained therein (if applicable). Lines of this
378 type accept shell-style globs in place of normal path
379 names. Does not follow symlinks. </para></listitem>
380 </varlistentry>
381
382 <varlistentry>
383 <term><varname>t</varname></term>
384 <listitem><para>Set extended attributes. Lines of this type
385 accept shell-style globs in place of normal path names.
386 This can be useful for setting SMACK labels. Does not follow
387 symlinks.</para></listitem>
388 </varlistentry>
389
390 <varlistentry>
391 <term><varname>T</varname></term>
392 <listitem><para>Recursively set extended attributes. Lines
393 of this type accept shell-style globs in place of normal
394 path names. This can be useful for setting SMACK
395 labels. Does not follow symlinks. </para></listitem>
396 </varlistentry>
397
398 <varlistentry>
399 <term><varname>h</varname></term>
400 <listitem><para>Set file/directory attributes. Lines of this type
401 accept shell-style globs in place of normal path names.</para>
402
403 <para>The format of the argument field is
404 <varname>[+-=][aAcCdDeijsStTu] </varname>. The prefix
405 <varname>+</varname> (the default one) causes the
406 attribute(s) to be added; <varname>-</varname> causes the
407 attribute(s) to be removed; <varname>=</varname> causes the
408 attributes to be set exactly as the following letters. The
409 letters <literal>aAcCdDeijsStTu</literal> select the new
410 attributes for the files, see
411 <citerefentry project='man-pages'><refentrytitle>chattr</refentrytitle>
412 <manvolnum>1</manvolnum></citerefentry> for further information.
413 </para>
414 <para>Passing only <varname>=</varname> as argument resets
415 all the file attributes listed above. It has to be pointed
416 out that the <varname>=</varname> prefix limits itself to
417 the attributes corresponding to the letters listed here. All
418 other attributes will be left untouched. Does not follow
419 symlinks.</para>
420 </listitem>
421 </varlistentry>
422
423 <varlistentry>
424 <term><varname>H</varname></term>
425 <listitem><para>Recursively set file/directory attributes. Lines
426 of this type accept shell-style globs in place of normal
427 path names. Does not follow symlinks.
428 </para></listitem>
429 </varlistentry>
430
431 <varlistentry>
432 <term><varname>a</varname></term>
433 <term><varname>a+</varname></term>
434 <listitem><para>Set POSIX ACLs (access control lists). If
435 suffixed with <varname>+</varname>, the specified entries will
436 be added to the existing set.
437 <command>systemd-tmpfiles</command> will automatically add
438 the required base entries for user and group based on the
439 access mode of the file, unless base entries already exist
440 or are explicitly specified. The mask will be added if not
441 specified explicitly or already present. Lines of this type
442 accept shell-style globs in place of normal path names. This
443 can be useful for allowing additional access to certain
444 files. Does not follow symlinks.</para></listitem>
445 </varlistentry>
446
447 <varlistentry>
448 <term><varname>A</varname></term>
449 <term><varname>A+</varname></term>
450 <listitem><para>Same as <varname>a</varname> and
451 <varname>a+</varname>, but recursive. Does not follow
452 symlinks.</para></listitem>
453 </varlistentry>
454 </variablelist>
455
456 <para>If the exclamation mark is used, this line is only safe of
457 execute during boot, and can break a running system. Lines
458 without the exclamation mark are presumed to be safe to execute
459 at any time, e.g. on package upgrades.
460 <command>systemd-tmpfiles</command> will execute line with an
461 exclamation mark only if option <option>--boot</option> is
462 given.</para>
463
464 <para>For example:
465 <programlisting># Make sure these are created by default so that nobody else can
466 d /tmp/.X11-unix 1777 root root 10d
467
468 # Unlink the X11 lock files
469 r! /tmp/.X[0-9]*-lock</programlisting>
470 The second line in contrast to the first one would break a
471 running system, and will only be executed with
472 <option>--boot</option>.</para>
473
474 <para>Note that for all line types that result in creation of any kind of file node
475 (i.e. <varname>f</varname>/<varname>F</varname>,
476 <varname>d</varname>/<varname>D</varname>/<varname>v</varname>/<varname>q</varname>/<varname>Q</varname>,
477 <varname>p</varname>, <varname>L</varname>, <varname>c</varname>/<varname>b</varname> and <varname>C</varname>)
478 leading directories are implicitly created if needed, owned by root with an access mode of 0755. In order to
479 create them with different modes or ownership make sure to add appropriate <varname>d</varname> lines.</para>
480 </refsect2>
481
482 <refsect2>
483 <title>Path</title>
484
485 <para>The file system path specification supports simple
486 specifier expansion, see below. The path (after expansion) must be
487 absolute.</para>
488 </refsect2>
489
490 <refsect2>
491 <title>Mode</title>
492
493 <para>The file access mode to use when creating this file or
494 directory. If omitted or when set to <literal>-</literal>, the
495 default is used: 0755 for directories, 0644 for all other file
496 objects. For <varname>z</varname>, <varname>Z</varname> lines,
497 if omitted or when set to <literal>-</literal>, the file access
498 mode will not be modified. This parameter is ignored for
499 <varname>x</varname>, <varname>r</varname>,
500 <varname>R</varname>, <varname>L</varname>, <varname>t</varname>,
501 and <varname>a</varname> lines.</para>
502
503 <para>Optionally, if prefixed with <literal>~</literal>, the
504 access mode is masked based on the already set access bits for
505 existing file or directories: if the existing file has all
506 executable bits unset, all executable bits are removed from the
507 new access mode, too. Similarly, if all read bits are removed
508 from the old access mode, they will be removed from the new
509 access mode too, and if all write bits are removed, they will be
510 removed from the new access mode too. In addition, the
511 sticky/SUID/SGID bit is removed unless applied to a
512 directory. This functionality is particularly useful in
513 conjunction with <varname>Z</varname>.</para>
514 </refsect2>
515
516 <refsect2>
517 <title>UID, GID</title>
518
519 <para>The user and group to use for this file or directory. This
520 may either be a numeric user/group ID or a user or group
521 name. If omitted or when set to <literal>-</literal>, the
522 default 0 (root) is used. For <varname>z</varname> and
523 <varname>Z</varname> lines, when omitted or when set to
524 <literal>-</literal>, the file ownership will not be
525 modified. These parameters are ignored for <varname>x</varname>,
526 <varname>r</varname>, <varname>R</varname>,
527 <varname>L</varname>, <varname>t</varname>, and
528 <varname>a</varname> lines.</para>
529 </refsect2>
530
531 <refsect2>
532 <title>Age</title>
533 <para>The date field, when set, is used to decide what files to
534 delete when cleaning. If a file or directory is older than the
535 current time minus the age field, it is deleted. The field
536 format is a series of integers each followed by one of the
537 following suffixes for the respective time units:
538 <constant>s</constant>,
539 <constant>m</constant> or <constant>min</constant>,
540 <constant>h</constant>,
541 <constant>d</constant>,
542 <constant>w</constant>,
543 <constant>ms</constant>, and
544 <constant>us</constant>,
545 meaning seconds, minutes, hours, days, weeks,
546 milliseconds, and microseconds, respectively. Full names of the time units can
547 be used too.
548 </para>
549
550 <para>If multiple integers and units are specified, the time
551 values are summed. If an integer is given without a unit,
552 <constant>s</constant> is assumed.
553 </para>
554
555 <para>When the age is set to zero, the files are cleaned
556 unconditionally.</para>
557
558 <para>The age field only applies to lines starting with
559 <varname>d</varname>, <varname>D</varname>, <varname>e</varname>,
560 <varname>v</varname>, <varname>q</varname>,
561 <varname>Q</varname>, <varname>C</varname>, <varname>x</varname>
562 and <varname>X</varname>. If omitted or set to
563 <literal>-</literal>, no automatic clean-up is done.</para>
564
565 <para>If the age field starts with a tilde character
566 <literal>~</literal>, the clean-up is only applied to files and
567 directories one level inside the directory specified, but not
568 the files and directories immediately inside it.</para>
569
570 <para>The age of a file system entry is determined from its last
571 modification timestamp (mtime), its last access timestamp (atime),
572 and (except for directories) its last status change timestamp
573 (ctime). Any of these three (or two) values will prevent cleanup
574 if it is more recent than the current time minus the age
575 field.</para>
576 </refsect2>
577
578 <refsect2>
579 <title>Argument</title>
580
581 <para>For <varname>L</varname> lines determines the destination path of the symlink. For <varname>c</varname> and
582 <varname>b</varname>, determines the major/minor of the device node, with major and minor formatted as integers,
583 separated by <literal>:</literal>, e.g. <literal>1:3</literal>. For <varname>f</varname>, <varname>F</varname>,
584 and <varname>w</varname>, the argument may be used to specify a short string that is written to the file,
585 suffixed by a newline. For <varname>C</varname>, specifies the source file or directory. For <varname>t</varname>
586 and <varname>T</varname>, determines extended attributes to be set. For <varname>a</varname> and
587 <varname>A</varname>, determines ACL attributes to be set. For <varname>h</varname> and <varname>H</varname>,
588 determines the file attributes to set. Ignored for all other lines.</para>
589
590 <para>This field can contain specifiers, see below.</para>
591 </refsect2>
592 </refsect1>
593
594 <refsect1>
595 <title>Specifiers</title>
596
597 <para>Specifiers can be used in the "path" and "argument" fields.
598 An unknown or unresolvable specifier is treated as invalid configuration.
599 The following expansions are understood:</para>
600 <table>
601 <title>Specifiers available</title>
602 <tgroup cols='3' align='left' colsep='1' rowsep='1'>
603 <colspec colname="spec" />
604 <colspec colname="mean" />
605 <colspec colname="detail" />
606 <thead>
607 <row>
608 <entry>Specifier</entry>
609 <entry>Meaning</entry>
610 <entry>Details</entry>
611 </row>
612 </thead>
613 <tbody>
614 <row>
615 <entry><literal>%m</literal></entry>
616 <entry>Machine ID</entry>
617 <entry>The machine ID of the running system, formatted as string. See <citerefentry><refentrytitle>machine-id</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information.</entry>
618 </row>
619 <row>
620 <entry><literal>%b</literal></entry>
621 <entry>Boot ID</entry>
622 <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry>
623 </row>
624 <row>
625 <entry><literal>%H</literal></entry>
626 <entry>Host name</entry>
627 <entry>The hostname of the running system.</entry>
628 </row>
629 <row>
630 <entry><literal>%v</literal></entry>
631 <entry>Kernel release</entry>
632 <entry>Identical to <command>uname -r</command> output.</entry>
633 </row>
634 <row>
635 <entry><literal>%U</literal></entry>
636 <entry>User UID</entry>
637 <entry>This is the numeric UID of the user running the service manager instance. In case of the system manager this resolves to <constant>0</constant>.</entry>
638 </row>
639 <row>
640 <entry><literal>%u</literal></entry>
641 <entry>User name</entry>
642 <entry>This is the name of the user running the service manager instance. In case of the system manager this resolves to <literal>root</literal>.</entry>
643 </row>
644 <row>
645 <entry><literal>%h</literal></entry>
646 <entry>User home directory</entry>
647 <entry>This is the home directory of the user running the service manager instance. In case of the system manager this resolves to <literal>/root</literal>.</entry>
648 </row>
649 <row>
650 <entry><literal>%t</literal></entry>
651 <entry>System or user runtime directory</entry>
652 <entry>In --user mode, this is the same <varname>$XDG_RUNTIME_DIR</varname>, and <filename>/run</filename> otherwise.</entry>
653 </row>
654 <row>
655 <entry><literal>%S</literal></entry>
656 <entry>System or user state directory</entry>
657 <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CONFIG_HOME</varname>, and <filename>/var/lib</filename> otherwise.</entry>
658 </row>
659 <row>
660 <entry><literal>%C</literal></entry>
661 <entry>System or user cache directory</entry>
662 <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CACHE_HOME</varname>, and <filename>/var/cache</filename> otherwise.</entry>
663 </row>
664 <row>
665 <entry><literal>%L</literal></entry>
666 <entry>System or user log directory</entry>
667 <entry>In <option>--user</option> mode, this is the same as <varname>$XDG_CONFIG_HOME</varname> with <filename noindex='true'>/log</filename> appended, and <filename>/var/log</filename> otherwise.</entry>
668 </row>
669 <row>
670 <entry><literal>%%</literal></entry>
671 <entry>Escaped <literal>%</literal></entry>
672 <entry>Single percent sign.</entry>
673 </row>
674 </tbody>
675 </tgroup>
676 </table>
677 </refsect1>
678
679 <refsect1>
680 <title>Examples</title>
681 <example>
682 <title>Create directories with specific mode and ownership</title>
683 <para>
684 <citerefentry project='die-net'><refentrytitle>screen</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
685 needs two directories created at boot with specific modes and ownership:</para>
686
687 <programlisting># /usr/lib/tmpfiles.d/screen.conf
688 d /run/screens 1777 root screen 10d
689 d /run/uscreens 0755 root screen 10d12h
690 </programlisting>
691
692 <para>Contents of <filename>/run/screens</filename> and /run/uscreens will
693 be cleaned up after 10 and 10½ days, respectively.</para>
694 </example>
695
696 <example>
697 <title>Create a directory with a SMACK attribute</title>
698 <programlisting>D /run/cups - - - -
699 t /run/cups - - - - security.SMACK64=printing user.attr-with-spaces="foo bar"
700 </programlisting>
701
702 <para>The directory will be owned by root and have default mode. Its contents are
703 not subject to time based cleanup, but will be obliterated when
704 <command>systemd-tmpfiles --remove</command> runs.</para>
705 </example>
706
707 <example>
708 <title>Create a directory and prevent its contents from cleanup</title>
709 <para>
710 <citerefentry project='die-net'><refentrytitle>abrt</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
711 needs a directory created at boot with specific mode and ownership and its content
712 should be preserved from the automatic cleanup applied to the contents of
713 <filename>/var/tmp</filename>:</para>
714
715 <programlisting># /usr/lib/tmpfiles.d/tmp.conf
716 d /var/tmp 1777 root root 30d
717 </programlisting>
718
719 <programlisting># /usr/lib/tmpfiles.d/abrt.conf
720 d /var/tmp/abrt 0755 abrt abrt -
721 </programlisting>
722 </example>
723
724 <example>
725 <title>Apply clean up during boot and based on time</title>
726
727 <programlisting># /usr/lib/tmpfiles.d/dnf.conf
728 r! /var/cache/dnf/*/*/download_lock.pid
729 r! /var/cache/dnf/*/*/metadata_lock.pid
730 r! /var/lib/dnf/rpmdb_lock.pid
731 e /var/cache/dnf/ - - - 30d
732 </programlisting>
733
734 <para>The lock files will be removed during boot. Any files and directories in
735 <filename>/var/cache/dnf/</filename> will be removed after they have not been
736 accessed in 30 days.</para>
737 </example>
738
739 <example>
740 <title>Empty the contents of a cache directory on boot</title>
741
742 <programlisting># /usr/lib/tmpfiles.d/krb5rcache.conf
743 e! /var/cache/krb5rcache - - - 0
744 </programlisting>
745
746 <para>Any files and subdirectories in <filename>/var/cache/krb5rcache/</filename>
747 will be removed on boot. The directory will not be created.
748 </para>
749 </example>
750 </refsect1>
751
752 <refsect1>
753 <title>See Also</title>
754 <para>
755 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
756 <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
757 <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
758 <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
759 <citerefentry project='man-pages'><refentrytitle>attr</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
760 <citerefentry project='man-pages'><refentrytitle>getfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
761 <citerefentry project='man-pages'><refentrytitle>setfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
762 <citerefentry project='man-pages'><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
763 <citerefentry project='man-pages'><refentrytitle>getfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
764 <citerefentry project='man-pages'><refentrytitle>chattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
765 <citerefentry project='die-net'><refentrytitle>btrfs-subvolume</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
766 <citerefentry project='die-net'><refentrytitle>btrfs-qgroup</refentrytitle><manvolnum>8</manvolnum></citerefentry>
767 </para>
768 </refsect1>
769
770 </refentry>