summaryrefslogtreecommitdiff
path: root/man/tmpfiles.d.html
blob: 94576f6f8c5e35673f6513a41b131b5688961c56 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
<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.78.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><style>
    a.headerlink {
      color: #c60f0f;
      font-size: 0.8em;
      padding: 0 4px 0 4px;
      text-decoration: none;
      visibility: hidden;
    }

    a.headerlink:hover {
      background-color: #c60f0f;
      color: white;
    }

    h1:hover > a.headerlink, h2:hover > a.headerlink, h3:hover > a.headerlink, dt:hover > a.headerlink {
      visibility: visible;
    }
  </style><a href="index.html">Index </a>·
  <a href="systemd.directives.html">Directives </a>·
  <a href="../python-systemd/index.html">Python </a>·
  <a href="../libudev/index.html">libudev </a>·
  <a href="../libudev/index.html">gudev </a><span style="float:right">systemd 204</span><hr><div class="refentry"><a name="tmpfiles.d"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>tmpfiles.d — Configuration for creation, deletion and
                cleaning of volatile and temporary files</p></div><div class="refsynopsisdiv"><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"><a name="idm259792686512"></a><h2 id="Description">Description<a class="headerlink" title="Permalink to this headline" href="#Description">¶</a></h2><p><span class="command"><strong>systemd-tmpfiles</strong></span> uses the
                configuration files from the above directories to describe the
                creation, cleaning and removal of volatile and
                temporary files and directories which usually reside
                in directories such as <code class="filename">/run</code>
                or <code class="filename">/tmp</code>.</p></div><div class="refsect1"><a name="idm259789139104"></a><h2 id="Configuration Format">Configuration Format<a class="headerlink" title="Permalink to this headline" href="#Configuration%20Format">¶</a></h2><p>Each configuration file shall be named in the
                style of <code class="filename">&lt;program&gt;.conf</code>.
                Files in <code class="filename">/etc/</code> override files
                with the same name in <code class="filename">/usr/lib/</code>
                and <code class="filename">/run/</code>.  Files in
                <code class="filename">/run/</code> override files with the same
                name in <code class="filename">/usr/lib/</code>. Packages
                should install their configuration files in
                <code class="filename">/usr/lib/</code>. Files in
                <code class="filename">/etc/</code> are reserved for the local
                administrator, who may use this logic to override the
                configuration files installed by vendor packages. All
                configuration files are sorted by their filename in
                alphabetical order, regardless in which of the
                directories they reside, to guarantee that a specific
                configuration file takes precedence over another file
                with an alphabetically later name.</p><p>If the administrator wants to disable a
                configuration file supplied by the vendor the
                recommended way is to place a symlink to
                <code class="filename">/dev/null</code> in
                <code class="filename">/etc/tmpfiles.d/</code> bearing the
                same file name.</p><p>The configuration format is one line per path
                containing action, path, mode, ownership, age and argument
                fields:</p><pre class="programlisting">Type Path        Mode UID  GID  Age Argument
d    /run/user   0755 root root 10d -
L    /tmp/foobar -    -    -    -   /dev/null</pre><div class="refsect2"><a name="idm259789128528"></a><h3 id="Type">Type<a class="headerlink" title="Permalink to this headline" href="#Type">¶</a></h3><div class="variablelist"><dl class="variablelist"><dt id="f"><span class="term"><code class="varname">f</code></span><a class="headerlink" title="Permalink to this term" href="#f">¶</a></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 id="F"><span class="term"><code class="varname">F</code></span><a class="headerlink" title="Permalink to this term" href="#F">¶</a></dt><dd><p>Create or truncate a file (optionally writing a short string into it, if the argument parameter is passed)</p></dd><dt id="w"><span class="term"><code class="varname">w</code></span><a class="headerlink" title="Permalink to this term" href="#w">¶</a></dt><dd><p>Write the argument parameter to a file, if the file exists.
                                            Lines of this type accept shell-style globs in place of normal path
                                            names. The argument parameter will be written without a trailing
                                            newline. C-style backslash escapes are interpreted.</p></dd><dt id="d"><span class="term"><code class="varname">d</code></span><a class="headerlink" title="Permalink to this term" href="#d">¶</a></dt><dd><p>Create a directory if it doesn't exist yet</p></dd><dt id="D"><span class="term"><code class="varname">D</code></span><a class="headerlink" title="Permalink to this term" href="#D">¶</a></dt><dd><p>Create or empty a directory</p></dd><dt id="p"><span class="term"><code class="varname">p</code></span><a class="headerlink" title="Permalink to this term" href="#p">¶</a></dt><dd><p>Create a named pipe (FIFO) if it doesn't exist yet</p></dd><dt id="L"><span class="term"><code class="varname">L</code></span><a class="headerlink" title="Permalink to this term" href="#L">¶</a></dt><dd><p>Create a symlink if it doesn't exist yet</p></dd><dt id="c"><span class="term"><code class="varname">c</code></span><a class="headerlink" title="Permalink to this term" href="#c">¶</a></dt><dd><p>Create a character device node if it doesn't exist yet</p></dd><dt id="b"><span class="term"><code class="varname">b</code></span><a class="headerlink" title="Permalink to this term" href="#b">¶</a></dt><dd><p>Create a block device node if it doesn't exist yet</p></dd><dt id="x"><span class="term"><code class="varname">x</code></span><a class="headerlink" title="Permalink to this term" href="#x">¶</a></dt><dd><p>Ignore a path
                                        during cleaning. Use this type
                                        to exclude paths from clean-up
                                        as controlled with the Age
                                        parameter. Note that lines of
                                        this type do not influence the
                                        effect of r or R lines. Lines
                                        of this type accept
                                        shell-style globs in place of
                                        normal path
                                        names.</p></dd><dt id="X"><span class="term"><code class="varname">X</code></span><a class="headerlink" title="Permalink to this term" href="#X">¶</a></dt><dd><p>Ignore a path
                                        during cleanup. Use this type
                                        to prevent path removal as
                                        controlled with the Age parameter.
                                        Note that if path is a directory,
                                        content of a directory is not
                                        excluded from clean-up, only
                                        directory itself. Lines of this
                                        type accept shell-style globs
                                        in place of normal path
                                        names.</p></dd><dt id="r"><span class="term"><code class="varname">r</code></span><a class="headerlink" title="Permalink to this term" href="#r">¶</a></dt><dd><p>Remove a file
                                        or directory if it
                                        exists. This may not be used
                                        to remove non-empty
                                        directories, use R for
                                        that. Lines of this type
                                        accept shell-style globs in
                                        place of normal path
                                        names.</p></dd><dt id="R"><span class="term"><code class="varname">R</code></span><a class="headerlink" title="Permalink to this term" href="#R">¶</a></dt><dd><p>Recursively
                                        remove a path and all its
                                        subdirectories (if it is a
                                        directory). Lines of this type
                                        accept shell-style globs in
                                        place of normal path
                                        names.</p></dd><dt id="z"><span class="term"><code class="varname">z</code></span><a class="headerlink" title="Permalink to this term" href="#z">¶</a></dt><dd><p>Restore
                                        SELinux security context label
                                        and set ownership and access
                                        mode of a file or directory if
                                        it exists.  Lines of this type
                                        accept shell-style globs in
                                        place of normal path names.
                                        </p></dd><dt id="Z"><span class="term"><code class="varname">Z</code></span><a class="headerlink" title="Permalink to this term" href="#Z">¶</a></dt><dd><p>Recursively
                                        restore SELinux security
                                        context label and set
                                        ownership and access mode of a
                                        path and all its
                                        subdirectories (if it is a
                                        directory). Lines of this type
                                        accept shell-style globs in
                                        place of normal path
                                        names.</p></dd></dl></div></div><div class="refsect2"><a name="idm259792756656"></a><h3 id="Mode">Mode<a class="headerlink" title="Permalink to this headline" href="#Mode">¶</a></h3><p>The file access mode to use when
                        creating this file or directory. If omitted or
                        when set to - the default is used: 0755 for
                        directories, 0644 for all other file
                        objects. For z, Z lines if omitted or when set
                        to - the file access mode will not be
                        modified. This parameter is ignored for x, r,
                        R, L lines.</p></div><div class="refsect2"><a name="idm259792754944"></a><h3 id="UID, GID">UID, GID<a class="headerlink" title="Permalink to this headline" href="#UID,%20GID">¶</a></h3><p>The user and group to use for this file
                        or directory. This may either be a numeric
                        user/group ID or a user or group name. If
                        omitted or when set to - the default 0 (root)
                        is used. For z, Z lines when omitted or when set to -
                        the file ownership will not be modified.
                        These parameters are ignored for x, r, R, L lines.</p></div><div class="refsect2"><a name="idm259792753280"></a><h3 id="Age">Age<a class="headerlink" title="Permalink to this headline" href="#Age">¶</a></h3><p>The date field, when set, is used to
                        decide what files to delete when cleaning. If
                        a file or directory is older than the current
                        time minus the age field it is deleted. The
                        field format is a series of integers each
                        followed by one of the following
                        postfixes for the respective time units:</p><div class="variablelist"><dl class="variablelist"><dt id="s"><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><a class="headerlink" title="Permalink to this term" href="#s">¶</a></dt><dd></dd></dl></div><p>If multiple integers and units are specified the time
                        values are summed up. If an integer is given without a unit,
                        s is assumed.
                        </p><p>When the age is set to zero, the files are cleaned
                        unconditionally.</p><p>The age field only applies to lines starting with
                        d, D and x. If omitted or set to - no automatic clean-up
                        is done.</p><p>If the age field starts with a tilde
                        character (~) the clean-up is only applied to
                        files and directories one level inside the
                        directory specified, but not the files and
                        directories immediately inside it.</p></div><div class="refsect2"><a name="idm259792744496"></a><h3 id="Argument">Argument<a class="headerlink" title="Permalink to this headline" href="#Argument">¶</a></h3><p>For L lines determines the destination
                        path of the symlink. For c, b determines the
                        major/minor of the device node, with major and
                        minor formatted as integers, separated by :,
                        e.g. "1:3". For f, F, w may be used to specify
                        a short string that is written to the file,
                        suffixed by a newline. Ignored for all other
                        lines.</p></div></div><div class="refsect1"><a name="idm259792742688"></a><h2 id="Example">Example<a class="headerlink" title="Permalink to this headline" href="#Example">¶</a></h2><div class="example"><a name="idm259792742016"></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
d /var/run/uscreens 0755 root root 10d12h</pre></div></div><br class="example-break"></div><div class="refsect1"><a name="idm259792739472"></a><h2 id="See Also">See Also<a class="headerlink" title="Permalink to this headline" href="#See%20Also">¶</a></h2><p>
                        <a href="systemd.html"><span class="citerefentry"><span class="refentrytitle">systemd</span>(1)</span></a>,
                        <a href="systemd-tmpfiles.html"><span class="citerefentry"><span class="refentrytitle">systemd-tmpfiles</span>(8)</span></a>,
                        <a href="systemd-delta.html"><span class="citerefentry"><span class="refentrytitle">systemd-delta</span>(1)</span></a>
                </p></div></div></body></html>