]>
Commit | Line | Data |
---|---|---|
db2df898 | 1 | <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*--> |
663996b3 MS |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> |
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 | |
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 | |
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 | |
16 | Lesser General Public License for more details. | |
17 | ||
18 | You should have received a copy of the GNU Lesser General Public License | |
19 | along with systemd; If not, see <http://www.gnu.org/licenses/>. | |
20 | --> | |
21 | <refentry id="tmpfiles.d"> | |
22 | ||
e735f4d4 MP |
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 | |
e3bff60a MP |
103 | processed first, the suffix later. Lines that take globs are |
104 | applied after those accepting no globs. If multiple operations | |
db2df898 MP |
105 | shall be applied on the same file, (such as ACL, xattr, file |
106 | attribute adjustments), these are always done in the same fixed | |
e3bff60a MP |
107 | order. Otherwise, the files/directories are processed in the order |
108 | they are listed.</para> | |
e735f4d4 MP |
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 | ||
e3bff60a MP |
123 | <para>Fields may be enclosed within quotes and contain C-style escapes.</para> |
124 | ||
e735f4d4 MP |
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 | |
e3bff60a | 138 | file. Does not follow symlinks.</para></listitem> |
e735f4d4 MP |
139 | </varlistentry> |
140 | ||
141 | <varlistentry> | |
142 | <term><varname>F</varname></term> | |
143 | <listitem><para>Create or truncate a file. If the argument | |
e3bff60a | 144 | parameter is given, it will be written to the file. Does not follow symlinks.</para> |
e735f4d4 MP |
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 | |
e3bff60a MP |
154 | backslash escapes are interpreted. Follows |
155 | symlinks.</para></listitem> | |
e735f4d4 MP |
156 | </varlistentry> |
157 | ||
158 | <varlistentry> | |
159 | <term><varname>d</varname></term> | |
160 | <listitem><para>Create a directory if it does not exist yet. | |
161 | </para></listitem> | |
162 | </varlistentry> | |
163 | ||
164 | <varlistentry> | |
165 | <term><varname>D</varname></term> | |
166 | <listitem><para>Create or empty a directory.</para></listitem> | |
167 | </varlistentry> | |
168 | ||
169 | <varlistentry> | |
170 | <term><varname>v</varname></term> | |
171 | <listitem><para>Create a subvolume if the path does not | |
db2df898 MP |
172 | exist yet, the file system supports subvolumes (btrfs), and |
173 | the system itself is installed into a subvolume | |
174 | (specifically: the root directory <filename>/</filename> is | |
175 | itself a subvolume). Otherwise, create a normal directory, in | |
176 | the same way as <varname>d</varname>. A subvolume created | |
177 | with this line type is not assigned to any higher-level | |
178 | quota group. For that, use <varname>q</varname> or | |
179 | <varname>Q</varname>, which allow creating simple quota | |
180 | group hierarchies, see below.</para></listitem> | |
181 | </varlistentry> | |
182 | ||
183 | <varlistentry> | |
184 | <term><varname>q</varname></term> | |
185 | <listitem><para>Similar to <varname>v</varname>. However, | |
186 | makes sure that the subvolume will be assigned to the same | |
187 | higher-level quota groups as the subvolume it has been | |
188 | created in. This ensures that higher-level limits and | |
189 | accounting applied to the parent subvolume also include the | |
190 | specified subvolume. On non-btrfs file systems, this line | |
191 | type is identical to <varname>d</varname>. If the subvolume | |
192 | already exists and is already assigned to one or more higher | |
193 | level quota groups, no change to the quota hierarchy is | |
194 | made. Also see <varname>Q</varname> below. See <citerefentry | |
195 | project='die-net'><refentrytitle>btrfs-qgroup</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
196 | for details about the btrfs quota group | |
197 | concept.</para></listitem> | |
198 | </varlistentry> | |
199 | ||
200 | <varlistentry> | |
201 | <term><varname>Q</varname></term> | |
202 | <listitem><para>Similar to <varname>q</varname>. However, | |
203 | instead of copying the higher-level quota group assignments | |
204 | from the parent as-is, the lowest quota group of the parent | |
205 | subvolume is determined that is not the leaf quota | |
206 | group. Then, an "intermediary" quota group is inserted that | |
207 | is one level below this level, and shares the same ID part | |
208 | as the specified subvolume. If no higher-level quota group | |
209 | exists for the parent subvolume, a new quota group at level | |
210 | 255 sharing the same ID as the specified subvolume is | |
211 | inserted instead. This new intermediary quota group is then | |
212 | assigned to the parent subvolume's higher-level quota | |
213 | groups, and the specified subvolume's leaf quota group is | |
214 | assigned to it.</para> | |
215 | ||
216 | <para>Effectively, this has a similar effect as | |
217 | <varname>q</varname>, however introduces a new higher-level | |
218 | quota group for the specified subvolume that may be used to | |
219 | enforce limits and accounting to the specified subvolume and | |
220 | children subvolume created within it. Thus, by creating | |
221 | subvolumes only via <varname>q</varname> and | |
222 | <varname>Q</varname>, a concept of "subtree quotas" is | |
223 | implemented. Each subvolume for which <varname>Q</varname> | |
224 | is set will get a "subtree" quota group created, and all | |
225 | child subvolumes created within it will be assigned to | |
226 | it. Each subvolume for which <varname>q</varname> is set | |
227 | will not get such a "subtree" quota group, but it is ensured | |
228 | that they are added to the same "subtree" quota group as their | |
229 | immediate parents.</para> | |
230 | ||
231 | <para>It is recommended to use | |
232 | <varname>Q</varname> for subvolumes that typically contain | |
233 | further subvolumes, and where it is desirable to have | |
234 | accounting and quota limits on all child subvolumes | |
235 | together. Examples for <varname>Q</varname> are typically | |
236 | <filename>/home</filename> or | |
237 | <filename>/var/lib/machines</filename>. In contrast, | |
238 | <varname>q</varname> should be used for subvolumes that | |
239 | either usually do not include further subvolumes or where no | |
240 | accounting and quota limits are needed that apply to all | |
241 | child subvolumes together. Examples for <varname>q</varname> | |
242 | are typically <filename>/var</filename> or | |
243 | <filename>/var/tmp</filename>. As with <varname>Q</varname>, | |
244 | <varname>q</varname> has no effect on the quota group | |
245 | hierarchy if the subvolume exists and already has at least | |
246 | one higher-level quota group assigned.</para></listitem> | |
e735f4d4 MP |
247 | </varlistentry> |
248 | ||
249 | <varlistentry> | |
250 | <term><varname>p</varname></term> | |
251 | <term><varname>p+</varname></term> | |
252 | <listitem><para>Create a named pipe (FIFO) if it does not | |
253 | exist yet. If suffixed with <varname>+</varname> and a file | |
254 | already exists where the pipe is to be created, it will be | |
255 | removed and be replaced by the pipe.</para></listitem> | |
256 | </varlistentry> | |
257 | ||
258 | <varlistentry> | |
259 | <term><varname>L</varname></term> | |
260 | <term><varname>L+</varname></term> | |
261 | <listitem><para>Create a symlink if it does not exist | |
262 | yet. If suffixed with <varname>+</varname> and a file | |
263 | already exists where the symlink is to be created, it will | |
264 | be removed and be replaced by the symlink. If the argument | |
265 | is omitted, symlinks to files with the same name residing in | |
266 | the directory <filename>/usr/share/factory/</filename> are | |
4c89c718 MP |
267 | created. Note that permissions and ownership on symlinks |
268 | are ignored.</para></listitem> | |
e735f4d4 MP |
269 | </varlistentry> |
270 | ||
271 | <varlistentry> | |
272 | <term><varname>c</varname></term> | |
273 | <term><varname>c+</varname></term> | |
274 | <listitem><para>Create a character device node if it does | |
275 | not exist yet. If suffixed with <varname>+</varname> and a | |
276 | file already exists where the device node is to be created, | |
277 | it will be removed and be replaced by the device node. It is | |
278 | recommended to suffix this entry with an exclamation mark to | |
279 | only create static device nodes at boot, as udev will not | |
280 | manage static device nodes that are created at runtime. | |
281 | </para></listitem> | |
282 | </varlistentry> | |
283 | ||
284 | <varlistentry> | |
285 | <term><varname>b</varname></term> | |
286 | <term><varname>b+</varname></term> | |
287 | <listitem><para>Create a block device node if it does not | |
288 | exist yet. If suffixed with <varname>+</varname> and a file | |
289 | already exists where the device node is to be created, it | |
290 | will be removed and be replaced by the device node. It is | |
291 | recommended to suffix this entry with an exclamation mark to | |
292 | only create static device nodes at boot, as udev will not | |
293 | manage static device nodes that are created at runtime. | |
294 | </para></listitem> | |
295 | </varlistentry> | |
296 | ||
297 | <varlistentry> | |
298 | <term><varname>C</varname></term> | |
299 | <listitem><para>Recursively copy a file or directory, if the | |
300 | destination files or directories do not exist yet. Note that | |
301 | this command will not descend into subdirectories if the | |
302 | destination directory already exists. Instead, the entire | |
303 | copy operation is skipped. If the argument is omitted, files | |
304 | from the source directory | |
305 | <filename>/usr/share/factory/</filename> with the same name | |
e3bff60a | 306 | are copied. Does not follow symlinks.</para></listitem> |
e735f4d4 MP |
307 | </varlistentry> |
308 | ||
309 | <varlistentry> | |
310 | <term><varname>x</varname></term> | |
311 | <listitem><para>Ignore a path during cleaning. Use this type | |
312 | to exclude paths from clean-up as controlled with the Age | |
313 | parameter. Note that lines of this type do not influence the | |
314 | effect of <varname>r</varname> or <varname>R</varname> | |
315 | lines. Lines of this type accept shell-style globs in place | |
316 | of normal path names. </para></listitem> | |
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. Unlike <varname>x</varname>, this parameter will | |
324 | not exclude the content if path is a directory, but only | |
325 | directory itself. Note that lines of this type do not | |
326 | influence the effect of <varname>r</varname> or | |
327 | <varname>R</varname> lines. Lines of this type accept | |
328 | shell-style globs in place of normal path names. | |
329 | </para></listitem> | |
330 | </varlistentry> | |
331 | ||
332 | <varlistentry> | |
333 | <term><varname>r</varname></term> | |
334 | <listitem><para>Remove a file or directory if it exists. | |
335 | This may not be used to remove non-empty directories, use | |
336 | <varname>R</varname> for that. Lines of this type accept | |
337 | shell-style globs in place of normal path | |
e3bff60a | 338 | names. Does not follow symlinks.</para></listitem> |
e735f4d4 MP |
339 | </varlistentry> |
340 | ||
341 | <varlistentry> | |
342 | <term><varname>R</varname></term> | |
343 | <listitem><para>Recursively remove a path and all its | |
344 | subdirectories (if it is a directory). Lines of this type | |
345 | accept shell-style globs in place of normal path | |
e3bff60a | 346 | names. Does not follow symlinks.</para></listitem> |
e735f4d4 MP |
347 | </varlistentry> |
348 | ||
349 | <varlistentry> | |
350 | <term><varname>z</varname></term> | |
351 | <listitem><para>Adjust the access mode, group and user, and | |
352 | restore the SELinux security context of a file or directory, | |
353 | if it exists. Lines of this type accept shell-style globs in | |
e3bff60a | 354 | place of normal path names. Does not follow symlinks.</para></listitem> |
e735f4d4 MP |
355 | </varlistentry> |
356 | ||
357 | <varlistentry> | |
358 | <term><varname>Z</varname></term> | |
359 | <listitem><para>Recursively set the access mode, group and | |
360 | user, and restore the SELinux security context of a file or | |
361 | directory if it exists, as well as of its subdirectories and | |
362 | the files contained therein (if applicable). Lines of this | |
e3bff60a MP |
363 | type accept shell-style globs in place of normal path |
364 | names. Does not follow symlinks. </para></listitem> | |
e735f4d4 MP |
365 | </varlistentry> |
366 | ||
367 | <varlistentry> | |
368 | <term><varname>t</varname></term> | |
369 | <listitem><para>Set extended attributes. Lines of this type | |
370 | accept shell-style globs in place of normal path names. | |
e3bff60a MP |
371 | This can be useful for setting SMACK labels. Does not follow |
372 | symlinks.</para></listitem> | |
e735f4d4 MP |
373 | </varlistentry> |
374 | ||
375 | <varlistentry> | |
376 | <term><varname>T</varname></term> | |
377 | <listitem><para>Recursively set extended attributes. Lines | |
378 | of this type accept shell-style globs in place of normal | |
e3bff60a MP |
379 | path names. This can be useful for setting SMACK |
380 | labels. Does not follow symlinks. </para></listitem> | |
381 | </varlistentry> | |
382 | ||
383 | <varlistentry> | |
384 | <term><varname>h</varname></term> | |
385 | <listitem><para>Set file/directory attributes. Lines of this type | |
386 | accept shell-style globs in place of normal path names.</para> | |
387 | ||
388 | <para>The format of the argument field is | |
389 | <varname>[+-=][aAcCdDeijsStTu] </varname>. The prefix | |
390 | <varname>+</varname> (the default one) causes the | |
391 | attribute(s) to be added; <varname>-</varname> causes the | |
392 | attribute(s) to be removed; <varname>=</varname> causes the | |
db2df898 | 393 | attributes to be set exactly as the following letters. The |
e3bff60a MP |
394 | letters <literal>aAcCdDeijsStTu</literal> select the new |
395 | attributes for the files, see | |
db2df898 | 396 | <citerefentry project='man-pages'><refentrytitle>chattr</refentrytitle> |
e3bff60a MP |
397 | <manvolnum>1</manvolnum></citerefentry> for further information. |
398 | </para> | |
399 | <para>Passing only <varname>=</varname> as argument resets | |
400 | all the file attributes listed above. It has to be pointed | |
db2df898 | 401 | out that the <varname>=</varname> prefix limits itself to |
e3bff60a MP |
402 | the attributes corresponding to the letters listed here. All |
403 | other attributes will be left untouched. Does not follow | |
404 | symlinks.</para> | |
405 | </listitem> | |
406 | </varlistentry> | |
407 | ||
408 | <varlistentry> | |
409 | <term><varname>H</varname></term> | |
410 | <listitem><para>Recursively set file/directory attributes. Lines | |
411 | of this type accept shell-style globs in place of normal | |
412 | path names. Does not follow symlinks. | |
e735f4d4 MP |
413 | </para></listitem> |
414 | </varlistentry> | |
415 | ||
416 | <varlistentry> | |
417 | <term><varname>a</varname></term> | |
418 | <term><varname>a+</varname></term> | |
419 | <listitem><para>Set POSIX ACLs (access control lists). If | |
db2df898 | 420 | suffixed with <varname>+</varname>, the specified entries will |
e735f4d4 MP |
421 | be added to the existing set. |
422 | <command>systemd-tmpfiles</command> will automatically add | |
423 | the required base entries for user and group based on the | |
424 | access mode of the file, unless base entries already exist | |
4c89c718 | 425 | or are explicitly specified. The mask will be added if not |
e735f4d4 MP |
426 | specified explicitly or already present. Lines of this type |
427 | accept shell-style globs in place of normal path names. This | |
428 | can be useful for allowing additional access to certain | |
e3bff60a | 429 | files. Does not follow symlinks.</para></listitem> |
e735f4d4 MP |
430 | </varlistentry> |
431 | ||
432 | <varlistentry> | |
433 | <term><varname>A</varname></term> | |
434 | <term><varname>A+</varname></term> | |
435 | <listitem><para>Same as <varname>a</varname> and | |
e3bff60a MP |
436 | <varname>a+</varname>, but recursive. Does not follow |
437 | symlinks.</para></listitem> | |
e735f4d4 MP |
438 | </varlistentry> |
439 | </variablelist> | |
440 | ||
441 | <para>If the exclamation mark is used, this line is only safe of | |
442 | execute during boot, and can break a running system. Lines | |
443 | without the exclamation mark are presumed to be safe to execute | |
444 | at any time, e.g. on package upgrades. | |
445 | <command>systemd-tmpfiles</command> will execute line with an | |
446 | exclamation mark only if option <option>--boot</option> is | |
447 | given.</para> | |
448 | ||
449 | <para>For example: | |
450 | <programlisting># Make sure these are created by default so that nobody else can | |
451 | d /tmp/.X11-unix 1777 root root 10d | |
452 | ||
453 | # Unlink the X11 lock files | |
454 | r! /tmp/.X[0-9]*-lock</programlisting> | |
455 | The second line in contrast to the first one would break a | |
456 | running system, and will only be executed with | |
457 | <option>--boot</option>.</para> | |
458 | </refsect2> | |
459 | ||
460 | <refsect2> | |
461 | <title>Path</title> | |
462 | ||
463 | <para>The file system path specification supports simple | |
464 | specifier expansion. The following expansions are | |
465 | understood:</para> | |
466 | ||
467 | <table> | |
468 | <title>Specifiers available</title> | |
469 | <tgroup cols='3' align='left' colsep='1' rowsep='1'> | |
470 | <colspec colname="spec" /> | |
471 | <colspec colname="mean" /> | |
472 | <colspec colname="detail" /> | |
473 | <thead> | |
474 | <row> | |
475 | <entry>Specifier</entry> | |
476 | <entry>Meaning</entry> | |
477 | <entry>Details</entry> | |
478 | </row> | |
479 | </thead> | |
480 | <tbody> | |
481 | <row> | |
482 | <entry><literal>%m</literal></entry> | |
483 | <entry>Machine ID</entry> | |
484 | <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> | |
485 | </row> | |
486 | <row> | |
487 | <entry><literal>%b</literal></entry> | |
488 | <entry>Boot ID</entry> | |
489 | <entry>The boot ID of the running system, formatted as string. See <citerefentry><refentrytitle>random</refentrytitle><manvolnum>4</manvolnum></citerefentry> for more information.</entry> | |
490 | </row> | |
491 | <row> | |
492 | <entry><literal>%H</literal></entry> | |
493 | <entry>Host name</entry> | |
494 | <entry>The hostname of the running system.</entry> | |
495 | </row> | |
496 | <row> | |
497 | <entry><literal>%v</literal></entry> | |
498 | <entry>Kernel release</entry> | |
499 | <entry>Identical to <command>uname -r</command> output.</entry> | |
500 | </row> | |
501 | <row> | |
502 | <entry><literal>%%</literal></entry> | |
503 | <entry>Escaped %</entry> | |
504 | <entry>Single percent sign.</entry> | |
505 | </row> | |
506 | </tbody> | |
507 | </tgroup> | |
508 | </table> | |
509 | </refsect2> | |
510 | ||
511 | <refsect2> | |
512 | <title>Mode</title> | |
513 | ||
514 | <para>The file access mode to use when creating this file or | |
515 | directory. If omitted or when set to <literal>-</literal>, the | |
516 | default is used: 0755 for directories, 0644 for all other file | |
517 | objects. For <varname>z</varname>, <varname>Z</varname> lines, | |
518 | if omitted or when set to <literal>-</literal>, the file access | |
519 | mode will not be modified. This parameter is ignored for | |
520 | <varname>x</varname>, <varname>r</varname>, | |
521 | <varname>R</varname>, <varname>L</varname>, <varname>t</varname>, | |
522 | and <varname>a</varname> lines.</para> | |
523 | ||
524 | <para>Optionally, if prefixed with <literal>~</literal>, the | |
525 | access mode is masked based on the already set access bits for | |
526 | existing file or directories: if the existing file has all | |
527 | executable bits unset, all executable bits are removed from the | |
528 | new access mode, too. Similarly, if all read bits are removed | |
529 | from the old access mode, they will be removed from the new | |
530 | access mode too, and if all write bits are removed, they will be | |
531 | removed from the new access mode too. In addition, the | |
532 | sticky/SUID/SGID bit is removed unless applied to a | |
533 | directory. This functionality is particularly useful in | |
534 | conjunction with <varname>Z</varname>.</para> | |
535 | </refsect2> | |
536 | ||
537 | <refsect2> | |
538 | <title>UID, GID</title> | |
539 | ||
540 | <para>The user and group to use for this file or directory. This | |
541 | may either be a numeric user/group ID or a user or group | |
542 | name. If omitted or when set to <literal>-</literal>, the | |
db2df898 | 543 | default 0 (root) is used. For <varname>z</varname> and |
e735f4d4 MP |
544 | <varname>Z</varname> lines, when omitted or when set to |
545 | <literal>-</literal>, the file ownership will not be | |
546 | modified. These parameters are ignored for <varname>x</varname>, | |
547 | <varname>r</varname>, <varname>R</varname>, | |
548 | <varname>L</varname>, <varname>t</varname>, and | |
549 | <varname>a</varname> lines.</para> | |
550 | </refsect2> | |
551 | ||
552 | <refsect2> | |
553 | <title>Age</title> | |
554 | <para>The date field, when set, is used to decide what files to | |
555 | delete when cleaning. If a file or directory is older than the | |
556 | current time minus the age field, it is deleted. The field | |
557 | format is a series of integers each followed by one of the | |
db2df898 | 558 | following suffixes for the respective time units: |
e3bff60a MP |
559 | <constant>s</constant>, |
560 | <constant>m</constant> or <constant>min</constant>, | |
561 | <constant>h</constant>, | |
562 | <constant>d</constant>, | |
563 | <constant>w</constant>, | |
db2df898 | 564 | <constant>ms</constant>, and |
e3bff60a | 565 | <constant>us</constant>, |
db2df898 MP |
566 | meaning seconds, minutes, hours, days, weeks, |
567 | milliseconds, and microseconds, respectively. Full names of the time units can | |
e3bff60a MP |
568 | be used too. |
569 | </para> | |
e735f4d4 MP |
570 | |
571 | <para>If multiple integers and units are specified, the time | |
e3bff60a MP |
572 | values are summed. If an integer is given without a unit, |
573 | <constant>s</constant> is assumed. | |
e735f4d4 MP |
574 | </para> |
575 | ||
576 | <para>When the age is set to zero, the files are cleaned | |
577 | unconditionally.</para> | |
578 | ||
db2df898 MP |
579 | <para>The age field only applies to lines starting with |
580 | <varname>d</varname>, <varname>D</varname>, | |
581 | <varname>v</varname>, <varname>q</varname>, | |
582 | <varname>Q</varname>, <varname>C</varname>, <varname>x</varname> | |
583 | and <varname>X</varname>. If omitted or set to | |
584 | <literal>-</literal>, no automatic clean-up is done.</para> | |
e735f4d4 MP |
585 | |
586 | <para>If the age field starts with a tilde character | |
587 | <literal>~</literal>, the clean-up is only applied to files and | |
588 | directories one level inside the directory specified, but not | |
589 | the files and directories immediately inside it.</para> | |
590 | </refsect2> | |
591 | ||
592 | <refsect2> | |
593 | <title>Argument</title> | |
594 | ||
595 | <para>For <varname>L</varname> lines determines the destination | |
db2df898 MP |
596 | path of the symlink. For <varname>c</varname> and |
597 | <varname>b</varname>, determines the major/minor of the device | |
e735f4d4 MP |
598 | node, with major and minor formatted as integers, separated by |
599 | <literal>:</literal>, e.g. <literal>1:3</literal>. For | |
600 | <varname>f</varname>, <varname>F</varname>, and | |
db2df898 | 601 | <varname>w</varname>, the argument may be used to specify a short string that |
e735f4d4 MP |
602 | is written to the file, suffixed by a newline. For |
603 | <varname>C</varname>, specifies the source file or | |
db2df898 | 604 | directory. For <varname>t</varname> and <varname>T</varname>, |
e3bff60a | 605 | determines extended attributes to be set. For |
db2df898 MP |
606 | <varname>a</varname> and <varname>A</varname>, determines ACL |
607 | attributes to be set. For <varname>h</varname> and | |
608 | <varname>H</varname>, determines the file attributes to | |
e3bff60a | 609 | set. Ignored for all other lines.</para> |
e735f4d4 MP |
610 | </refsect2> |
611 | ||
612 | </refsect1> | |
613 | ||
614 | <refsect1> | |
615 | <title>Example</title> | |
616 | <example> | |
617 | <title>/etc/tmpfiles.d/screen.conf example</title> | |
618 | <para><command>screen</command> needs two directories created at | |
619 | boot with specific modes and ownership.</para> | |
620 | ||
621 | <programlisting>d /run/screens 1777 root root 10d | |
e3bff60a MP |
622 | d /run/uscreens 0755 root root 10d12h |
623 | t /run/screen - - - - user.name="John Smith" security.SMACK64=screen</programlisting> | |
e735f4d4 MP |
624 | </example> |
625 | <example> | |
626 | <title>/etc/tmpfiles.d/abrt.conf example</title> | |
627 | <para><command>abrt</command> needs a directory created at boot with specific mode and ownership and its content should be preserved.</para> | |
628 | ||
629 | <programlisting>d /var/tmp/abrt 0755 abrt abrt | |
e3bff60a | 630 | x /var/tmp/abrt/*</programlisting> |
e735f4d4 MP |
631 | </example> |
632 | </refsect1> | |
633 | ||
634 | <refsect1> | |
635 | <title>See Also</title> | |
636 | <para> | |
637 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
638 | <citerefentry><refentrytitle>systemd-tmpfiles</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
639 | <citerefentry><refentrytitle>systemd-delta</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
640 | <citerefentry><refentrytitle>systemd.exec</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
641 | <citerefentry project='man-pages'><refentrytitle>attr</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
642 | <citerefentry project='man-pages'><refentrytitle>getfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
643 | <citerefentry project='man-pages'><refentrytitle>setfattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
644 | <citerefentry project='man-pages'><refentrytitle>setfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, | |
e3bff60a | 645 | <citerefentry project='man-pages'><refentrytitle>getfacl</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
db2df898 MP |
646 | <citerefentry project='man-pages'><refentrytitle>chattr</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
647 | <citerefentry project='die-net'><refentrytitle>btrfs-subvolume</refentrytitle><manvolnum>8</manvolnum></citerefentry>, | |
648 | <citerefentry project='die-net'><refentrytitle>btrfs-qgroup</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
e735f4d4 MP |
649 | </para> |
650 | </refsect1> | |
663996b3 MS |
651 | |
652 | </refentry> |