1SYSTEMD-TMPFILES(8)            systemd-tmpfiles            SYSTEMD-TMPFILES(8)
2
3
4

NAME

6       systemd-tmpfiles, systemd-tmpfiles-setup.service, systemd-tmpfiles-
7       setup-dev.service, systemd-tmpfiles-clean.service, systemd-tmpfiles-
8       clean.timer - Creates, deletes and cleans up volatile and temporary
9       files and directories
10

SYNOPSIS

12       systemd-tmpfiles [OPTIONS...] [CONFIGFILE...]
13
14       System units:
15
16       systemd-tmpfiles-setup.service
17       systemd-tmpfiles-setup-dev.service
18       systemd-tmpfiles-clean.service
19       systemd-tmpfiles-clean.timer
20
21       User units:
22
23       systemd-tmpfiles-setup.service
24       systemd-tmpfiles-clean.service
25       systemd-tmpfiles-clean.timer
26

DESCRIPTION

28       systemd-tmpfiles creates, deletes, and cleans up volatile and temporary
29       files and directories, using the configuration file format and location
30       specified in tmpfiles.d(5). It must be invoked with one or more options
31       --create, --remove, and --clean, to select the respective subset of
32       operations.
33
34       By default, directives from all configuration files are applied. When
35       invoked with --replace=PATH, arguments specified on the command line
36       are used instead of the configuration file PATH. Otherwise, if one or
37       more absolute filenames are passed on the command line, only the
38       directives in these files are applied. If "-" is specified instead of a
39       filename, directives are read from standard input. If only the basename
40       of a configuration file is specified, all configuration directories as
41       specified in tmpfiles.d(5) are searched for a matching file and the
42       file found that has the highest priority is executed.
43
44       System services (systemd-tmpfiles-setup.service,
45       systemd-tmpfiles-setup-dev.service, systemd-tmpfiles-clean.service)
46       invoke systemd-tmpfiles to create system files and to perform system
47       wide cleanup. Those services read administrator-controlled
48       configuration files in tmpfiles.d/ directories. User services
49       (systemd-tmpfiles-setup.service, systemd-tmpfiles-clean.service) also
50       invoke systemd-tmpfiles, but it reads a separate set of files, which
51       includes user-controlled files under ~/.config/user-tmpfiles.d/ and
52       ~/.local/share/user-tmpfiles.d/, and administrator-controlled files
53       under /usr/share/user-tmpfiles.d/. Users may use this to create and
54       clean up files under their control, but the system instance performs
55       global cleanup and is not influenced by user configuration. Note that
56       this means a time-based cleanup configured in the system instance, such
57       as the one typically configured for /tmp/, will thus also affect files
58       created by the user instance if they are placed in /tmp/, even if the
59       user instance's time-based cleanup is turned off.
60
61       To re-apply settings after configuration has been modified, simply
62       restart systemd-tmpfiles-clean.service, which will apply any settings
63       which can be safely executed at runtime. To debug systemd-tmpfiles, it
64       may be useful to invoke it directly from the command line with
65       increased log level (see $SYSTEMD_LOG_LEVEL below).
66

OPTIONS

68       The following options are understood:
69
70       --create
71           If this option is passed, all files and directories marked with f,
72           F, w, d, D, v, p, L, c, b, m in the configuration files are created
73           or written to. Files and directories marked with z, Z, t, T, a, and
74           A have their ownership, access mode and security labels set.
75
76       --clean
77           If this option is passed, all files and directories with an age
78           parameter configured will be cleaned up.
79
80       --remove
81           If this option is passed, the contents of directories marked with D
82           or R, and files or directories themselves marked with r or R are
83           removed.
84
85       --user
86           Execute "user" configuration, i.e.  tmpfiles.d files in user
87           configuration directories.
88
89       --boot
90           Also execute lines with an exclamation mark.
91
92       --prefix=path
93           Only apply rules with paths that start with the specified prefix.
94           This option can be specified multiple times.
95
96       --exclude-prefix=path
97           Ignore rules with paths that start with the specified prefix. This
98           option can be specified multiple times.
99
100       -E
101           A shortcut for "--exclude-prefix=/dev --exclude-prefix=/proc
102           --exclude-prefix=/run --exclude-prefix=/sys", i.e. exclude the
103           hierarchies typically backed by virtual or memory file systems.
104           This is useful in combination with --root=, if the specified
105           directory tree contains an OS tree without these virtual/memory
106           file systems mounted in, as it is typically not desirable to create
107           any files and directories below these subdirectories if they are
108           supposed to be overmounted during runtime.
109
110       --root=root
111           Takes a directory path as an argument. All paths will be prefixed
112           with the given alternate root path, including config search paths.
113
114           When this option is used, the libc Name Service Switch (NSS) is
115           bypassed for resolving users and groups. Instead the files
116           /etc/passwd and /etc/group inside the alternate root are read
117           directly. This means that users/groups not listed in these files
118           will not be resolved, i.e. LDAP NIS and other complex databases are
119           not considered.
120
121           Consider combining this with -E to ensure the invocation does not
122           create files or directories below mount points in the OS image
123           operated on that are typically overmounted during runtime.
124
125       --image=image
126           Takes a path to a disk image file or block device node. If
127           specified all operations are applied to file system in the
128           indicated disk image. This is similar to --root= but operates on
129           file systems stored in disk images or block devices. The disk image
130           should either contain just a file system or a set of file systems
131           within a GPT partition table, following the Discoverable Partitions
132           Specification[1]. For further information on supported disk images,
133           see systemd-nspawn(1)'s switch of the same name.
134
135           Implies -E.
136
137       --replace=PATH
138           When this option is given, one ore more positional arguments must
139           be specified. All configuration files found in the directories
140           listed in tmpfiles.d(5) will be read, and the configuration given
141           on the command line will be handled instead of and with the same
142           priority as the configuration file PATH.
143
144           This option is intended to be used when package installation
145           scripts are running and files belonging to that package are not yet
146           available on disk, so their contents must be given on the command
147           line, but the admin configuration might already exist and should be
148           given higher priority.
149
150       --cat-config
151           Copy the contents of config files to standard output. Before each
152           file, the filename is printed as a comment.
153
154       --no-pager
155           Do not pipe output into a pager.
156
157       -h, --help
158           Print a short help text and exit.
159
160       --version
161           Print a short version string and exit.
162
163       It is possible to combine --create, --clean, and --remove in one
164       invocation (in which case removal and cleanup are executed before
165       creation of new files). For example, during boot the following command
166       line is executed to ensure that all temporary and volatile directories
167       are removed and created according to the configuration file:
168
169           systemd-tmpfiles --remove --create
170

ENVIRONMENT

172       $SYSTEMD_LOG_LEVEL
173           The maximum log level of emitted messages (messages with a higher
174           log level, i.e. less important ones, will be suppressed). Either
175           one of (in order of decreasing importance) emerg, alert, crit, err,
176           warning, notice, info, debug, or an integer in the range 0...7. See
177           syslog(3) for more information.
178
179       $SYSTEMD_LOG_COLOR
180           A boolean. If true, messages written to the tty will be colored
181           according to priority.
182
183           This setting is only useful when messages are written directly to
184           the terminal, because journalctl(1) and other tools that display
185           logs will color messages based on the log level on their own.
186
187       $SYSTEMD_LOG_TIME
188           A boolean. If true, log messages will be prefixed with a timestamp.
189
190           This setting is only useful when messages are written directly to
191           the terminal or a file, because journalctl(1) and other tools that
192           display logs will attach timestamps based on the entry metadata on
193           their own.
194
195       $SYSTEMD_LOG_LOCATION
196           A boolean. If true, messages will be prefixed with a filename and
197           line number in the source code where the message originates.
198
199           Note that the log location is often attached as metadata to journal
200           entries anyway. Including it directly in the message text can
201           nevertheless be convenient when debugging programs.
202
203       $SYSTEMD_LOG_TARGET
204           The destination for log messages. One of console (log to the
205           attached tty), console-prefixed (log to the attached tty but with
206           prefixes encoding the log level and "facility", see syslog(3), kmsg
207           (log to the kernel circular log buffer), journal (log to the
208           journal), journal-or-kmsg (log to the journal if available, and to
209           kmsg otherwise), auto (determine the appropriate log target
210           automatically, the default), null (disable log output).
211
212       $SYSTEMD_PAGER
213           Pager to use when --no-pager is not given; overrides $PAGER. If
214           neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
215           pager implementations are tried in turn, including less(1) and
216           more(1), until one is found. If no pager implementation is
217           discovered no pager is invoked. Setting this environment variable
218           to an empty string or the value "cat" is equivalent to passing
219           --no-pager.
220
221       $SYSTEMD_LESS
222           Override the options passed to less (by default "FRSXMK").
223
224           Users might want to change two options in particular:
225
226           K
227               This option instructs the pager to exit immediately when Ctrl+C
228               is pressed. To allow less to handle Ctrl+C itself to switch
229               back to the pager command prompt, unset this option.
230
231               If the value of $SYSTEMD_LESS does not include "K", and the
232               pager that is invoked is less, Ctrl+C will be ignored by the
233               executable, and needs to be handled by the pager.
234
235           X
236               This option instructs the pager to not send termcap
237               initialization and deinitialization strings to the terminal. It
238               is set by default to allow command output to remain visible in
239               the terminal even after the pager exits. Nevertheless, this
240               prevents some pager functionality from working, in particular
241               paged output cannot be scrolled with the mouse.
242
243           See less(1) for more discussion.
244
245       $SYSTEMD_LESSCHARSET
246           Override the charset passed to less (by default "utf-8", if the
247           invoking terminal is determined to be UTF-8 compatible).
248
249       $SYSTEMD_PAGERSECURE
250           Takes a boolean argument. When true, the "secure" mode of the pager
251           is enabled; if false, disabled. If $SYSTEMD_PAGERSECURE is not set
252           at all, secure mode is enabled if the effective UID is not the same
253           as the owner of the login session, see geteuid(2) and
254           sd_pid_get_owner_uid(3). In secure mode, LESSSECURE=1 will be set
255           when invoking the pager, and the pager shall disable commands that
256           open or create new files or start new subprocesses. When
257           $SYSTEMD_PAGERSECURE is not set at all, pagers which are not known
258           to implement secure mode will not be used. (Currently only less(1)
259           implements secure mode.)
260
261           Note: when commands are invoked with elevated privileges, for
262           example under sudo(8) or pkexec(1), care must be taken to ensure
263           that unintended interactive features are not enabled. "Secure" mode
264           for the pager may be enabled automatically as describe above.
265           Setting SYSTEMD_PAGERSECURE=0 or not removing it from the inherited
266           environment allows the user to invoke arbitrary commands. Note that
267           if the $SYSTEMD_PAGER or $PAGER variables are to be honoured,
268           $SYSTEMD_PAGERSECURE must be set too. It might be reasonable to
269           completely disable the pager using --no-pager instead.
270
271       $SYSTEMD_COLORS
272           Takes a boolean argument. When true, systemd and related utilities
273           will use colors in their output, otherwise the output will be
274           monochrome. Additionally, the variable can take one of the
275           following special values: "16", "256" to restrict the use of colors
276           to the base 16 or 256 ANSI colors, respectively. This can be
277           specified to override the automatic decision based on $TERM and
278           what the console is connected to.
279
280       $SYSTEMD_URLIFY
281           The value must be a boolean. Controls whether clickable links
282           should be generated in the output for terminal emulators supporting
283           this. This can be specified to override the decision that systemd
284           makes based on $TERM and other conditions.
285

UNPRIVILEGED --CLEANUP OPERATION

287       systemd-tmpfiles tries to avoid changing the access and modification
288       times on the directories it accesses, which requires CAP_FOWNER
289       privileges. When running as non-root, directories which are checked for
290       files to clean up will have their access time bumped, which might
291       prevent their cleanup.
292

EXIT STATUS

294       On success, 0 is returned. If the configuration was syntactically
295       invalid (syntax errors, missing arguments, ...), so some lines had to
296       be ignored, but no other errors occurred, 65 is returned (EX_DATAERR
297       from /usr/include/sysexits.h). If the configuration was syntactically
298       valid, but could not be executed (lack of permissions, creation of
299       files in missing directories, invalid contents when writing to /sys/
300       values, ...), 73 is returned (EX_CANTCREAT from
301       /usr/include/sysexits.h). Otherwise, 1 is returned (EXIT_FAILURE from
302       /usr/include/stdlib.h).
303
304       Note: when creating items, if the target already exists, but is of the
305       wrong type or otherwise does not match the requested state, and forced
306       operation has not been requested with "+", a message is emitted, but
307       the failure is otherwise ignored.
308

SEE ALSO

310       systemd(1), tmpfiles.d(5)
311

NOTES

313        1. Discoverable Partitions Specification
314           https://systemd.io/DISCOVERABLE_PARTITIONS
315
316
317
318systemd 248                                                SYSTEMD-TMPFILES(8)
Impressum