1SYSTEMD-TMPFILES(8) systemd-tmpfiles SYSTEMD-TMPFILES(8)
2
3
4
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
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
28 systemd-tmpfiles creates, deletes, and cleans up volatile and temporary
29 files and directories, based on the configuration file format and
30 location specified in tmpfiles.d(5).
31
32 If invoked with no arguments, it applies all directives from all
33 configuration files. When invoked with --replace=PATH, arguments
34 specified on the command line are used instead of the configuration
35 file PATH. Otherwise, if one or more absolute filenames are passed on
36 the command line, only the directives in these files are applied. If
37 "-" is specified instead of a filename, directives are read from
38 standard input. If only the basename of a configuration file is
39 specified, all configuration directories as specified in tmpfiles.d(5)
40 are searched for a matching file and the file found that has the
41 highest priority is executed.
42
43 System services (systemd-tmpfiles-setup.service,
44 systemd-tmpfiles-setup-dev.service, systemd-tmpfiles-clean.service)
45 invoke systemd-tmpfiles to create system files and to perform system
46 wide cleanup. Those services read administrator-controlled
47 configuration files in tmpfiles.d/ directories. User services
48 (systemd-tmpfiles-setup.service, systemd-tmpfiles-clean.service) also
49 invoke systemd-tmpfiles, but it reads a separate set of files, which
50 includes user-controlled files under ~/.config/user-tmpfiles.d/ and
51 ~/.local/share/user-tmpfiles.d/, and administrator-controlled files
52 under /usr/share/user-tmpfiles.d/. Users may use this to create and
53 clean up files under their control, but the system instance performs
54 global cleanup and is not influenced by user configuration. Note that
55 this means a time-based cleanup configured in the system instance, such
56 as the one typically configured for /tmp, will thus also affect files
57 created by the user instance if they are placed in /tmp, even if the
58 user instance's time-based cleanup is turned off.
59
61 The following options are understood:
62
63 --create
64 If this option is passed, all files and directories marked with f,
65 F, w, d, D, v, p, L, c, b, m in the configuration files are created
66 or written to. Files and directories marked with z, Z, t, T, a, and
67 A have their ownership, access mode and security labels set.
68
69 --clean
70 If this option is passed, all files and directories with an age
71 parameter configured will be cleaned up.
72
73 --remove
74 If this option is passed, the contents of directories marked with D
75 or R, and files or directories themselves marked with r or R are
76 removed.
77
78 --user
79 Execute "user" configuration, i.e. tmpfiles.d files in user
80 configuration directories.
81
82 --boot
83 Also execute lines with an exclamation mark.
84
85 --prefix=path
86 Only apply rules with paths that start with the specified prefix.
87 This option can be specified multiple times.
88
89 --exclude-prefix=path
90 Ignore rules with paths that start with the specified prefix. This
91 option can be specified multiple times.
92
93 --root=root
94 Takes a directory path as an argument. All paths will be prefixed
95 with the given alternate root path, including config search paths.
96
97 When this option is used, the libc Name Service Switch (NSS) is
98 bypassed for resolving users and groups. Instead the files
99 /etc/passwd and /etc/group inside the alternate root are read
100 directly. This means that users/groups not listed in these files
101 will not be resolved, i.e. LDAP NIS and other complex databases are
102 not considered.
103
104 --replace=PATH
105 When this option is given, one ore more positional arguments must
106 be specified. All configuration files found in the directories
107 listed in tmpfiles.d(5) will be read, and the configuration given
108 on the command line will be handled instead of and with the same
109 priority as the configuration file PATH.
110
111 This option is intended to be used when package installation
112 scripts are running and files belonging to that package are not yet
113 available on disk, so their contents must be given on the command
114 line, but the admin configuration might already exist and should be
115 given higher priority.
116
117 --cat-config
118 Copy the contents of config files to standard output. Before each
119 file, the filename is printed as a comment.
120
121 --no-pager
122 Do not pipe output into a pager.
123
124 -h, --help
125 Print a short help text and exit.
126
127 --version
128 Print a short version string and exit.
129
130 It is possible to combine --create, --clean, and --remove in one
131 invocation (in which case removal and cleanup are executed before
132 creation of new files). For example, during boot the following command
133 line is executed to ensure that all temporary and volatile directories
134 are removed and created according to the configuration file:
135
136 systemd-tmpfiles --remove --create
137
139 systemd-tmpfiles tries to avoid changing the access and modification
140 times on the directories it accesses, which requires CAP_FOWNER
141 privileges. When running as non-root, directories which are checked for
142 files to clean up will have their access time bumped, which might
143 prevent their cleanup.
144
146 On success, 0 is returned. If the configuration was syntactically
147 invalid (syntax errors, missing arguments, ...), so some lines had to
148 be ignored, but no other errors occurred, 65 is returned (EX_DATAERR
149 from /usr/include/sysexits.h). If the configuration was syntactically
150 valid, but could not be executed (lack of permissions, creation of
151 files in missing directories, invalid contents when writing to /sys/
152 values, ...), 73 is returned (EX_CANTCREAT from
153 /usr/include/sysexits.h). Otherwise, 1 is returned (EXIT_FAILURE from
154 /usr/include/stdlib.h).
155
157 systemd(1), tmpfiles.d(5)
158
159
160
161systemd 246 SYSTEMD-TMPFILES(8)