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