]> git.proxmox.com Git - systemd.git/blob - man/tmpfiles.d.5
Imported Upstream version 214
[systemd.git] / man / tmpfiles.d.5
1 '\" t
2 .TH "TMPFILES\&.D" "5" "" "systemd 214" "tmpfiles.d"
3 .\" -----------------------------------------------------------------
4 .\" * Define some portability stuff
5 .\" -----------------------------------------------------------------
6 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
7 .\" http://bugs.debian.org/507673
8 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
9 .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
10 .ie \n(.g .ds Aq \(aq
11 .el .ds Aq '
12 .\" -----------------------------------------------------------------
13 .\" * set default formatting
14 .\" -----------------------------------------------------------------
15 .\" disable hyphenation
16 .nh
17 .\" disable justification (adjust text to left margin only)
18 .ad l
19 .\" -----------------------------------------------------------------
20 .\" * MAIN CONTENT STARTS HERE *
21 .\" -----------------------------------------------------------------
22 .SH "NAME"
23 tmpfiles.d \- Configuration for creation, deletion and cleaning of volatile and temporary files
24 .SH "SYNOPSIS"
25 .PP
26 /etc/tmpfiles\&.d/*\&.conf
27 .PP
28 /run/tmpfiles\&.d/*\&.conf
29 .PP
30 /usr/lib/tmpfiles\&.d/*\&.conf
31 .SH "DESCRIPTION"
32 .PP
33 \fBsystemd\-tmpfiles\fR
34 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
35 /run
36 or
37 /tmp\&.
38 .PP
39 Volatile and temporary files and directories are those located in
40 /run
41 (and its alias
42 /var/run),
43 /tmp,
44 /var/tmp, the API file systems such as
45 /sys
46 or
47 /proc, as well as some other directories below
48 /var\&.
49 .PP
50 System daemons frequently require private runtime directories below
51 /run
52 to place communication sockets and similar in\&. For these, consider declaring them in their unit files using
53 \fIRuntimeDirectory=\fR
54 (see
55 \fBsystemd.exec\fR(5)
56 for details), if this is feasible\&.
57 .SH "CONFIGURATION FORMAT"
58 .PP
59 Each configuration file shall be named in the style of
60 \fIpackage\fR\&.conf
61 or
62 \fIpackage\fR\-\fIpart\fR\&.conf\&. The second variant should be used when it is desirable to make it easy to override just this part of configuration\&.
63 .PP
64 Files in
65 /etc/tmpfiles\&.d
66 override files with the same name in
67 /usr/lib/tmpfiles\&.d
68 and
69 /run/tmpfiles\&.d\&. Files in
70 /run/tmpfiles\&.d
71 override files with the same name in
72 /usr/lib/tmpfiles\&.d\&. Packages should install their configuration files in
73 /usr/lib/tmpfiles\&.d\&. Files in
74 /etc/tmpfiles\&.d
75 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 lexicographic order, regardless of which of the directories they reside in\&. If multiple files specify the same path, the entry in the file with the lexicographically earliest name will be applied, all all other conflicting entries will be logged as errors\&. When two lines are prefix and suffix of each other, then the prefix is always processed first, the suffix later\&. Otherwise the files/directories are processed in the order they are listed\&.
76 .PP
77 If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to
78 /dev/null
79 in
80 /etc/tmpfiles\&.d/
81 bearing the same filename\&.
82 .PP
83 The configuration format is one line per path containing type, path, mode, ownership, age, and argument fields:
84 .sp
85 .if n \{\
86 .RS 4
87 .\}
88 .nf
89 #Type Path Mode UID GID Age Argument
90 d /run/user 0755 root root 10d \-
91 L /tmp/foobar \- \- \- \- /dev/null
92 .fi
93 .if n \{\
94 .RE
95 .\}
96 .SS "Type"
97 .PP
98 The type consists of a single letter and optionally an exclamation mark\&.
99 .PP
100 The following line types are understood:
101 .PP
102 \fIf\fR
103 .RS 4
104 Create a file if it does not exist yet\&. If the argument parameter is given, it will be written to the file\&.
105 .RE
106 .PP
107 \fIF\fR
108 .RS 4
109 Create or truncate a file\&. If the argument parameter is given, it will be written to the file\&.
110 .RE
111 .PP
112 \fIw\fR
113 .RS 4
114 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\&.
115 .RE
116 .PP
117 \fId\fR
118 .RS 4
119 Create a directory if it does not exist yet\&.
120 .RE
121 .PP
122 \fID\fR
123 .RS 4
124 Create or empty a directory\&.
125 .RE
126 .PP
127 \fIp\fR
128 .RS 4
129 Create a named pipe (FIFO) if it does not exist yet\&.
130 .RE
131 .PP
132 \fIL\fR
133 .RS 4
134 Create a symlink if it does not exist yet\&.
135 .RE
136 .PP
137 \fIc\fR
138 .RS 4
139 Create a character device node if it does not exist yet\&.
140 .RE
141 .PP
142 \fIb\fR
143 .RS 4
144 Create a block device node if it does not exist yet\&.
145 .RE
146 .PP
147 \fIC\fR
148 .RS 4
149 Recursively copy a file or directory, if the destination files or directories don\*(Aqt exist yet\&.
150 .RE
151 .PP
152 \fIx\fR
153 .RS 4
154 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
155 \fIr\fR
156 or
157 \fIR\fR
158 lines\&. Lines of this type accept shell\-style globs in place of normal path names\&.
159 .RE
160 .PP
161 \fIX\fR
162 .RS 4
163 Ignore a path during cleaning\&. Use this type to exclude paths from clean\-up as controlled with the Age parameter\&. Unlike
164 \fIx\fR, this parameter will not exclude the content if path is a directory, but only directory itself\&. Note that lines of this type do not influence the effect of
165 \fIr\fR
166 or
167 \fIR\fR
168 lines\&. Lines of this type accept shell\-style globs in place of normal path names\&.
169 .RE
170 .PP
171 \fIr\fR
172 .RS 4
173 Remove a file or directory if it exists\&. This may not be used to remove non\-empty directories, use
174 \fIR\fR
175 for that\&. Lines of this type accept shell\-style globs in place of normal path names\&.
176 .RE
177 .PP
178 \fIR\fR
179 .RS 4
180 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\&.
181 .RE
182 .PP
183 \fIz\fR
184 .RS 4
185 Adjust the access mode, group and user, and restore the SELinux security context of a file or directory, if it exists\&. Lines of this type accept shell\-style globs in place of normal path names\&.
186 .RE
187 .PP
188 \fIZ\fR
189 .RS 4
190 Recursively set the access mode, group and user, and restore the SELinux security context of a file or directory if it exists, as well as of its subdirectories and the files contained therein (if applicable)\&. Lines of this type accept shell\-style globs in place of normal path names\&.
191 .RE
192 .PP
193 If the exclamation mark is used, this line is only safe of execute during boot, and can break a running system\&. Lines without the exclamation mark are presumed to be safe to execute at any time, e\&.g\&. on package upgrades\&.
194 \fBsystemd\-tmpfiles\fR
195 will execute line with an exclamation mark only if option
196 \fB\-\-boot\fR
197 is given\&.
198 .PP
199 For example:
200 .sp
201 .if n \{\
202 .RS 4
203 .\}
204 .nf
205 # Make sure these are created by default so that nobody else can
206 d /tmp/\&.X11\-unix 1777 root root 10d
207
208 # Unlink the X11 lock files
209 r! /tmp/\&.X[0\-9]*\-lock
210 .fi
211 .if n \{\
212 .RE
213 .\}
214 .sp
215 The second line in contrast to the first one would break a running system, and will only be executed with
216 \fB\-\-boot\fR\&.
217 .SS "Path"
218 .PP
219 The file system path specification supports simple specifier expansion\&. The following expansions are understood:
220 .sp
221 .it 1 an-trap
222 .nr an-no-space-flag 1
223 .nr an-break-flag 1
224 .br
225 .B Table\ \&1.\ \&Specifiers available
226 .TS
227 allbox tab(:);
228 lB lB lB.
229 T{
230 Specifier
231 T}:T{
232 Meaning
233 T}:T{
234 Details
235 T}
236 .T&
237 l l l
238 l l l
239 l l l
240 l l l
241 l l l.
242 T{
243 "%m"
244 T}:T{
245 Machine ID
246 T}:T{
247 The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
248 T}
249 T{
250 "%b"
251 T}:T{
252 Boot ID
253 T}:T{
254 The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
255 T}
256 T{
257 "%H"
258 T}:T{
259 Host name
260 T}:T{
261 The hostname of the running system\&.
262 T}
263 T{
264 "%v"
265 T}:T{
266 Kernel release
267 T}:T{
268 Identical to \fBuname \-r\fR output\&.
269 T}
270 T{
271 "%%"
272 T}:T{
273 Escaped %
274 T}:T{
275 Single percent sign\&.
276 T}
277 .TE
278 .sp 1
279 .SS "Mode"
280 .PP
281 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
282 \fIz\fR,
283 \fIZ\fR
284 lines, if omitted or when set to
285 "\-", the file access mode will not be modified\&. This parameter is ignored for
286 \fIx\fR,
287 \fIr\fR,
288 \fIR\fR,
289 \fIL\fR
290 lines\&.
291 .PP
292 Optionally, if prefixed with
293 "~"
294 the access mode is masked based on the already set access bits for existing file or directories: if the existing file has all executable bits unset then all executable bits are removed from the new access mode, too\&. Similar, if all read bits are removed from the old access mode they will be removed from the new access mode too, and if all write bits are removed, they will be removed from the new access mode too\&. In addition the sticky/suid/gid bit is removed unless applied to a directory\&. This functionality is particularly useful in conjunction with
295 \fIZ\fR\&.
296 .SS "UID, GID"
297 .PP
298 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
299 "\-", the default 0 (root) is used\&. For
300 \fIz\fR,
301 \fIZ\fR
302 lines, when omitted or when set to \-, the file ownership will not be modified\&. These parameters are ignored for
303 \fIx\fR,
304 \fIr\fR,
305 \fIR\fR,
306 \fIL\fR
307 lines\&.
308 .SS "Age"
309 .PP
310 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:
311 .PP
312 \fIs\fR, \fImin\fR, \fIh\fR, \fId\fR, \fIw\fR, \fIms\fR, \fIm\fR, \fIus\fR
313 .RS 4
314 .RE
315 .PP
316 If multiple integers and units are specified, the time values are summed up\&. If an integer is given without a unit, s is assumed\&.
317 .PP
318 When the age is set to zero, the files are cleaned unconditionally\&.
319 .PP
320 The age field only applies to lines starting with
321 \fId\fR,
322 \fID\fR, and
323 \fIx\fR\&. If omitted or set to
324 "\-", no automatic clean\-up is done\&.
325 .PP
326 If the age field starts with a tilde character
327 "~", 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\&.
328 .SS "Argument"
329 .PP
330 For
331 \fIL\fR
332 lines determines the destination path of the symlink\&. For
333 \fIc\fR,
334 \fIb\fR
335 determines the major/minor of the device node, with major and minor formatted as integers, separated by
336 ":", e\&.g\&.
337 "1:3"\&. For
338 \fIf\fR,
339 \fIF\fR, and
340 \fIw\fR
341 may be used to specify a short string that is written to the file, suffixed by a newline\&. For
342 \fIC\fR
343 specifies the source file or directory\&. Ignored for all other lines\&.
344 .SH "EXAMPLE"
345 .PP
346 \fBExample\ \&1.\ \&/etc/tmpfiles.d/screen.conf example\fR
347 .PP
348 \fBscreen\fR
349 needs two directories created at boot with specific modes and ownership\&.
350 .sp
351 .if n \{\
352 .RS 4
353 .\}
354 .nf
355 d /run/screens 1777 root root 10d
356 d /run/uscreens 0755 root root 10d12h
357 .fi
358 .if n \{\
359 .RE
360 .\}
361 .PP
362 \fBExample\ \&2.\ \&/etc/tmpfiles.d/abrt.conf example\fR
363 .PP
364 \fBabrt\fR
365 needs a directory created at boot with specific mode and ownership and its content should be preserved\&.
366 .sp
367 .if n \{\
368 .RS 4
369 .\}
370 .nf
371 d /var/tmp/abrt 0755 abrt abrt
372 x /var/tmp/abrt/*
373 .fi
374 .if n \{\
375 .RE
376 .\}
377 .SH "SEE ALSO"
378 .PP
379 \fBsystemd\fR(1),
380 \fBsystemd-tmpfiles\fR(8),
381 \fBsystemd-delta\fR(1),
382 \fBsystemd.exec\fR(5)