1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>tmpfiles.d</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"/></head><body><div class="refentry" title="tmpfiles.d"><a id="tmpfiles.d"/><div class="titlepage"/><div class="refnamediv"><h2>Name</h2><p>tmpfiles.d — Configuration for creation, deletion and
4
cleaning of volatile and temporary files</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><p><code class="filename">/usr/lib/tmpfiles.d/*.conf</code></p><p><code class="filename">/etc/tmpfiles.d/*.conf</code></p><p><code class="filename">/run/tmpfiles.d/*.conf</code></p></div><div class="refsect1" title="Description"><a id="id335079"/><h2>Description</h2><p><span class="command"><strong>systemd-tmpfiles</strong></span> uses the
1
<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>tmpfiles.d</title><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="refentry" title="tmpfiles.d"><a name="tmpfiles.d"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tmpfiles.d — Configuration for creation, deletion and
2
cleaning of volatile and temporary files</p></div><div class="refsynopsisdiv" title="Synopsis"><h2>Synopsis</h2><p><code class="filename">/etc/tmpfiles.d/*.conf</code></p><p><code class="filename">/run/tmpfiles.d/*.conf</code></p><p><code class="filename">/usr/lib/tmpfiles.d/*.conf</code></p></div><div class="refsect1" title="Description"><a name="id398678"></a><h2>Description</h2><p><span class="command"><strong>systemd-tmpfiles</strong></span> uses the
5
3
configuration files from the above directories to describe the
6
4
creation, cleaning and removal of volatile and
7
5
temporary files and directories which usually reside
8
6
in directories such as <code class="filename">/run</code>
9
or <code class="filename">/tmp</code>.</p></div><div class="refsect1" title="Configuration Format"><a id="id335107"/><h2>Configuration Format</h2><p>Each configuration file is named in the style of
10
<code class="filename"><program>.conf</code>.
11
Files in <code class="filename">/etc/</code> overwrite
12
files with the same name in <code class="filename">/usr/lib/</code>.
13
Files in <code class="filename">/run</code> overwrite files with
14
the same name in <code class="filename">/etc/</code> and
15
<code class="filename">/usr/lib/</code>. Packages should install their
16
configuration files in <code class="filename">/usr/lib/</code>, files
17
in <code class="filename">/etc/</code> are reserved for the local
18
administration, which possibly decides to overwrite the
19
configurations installed from packages. All files are sorted
20
by filename in alphabetical order, regardless in which of the
21
directories they reside, to ensure that a specific
22
configuration file takes precedence over another file with
23
an alphabetically later name.</p><p>The configuration format is one line per path
24
containing action, mode, ownership and age
25
fields:</p><pre class="programlisting">Type Path Mode UID GID Age
26
d /run/user 0755 root root 10d</pre><div class="refsect2" title="Type"><a id="id335177"/><h3>Type</h3><div class="variablelist"><dl><dt><span class="term"><code class="varname">f</code></span></dt><dd><p>Create a file if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">F</code></span></dt><dd><p>Create or truncate a file</p></dd><dt><span class="term"><code class="varname">d</code></span></dt><dd><p>Create a directory if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">D</code></span></dt><dd><p>Create or empty a directory</p></dd><dt><span class="term"><code class="varname">p</code></span></dt><dd><p>Create a named pipe (FIFO) if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">x</code></span></dt><dd><p>Ignore a path
7
or <code class="filename">/tmp</code>.</p></div><div class="refsect1" title="Configuration Format"><a name="id398706"></a><h2>Configuration Format</h2><p>Each configuration file is named in the style of
8
<code class="filename"><program>.conf</code>. Files in
9
<code class="filename">/etc/</code> override files with the
10
same name in <code class="filename">/usr/lib/</code>. Files in
11
<code class="filename">/run</code> override files with the same
12
name in <code class="filename">/etc/</code> and
13
<code class="filename">/usr/lib/</code>. Packages should
14
install their configuration files in
15
<code class="filename">/usr/lib/</code>, files in
16
<code class="filename">/etc/</code> are reserved for the local
17
administrator, who may choose to override the
18
configurations installed from packages. The list of
19
configuration files are sorted by their filename in
20
alphabetical order, regardless in which of the
21
directories they reside, to guarantee that a
22
configuration file takes precedence over another
23
configuration file with an alphabetically later
24
name.</p><p>The configuration format is one line per path
25
containing action, path, mode, ownership, age and argument
26
fields:</p><pre class="programlisting">Type Path Mode UID GID Age Argument
27
d /run/user 0755 root root 10d -
28
L /tmp/foobar - - - - /dev/null</pre><div class="refsect2" title="Type"><a name="id398778"></a><h3>Type</h3><div class="variablelist"><dl><dt><span class="term"><code class="varname">f</code></span></dt><dd><p>Create a file if it doesn't exist yet (optionally writing a short string into it, if the argument parameter is passed)</p></dd><dt><span class="term"><code class="varname">F</code></span></dt><dd><p>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</p></dd><dt><span class="term"><code class="varname">w</code></span></dt><dd><p>Write the argument parameter to a file, if it exists.</p></dd><dt><span class="term"><code class="varname">d</code></span></dt><dd><p>Create a directory if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">D</code></span></dt><dd><p>Create or empty a directory</p></dd><dt><span class="term"><code class="varname">p</code></span></dt><dd><p>Create a named pipe (FIFO) if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">L</code></span></dt><dd><p>Create a symlink if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">c</code></span></dt><dd><p>Create a character device node if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">b</code></span></dt><dd><p>Create a block device node if it doesn't exist yet</p></dd><dt><span class="term"><code class="varname">x</code></span></dt><dd><p>Ignore a path
27
29
during cleaning. Use this type
28
30
to exclude paths from clean-up
29
31
as controlled with the Age
47
49
directory). Lines of this type
48
50
accept shell-style globs in
49
51
place of normal path
50
names.</p></dd></dl></div></div><div class="refsect2" title="Mode"><a id="id302653"/><h3>Mode</h3><p>The file access mode to use when
52
names.</p></dd><dt><span class="term"><code class="varname">z</code></span></dt><dd><p>Restore
53
SELinux security context label
54
and set ownership and access
55
mode of a file or directory if
56
it exists. Lines of this type
57
accept shell-style globs in
58
place of normal path names.
59
</p></dd><dt><span class="term"><code class="varname">Z</code></span></dt><dd><p>Recursively
60
restore SELinux security
62
ownership and access mode of a
64
subdirectories (if it is a
65
directory). Lines of this type
66
accept shell-style globs in
68
names.</p></dd></dl></div></div><div class="refsect2" title="Mode"><a name="id398507"></a><h3>Mode</h3><p>The file access mode to use when
51
69
creating this file or directory. If omitted or
52
70
when set to - the default is used: 0755 for
53
directories, 0644 for files. This parameter is
54
ignored for x, r, R lines.</p></div><div class="refsect2" title="UID, GID"><a id="id302665"/><h3>UID, GID</h3><p>The user and group to use for this file
71
directories, 0644 for all other file
72
objects. For z, Z lines if omitted or when set
73
to - the file access mode will not be
74
modified. This parameter is ignored for x, r,
75
R, L lines.</p></div><div class="refsect2" title="UID, GID"><a name="id398520"></a><h3>UID, GID</h3><p>The user and group to use for this file
55
76
or directory. This may either be a numeric
56
77
user/group ID or a user or group name. If
57
78
omitted or when set to - the default 0 (root)
58
is used. . These parameters are ignored for x,
59
r, R lines.</p></div><div class="refsect2" title="Age"><a id="id302678"/><h3>Age</h3><p>The date field, when set, is used to
79
is used. For z, Z lines when omitted or when set to -
80
the file ownership will not be modified.
81
These parameters are ignored for x, r, R, L lines.</p></div><div class="refsect2" title="Age"><a name="id397917"></a><h3>Age</h3><p>The date field, when set, is used to
60
82
decide what files to delete when cleaning. If
61
83
a file or directory is older than the current
62
84
time minus the age field it is deleted. The
63
85
field format is a series of integers each
64
86
followed by one of the following
65
postfixes for the respective time units:</p><div class="variablelist"><dl><dt><span class="term"><code class="varname">s</code>, </span><span class="term"><code class="varname">min</code>, </span><span class="term"><code class="varname">h</code>, </span><span class="term"><code class="varname">d</code>, </span><span class="term"><code class="varname">w</code>, </span><span class="term"><code class="varname">ms</code>, </span><span class="term"><code class="varname">m</code>, </span><span class="term"><code class="varname">us</code></span></dt><dd/></dl></div><p>If multiple integers and units are specified the time
87
postfixes for the respective time units:</p><div class="variablelist"><dl><dt><span class="term"><code class="varname">s</code>, </span><span class="term"><code class="varname">min</code>, </span><span class="term"><code class="varname">h</code>, </span><span class="term"><code class="varname">d</code>, </span><span class="term"><code class="varname">w</code>, </span><span class="term"><code class="varname">ms</code>, </span><span class="term"><code class="varname">m</code>, </span><span class="term"><code class="varname">us</code></span></dt><dd></dd></dl></div><p>If multiple integers and units are specified the time
66
88
values are summed up.</p><p>The age field only applies to lines starting with
67
89
d, D and x. If omitted or set to - no automatic clean-up
68
is done.</p></div></div><div class="refsect1" title="Example"><a id="id302818"/><h2>Example</h2><div class="example"><a id="id302823"/><p class="title"><strong>Example 1. /etc/tmpfiles.d/screen.conf example</strong></p><div class="example-contents"><p><span class="command"><strong>screen</strong></span> needs two directories created at boot with specific modes and ownership.</p><pre class="programlisting">d /var/run/screens 1777 root root 10d
69
d /var/run/uscreens 0755 root root 10d12h</pre></div></div><br class="example-break"/></div><div class="refsect1" title="See Also"><a id="id302845"/><h2>See Also</h2><p>
90
is done.</p></div><div class="refsect2" title="Argument"><a name="id397981"></a><h3>Argument</h3><p>For L lines determines the destination
91
path of the symlink. For c, b determines the
92
major/minor of the device node, with major and
93
minor formatted as integers, separated by :,
94
e.g. "1:3". For f, F, w may be used to specify
95
a short string that is written to the file,
96
suffixed by a newline. Ignored for all other
97
lines.</p></div></div><div class="refsect1" title="Example"><a name="id398545"></a><h2>Example</h2><div class="example"><a name="id398550"></a><p class="title"><b>Example 1. /etc/tmpfiles.d/screen.conf example</b></p><div class="example-contents"><p><span class="command"><strong>screen</strong></span> needs two directories created at boot with specific modes and ownership.</p><pre class="programlisting">d /var/run/screens 1777 root root 10d
98
d /var/run/uscreens 0755 root root 10d12h</pre></div></div><br class="example-break"></div><div class="refsect1" title="See Also"><a name="id398572"></a><h2>See Also</h2><p>
70
99
<span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span>,
71
100
<span class="citerefentry"><span class="refentrytitle">systemd-tmpfiles</span>(8)</span>
72
101
</p></div></div></body></html>