]> git.proxmox.com Git - systemd.git/blame - man/tmpfiles.d.5
Imported Upstream version 217
[systemd.git] / man / tmpfiles.d.5
CommitLineData
14228c0d 1'\" t
5eef597e 2.TH "TMPFILES\&.D" "5" "" "systemd 217" "tmpfiles.d"
14228c0d
MB
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"
23tmpfiles.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
34uses 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
36or
37/tmp\&.
60f067b4
JS
38.PP
39Volatile 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
46or
47/proc, as well as some other directories below
48/var\&.
49.PP
50System daemons frequently require private runtime directories below
51/run
52to 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)
56for details), if this is feasible\&.
14228c0d
MB
57.SH "CONFIGURATION FORMAT"
58.PP
59Each configuration file shall be named in the style of
60f067b4
JS
60\fIpackage\fR\&.conf
61or
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
64Files in
65/etc/tmpfiles\&.d
14228c0d 66override files with the same name in
60f067b4 67/usr/lib/tmpfiles\&.d
14228c0d 68and
60f067b4
JS
69/run/tmpfiles\&.d\&. Files in
70/run/tmpfiles\&.d
14228c0d 71override files with the same name in
60f067b4
JS
72/usr/lib/tmpfiles\&.d\&. Packages should install their configuration files in
73/usr/lib/tmpfiles\&.d\&. Files in
74/etc/tmpfiles\&.d
e842803a 75are 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\&.
14228c0d
MB
76.PP
77If the administrator wants to disable a configuration file supplied by the vendor, the recommended way is to place a symlink to
78/dev/null
79in
80/etc/tmpfiles\&.d/
81bearing the same filename\&.
82.PP
60f067b4 83The configuration format is one line per path containing type, path, mode, ownership, age, and argument fields:
14228c0d
MB
84.sp
85.if n \{\
86.RS 4
87.\}
88.nf
60f067b4 89#Type Path Mode UID GID Age Argument
14228c0d
MB
90d /run/user 0755 root root 10d \-
91L /tmp/foobar \- \- \- \- /dev/null
92.fi
93.if n \{\
94.RE
95.\}
96.SS "Type"
97.PP
60f067b4
JS
98The type consists of a single letter and optionally an exclamation mark\&.
99.PP
14228c0d
MB
100The following line types are understood:
101.PP
102\fIf\fR
103.RS 4
60f067b4 104Create a file if it does not exist yet\&. If the argument parameter is given, it will be written to the file\&.
14228c0d
MB
105.RE
106.PP
107\fIF\fR
108.RS 4
60f067b4 109Create or truncate a file\&. If the argument parameter is given, it will be written to the file\&.
14228c0d
MB
110.RE
111.PP
112\fIw\fR
113.RS 4
114Write 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
60f067b4 119Create a directory if it does not exist yet\&.
14228c0d
MB
120.RE
121.PP
122\fID\fR
123.RS 4
60f067b4 124Create or empty a directory\&.
14228c0d
MB
125.RE
126.PP
e842803a 127\fIp\fR, \fIp+\fR
14228c0d 128.RS 4
e842803a
MB
129Create a named pipe (FIFO) if it does not exist yet\&. If suffixed with
130\fI+\fR
131and a file already exists where the pipe is to be created, it will be removed and be replaced by the pipe\&.
14228c0d
MB
132.RE
133.PP
e842803a 134\fIL\fR, \fIL+\fR
14228c0d 135.RS 4
e842803a
MB
136Create a symlink if it does not exist yet\&. If suffixed with
137\fI+\fR
138and a file already exists where the symlink is to be created, it will be removed and be replaced by the symlink\&. If the argument is omitted, symlinks to files with the same name residing in the directory
139/usr/share/factory/
140are created\&.
14228c0d
MB
141.RE
142.PP
e842803a 143\fIc\fR, \fIc+\fR
14228c0d 144.RS 4
e842803a
MB
145Create a character device node if it does not exist yet\&. If suffixed with
146\fI+\fR
5eef597e 147and a file already exists where the device node is to be created, it will be removed and be replaced by the device node\&. It is recommended to suffix this entry with an exclamation mark to only create static device nodes at boot, as udev will not manage static device nodes that are created at runtime\&.
14228c0d
MB
148.RE
149.PP
e842803a 150\fIb\fR, \fIb+\fR
14228c0d 151.RS 4
e842803a
MB
152Create a block device node if it does not exist yet\&. If suffixed with
153\fI+\fR
5eef597e 154and a file already exists where the device node is to be created, it will be removed and be replaced by the device node\&. It is recommended to suffix this entry with an exclamation mark to only create static device nodes at boot, as udev will not manage static device nodes that are created at runtime\&.
14228c0d
MB
155.RE
156.PP
60f067b4 157\fIC\fR
14228c0d 158.RS 4
e842803a
MB
159Recursively copy a file or directory, if the destination files or directories do not exist yet\&. Note that this command will not descend into subdirectories if the destination directory already exists\&. Instead, the entire copy operation is skipped\&. If the argument is omitted, files from the source directory
160/usr/share/factory/
161with the same name are copied\&.
14228c0d
MB
162.RE
163.PP
164\fIx\fR
165.RS 4
60f067b4
JS
166Ignore 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
167\fIr\fR
168or
169\fIR\fR
170lines\&. Lines of this type accept shell\-style globs in place of normal path names\&.
14228c0d
MB
171.RE
172.PP
173\fIX\fR
174.RS 4
60f067b4
JS
175Ignore a path during cleaning\&. Use this type to exclude paths from clean\-up as controlled with the Age parameter\&. Unlike
176\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
177\fIr\fR
178or
179\fIR\fR
180lines\&. Lines of this type accept shell\-style globs in place of normal path names\&.
14228c0d
MB
181.RE
182.PP
183\fIr\fR
184.RS 4
60f067b4
JS
185Remove a file or directory if it exists\&. This may not be used to remove non\-empty directories, use
186\fIR\fR
187for that\&. Lines of this type accept shell\-style globs in place of normal path names\&.
14228c0d
MB
188.RE
189.PP
190\fIR\fR
191.RS 4
192Recursively 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\&.
193.RE
194.PP
195\fIz\fR
196.RS 4
60f067b4 197Adjust 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\&.
14228c0d
MB
198.RE
199.PP
200\fIZ\fR
201.RS 4
60f067b4
JS
202Recursively 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\&.
203.RE
204.PP
205If 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\&.
206\fBsystemd\-tmpfiles\fR
207will execute line with an exclamation mark only if option
208\fB\-\-boot\fR
209is given\&.
210.PP
211For example:
212.sp
213.if n \{\
214.RS 4
215.\}
216.nf
217# Make sure these are created by default so that nobody else can
218d /tmp/\&.X11\-unix 1777 root root 10d
219
220# Unlink the X11 lock files
221r! /tmp/\&.X[0\-9]*\-lock
222.fi
223.if n \{\
14228c0d 224.RE
60f067b4
JS
225.\}
226.sp
227The second line in contrast to the first one would break a running system, and will only be executed with
228\fB\-\-boot\fR\&.
14228c0d
MB
229.SS "Path"
230.PP
231The file system path specification supports simple specifier expansion\&. The following expansions are understood:
232.sp
233.it 1 an-trap
234.nr an-no-space-flag 1
235.nr an-break-flag 1
236.br
237.B Table\ \&1.\ \&Specifiers available
238.TS
239allbox tab(:);
240lB lB lB.
241T{
242Specifier
243T}:T{
244Meaning
245T}:T{
246Details
247T}
248.T&
249l l l
250l l l
251l l l
252l l l
253l l l.
254T{
255"%m"
256T}:T{
257Machine ID
258T}:T{
259The machine ID of the running system, formatted as string\&. See \fBmachine-id\fR(5) for more information\&.
260T}
261T{
262"%b"
263T}:T{
264Boot ID
265T}:T{
266The boot ID of the running system, formatted as string\&. See \fBrandom\fR(4) for more information\&.
267T}
268T{
269"%H"
270T}:T{
271Host name
272T}:T{
273The hostname of the running system\&.
274T}
275T{
276"%v"
277T}:T{
278Kernel release
279T}:T{
280Identical to \fBuname \-r\fR output\&.
281T}
282T{
283"%%"
284T}:T{
285Escaped %
286T}:T{
287Single percent sign\&.
288T}
289.TE
290.sp 1
291.SS "Mode"
292.PP
60f067b4
JS
293The 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
294\fIz\fR,
295\fIZ\fR
296lines, if omitted or when set to
297"\-", the file access mode will not be modified\&. This parameter is ignored for
298\fIx\fR,
299\fIr\fR,
300\fIR\fR,
301\fIL\fR
302lines\&.
303.PP
304Optionally, if prefixed with
e842803a 305"~", 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, all executable bits are removed from the new access mode, too\&. Similarly, 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/SGID bit is removed unless applied to a directory\&. This functionality is particularly useful in conjunction with
60f067b4 306\fIZ\fR\&.
14228c0d
MB
307.SS "UID, GID"
308.PP
60f067b4
JS
309The 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
310"\-", the default 0 (root) is used\&. For
311\fIz\fR,
312\fIZ\fR
313lines, when omitted or when set to \-, the file ownership will not be modified\&. These parameters are ignored for
314\fIx\fR,
315\fIr\fR,
316\fIR\fR,
317\fIL\fR
318lines\&.
14228c0d
MB
319.SS "Age"
320.PP
321The 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:
322.PP
323\fIs\fR, \fImin\fR, \fIh\fR, \fId\fR, \fIw\fR, \fIms\fR, \fIm\fR, \fIus\fR
324.RS 4
325.RE
326.PP
327If multiple integers and units are specified, the time values are summed up\&. If an integer is given without a unit, s is assumed\&.
328.PP
329When the age is set to zero, the files are cleaned unconditionally\&.
330.PP
60f067b4
JS
331The age field only applies to lines starting with
332\fId\fR,
333\fID\fR, and
334\fIx\fR\&. If omitted or set to
335"\-", no automatic clean\-up is done\&.
14228c0d 336.PP
60f067b4
JS
337If the age field starts with a tilde character
338"~", 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\&.
14228c0d
MB
339.SS "Argument"
340.PP
60f067b4
JS
341For
342\fIL\fR
343lines determines the destination path of the symlink\&. For
344\fIc\fR,
345\fIb\fR
346determines the major/minor of the device node, with major and minor formatted as integers, separated by
347":", e\&.g\&.
348"1:3"\&. For
349\fIf\fR,
350\fIF\fR, and
351\fIw\fR
352may be used to specify a short string that is written to the file, suffixed by a newline\&. For
e842803a 353\fIC\fR, specifies the source file or directory\&. Ignored for all other lines\&.
14228c0d
MB
354.SH "EXAMPLE"
355.PP
356\fBExample\ \&1.\ \&/etc/tmpfiles.d/screen.conf example\fR
357.PP
358\fBscreen\fR
359needs two directories created at boot with specific modes and ownership\&.
360.sp
361.if n \{\
362.RS 4
363.\}
364.nf
60f067b4
JS
365d /run/screens 1777 root root 10d
366d /run/uscreens 0755 root root 10d12h
14228c0d
MB
367.fi
368.if n \{\
369.RE
370.\}
371.PP
372\fBExample\ \&2.\ \&/etc/tmpfiles.d/abrt.conf example\fR
373.PP
374\fBabrt\fR
375needs a directory created at boot with specific mode and ownership and its content should be preserved\&.
376.sp
377.if n \{\
378.RS 4
379.\}
380.nf
381d /var/tmp/abrt 0755 abrt abrt
382x /var/tmp/abrt/*
383.fi
384.if n \{\
385.RE
386.\}
387.SH "SEE ALSO"
388.PP
389\fBsystemd\fR(1),
390\fBsystemd-tmpfiles\fR(8),
60f067b4
JS
391\fBsystemd-delta\fR(1),
392\fBsystemd.exec\fR(5)