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