]> git.proxmox.com Git - systemd.git/blob - man/systemd.exec.5
Imported Upstream version 217
[systemd.git] / man / systemd.exec.5
1 '\" t
2 .TH "SYSTEMD\&.EXEC" "5" "" "systemd 217" "systemd.exec"
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 systemd.exec \- Execution environment configuration
24 .SH "SYNOPSIS"
25 .PP
26 \fIservice\fR\&.service,
27 \fIsocket\fR\&.socket,
28 \fImount\fR\&.mount,
29 \fIswap\fR\&.swap
30 .SH "DESCRIPTION"
31 .PP
32 Unit configuration files for services, sockets, mount points, and swap devices share a subset of configuration options which define the execution environment of spawned processes\&.
33 .PP
34 This man page lists the configuration options shared by these four unit types\&. See
35 \fBsystemd.unit\fR(5)
36 for the common options of all unit configuration files, and
37 \fBsystemd.service\fR(5),
38 \fBsystemd.socket\fR(5),
39 \fBsystemd.swap\fR(5), and
40 \fBsystemd.mount\fR(5)
41 for more information on the specific unit configuration files\&. The execution specific configuration options are configured in the [Service], [Socket], [Mount], or [Swap] sections, depending on the unit type\&.
42 .SH "OPTIONS"
43 .PP
44 \fIWorkingDirectory=\fR
45 .RS 4
46 Takes an absolute directory path\&. Sets the working directory for executed processes\&. If not set, defaults to the root directory when systemd is running as a system instance and the respective user\*(Aqs home directory if run as user\&.
47 .RE
48 .PP
49 \fIRootDirectory=\fR
50 .RS 4
51 Takes an absolute directory path\&. Sets the root directory for executed processes, with the
52 \fBchroot\fR(2)
53 system call\&. If this is used, it must be ensured that the process and all its auxiliary files are available in the
54 \fBchroot()\fR
55 jail\&.
56 .RE
57 .PP
58 \fIUser=\fR, \fIGroup=\fR
59 .RS 4
60 Sets the Unix user or group that the processes are executed as, respectively\&. Takes a single user or group name or ID as argument\&. If no group is set, the default group of the user is chosen\&.
61 .RE
62 .PP
63 \fISupplementaryGroups=\fR
64 .RS 4
65 Sets the supplementary Unix groups the processes are executed as\&. This takes a space\-separated list of group names or IDs\&. This option may be specified more than once in which case all listed groups are set as supplementary groups\&. When the empty string is assigned the list of supplementary groups is reset, and all assignments prior to this one will have no effect\&. In any way, this option does not override, but extends the list of supplementary groups configured in the system group database for the user\&.
66 .RE
67 .PP
68 \fINice=\fR
69 .RS 4
70 Sets the default nice level (scheduling priority) for executed processes\&. Takes an integer between \-20 (highest priority) and 19 (lowest priority)\&. See
71 \fBsetpriority\fR(2)
72 for details\&.
73 .RE
74 .PP
75 \fIOOMScoreAdjust=\fR
76 .RS 4
77 Sets the adjustment level for the Out\-Of\-Memory killer for executed processes\&. Takes an integer between \-1000 (to disable OOM killing for this process) and 1000 (to make killing of this process under memory pressure very likely)\&. See
78 \m[blue]\fBproc\&.txt\fR\m[]\&\s-2\u[1]\d\s+2
79 for details\&.
80 .RE
81 .PP
82 \fIIOSchedulingClass=\fR
83 .RS 4
84 Sets the IO scheduling class for executed processes\&. Takes an integer between 0 and 3 or one of the strings
85 \fBnone\fR,
86 \fBrealtime\fR,
87 \fBbest\-effort\fR
88 or
89 \fBidle\fR\&. See
90 \fBioprio_set\fR(2)
91 for details\&.
92 .RE
93 .PP
94 \fIIOSchedulingPriority=\fR
95 .RS 4
96 Sets the IO scheduling priority for executed processes\&. Takes an integer between 0 (highest priority) and 7 (lowest priority)\&. The available priorities depend on the selected IO scheduling class (see above)\&. See
97 \fBioprio_set\fR(2)
98 for details\&.
99 .RE
100 .PP
101 \fICPUSchedulingPolicy=\fR
102 .RS 4
103 Sets the CPU scheduling policy for executed processes\&. Takes one of
104 \fBother\fR,
105 \fBbatch\fR,
106 \fBidle\fR,
107 \fBfifo\fR
108 or
109 \fBrr\fR\&. See
110 \fBsched_setscheduler\fR(2)
111 for details\&.
112 .RE
113 .PP
114 \fICPUSchedulingPriority=\fR
115 .RS 4
116 Sets the CPU scheduling priority for executed processes\&. The available priority range depends on the selected CPU scheduling policy (see above)\&. For real\-time scheduling policies an integer between 1 (lowest priority) and 99 (highest priority) can be used\&. See
117 \fBsched_setscheduler\fR(2)
118 for details\&.
119 .RE
120 .PP
121 \fICPUSchedulingResetOnFork=\fR
122 .RS 4
123 Takes a boolean argument\&. If true, elevated CPU scheduling priorities and policies will be reset when the executed processes fork, and can hence not leak into child processes\&. See
124 \fBsched_setscheduler\fR(2)
125 for details\&. Defaults to false\&.
126 .RE
127 .PP
128 \fICPUAffinity=\fR
129 .RS 4
130 Controls the CPU affinity of the executed processes\&. Takes a space\-separated list of CPU indices\&. This option may be specified more than once in which case the specificed CPU affinity masks are merged\&. If the empty string is assigned, the mask is reset, all assignments prior to this will have no effect\&. See
131 \fBsched_setaffinity\fR(2)
132 for details\&.
133 .RE
134 .PP
135 \fIUMask=\fR
136 .RS 4
137 Controls the file mode creation mask\&. Takes an access mode in octal notation\&. See
138 \fBumask\fR(2)
139 for details\&. Defaults to 0022\&.
140 .RE
141 .PP
142 \fIEnvironment=\fR
143 .RS 4
144 Sets environment variables for executed processes\&. Takes a space\-separated list of variable assignments\&. This option may be specified more than once in which case all listed variables will be set\&. If the same variable is set twice, the later setting will override the earlier setting\&. If the empty string is assigned to this option, the list of environment variables is reset, all prior assignments have no effect\&. Variable expansion is not performed inside the strings, however, specifier expansion is possible\&. The $ character has no special meaning\&. If you need to assign a value containing spaces to a variable, use double quotes (") for the assignment\&.
145 .sp
146 Example:
147 .sp
148 .if n \{\
149 .RS 4
150 .\}
151 .nf
152 Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
153 .fi
154 .if n \{\
155 .RE
156 .\}
157 .sp
158 gives three variables
159 "VAR1",
160 "VAR2",
161 "VAR3"
162 with the values
163 "word1 word2",
164 "word3",
165 "$word 5 6"\&.
166 .sp
167 See
168 \fBenviron\fR(7)
169 for details about environment variables\&.
170 .RE
171 .PP
172 \fIEnvironmentFile=\fR
173 .RS 4
174 Similar to
175 \fIEnvironment=\fR
176 but reads the environment variables from a text file\&. The text file should contain new\-line\-separated variable assignments\&. Empty lines and lines starting with ; or # will be ignored, which may be used for commenting\&. A line ending with a backslash will be concatenated with the following one, allowing multiline variable definitions\&. The parser strips leading and trailing whitespace from the values of assignments, unless you use double quotes (")\&.
177 .sp
178 The argument passed should be an absolute filename or wildcard expression, optionally prefixed with
179 "\-", which indicates that if the file does not exist, it will not be read and no error or warning message is logged\&. This option may be specified more than once in which case all specified files are read\&. If the empty string is assigned to this option, the list of file to read is reset, all prior assignments have no effect\&.
180 .sp
181 The files listed with this directive will be read shortly before the process is executed (more specifically, after all processes from a previous unit state terminated\&. This means you can generate these files in one unit state, and read it with this option in the next)\&. Settings from these files override settings made with
182 \fIEnvironment=\fR\&. If the same variable is set twice from these files, the files will be read in the order they are specified and the later setting will override the earlier setting\&.
183 .RE
184 .PP
185 \fIStandardInput=\fR
186 .RS 4
187 Controls where file descriptor 0 (STDIN) of the executed processes is connected to\&. Takes one of
188 \fBnull\fR,
189 \fBtty\fR,
190 \fBtty\-force\fR,
191 \fBtty\-fail\fR
192 or
193 \fBsocket\fR\&.
194 .sp
195 If
196 \fBnull\fR
197 is selected, standard input will be connected to
198 /dev/null, i\&.e\&. all read attempts by the process will result in immediate EOF\&.
199 .sp
200 If
201 \fBtty\fR
202 is selected, standard input is connected to a TTY (as configured by
203 \fITTYPath=\fR, see below) and the executed process becomes the controlling process of the terminal\&. If the terminal is already being controlled by another process, the executed process waits until the current controlling process releases the terminal\&.
204 .sp
205 \fBtty\-force\fR
206 is similar to
207 \fBtty\fR, but the executed process is forcefully and immediately made the controlling process of the terminal, potentially removing previous controlling processes from the terminal\&.
208 .sp
209 \fBtty\-fail\fR
210 is similar to
211 \fBtty\fR
212 but if the terminal already has a controlling process start\-up of the executed process fails\&.
213 .sp
214 The
215 \fBsocket\fR
216 option is only valid in socket\-activated services, and only when the socket configuration file (see
217 \fBsystemd.socket\fR(5)
218 for details) specifies a single socket only\&. If this option is set, standard input will be connected to the socket the service was activated from, which is primarily useful for compatibility with daemons designed for use with the traditional
219 \fBinetd\fR(8)
220 daemon\&.
221 .sp
222 This setting defaults to
223 \fBnull\fR\&.
224 .RE
225 .PP
226 \fIStandardOutput=\fR
227 .RS 4
228 Controls where file descriptor 1 (STDOUT) of the executed processes is connected to\&. Takes one of
229 \fBinherit\fR,
230 \fBnull\fR,
231 \fBtty\fR,
232 \fBjournal\fR,
233 \fBsyslog\fR,
234 \fBkmsg\fR,
235 \fBjournal+console\fR,
236 \fBsyslog+console\fR,
237 \fBkmsg+console\fR
238 or
239 \fBsocket\fR\&.
240 .sp
241 \fBinherit\fR
242 duplicates the file descriptor of standard input for standard output\&.
243 .sp
244 \fBnull\fR
245 connects standard output to
246 /dev/null, i\&.e\&. everything written to it will be lost\&.
247 .sp
248 \fBtty\fR
249 connects standard output to a tty (as configured via
250 \fITTYPath=\fR, see below)\&. If the TTY is used for output only, the executed process will not become the controlling process of the terminal, and will not fail or wait for other processes to release the terminal\&.
251 .sp
252 \fBjournal\fR
253 connects standard output with the journal which is accessible via
254 \fBjournalctl\fR(1)\&. Note that everything that is written to syslog or kmsg (see below) is implicitly stored in the journal as well, the specific two options listed below are hence supersets of this one\&.
255 .sp
256 \fBsyslog\fR
257 connects standard output to the
258 \fBsyslog\fR(3)
259 system syslog service, in addition to the journal\&. Note that the journal daemon is usually configured to forward everything it receives to syslog anyway, in which case this option is no different from
260 \fBjournal\fR\&.
261 .sp
262 \fBkmsg\fR
263 connects standard output with the kernel log buffer which is accessible via
264 \fBdmesg\fR(1), in addition to the journal\&. The journal daemon might be configured to send all logs to kmsg anyway, in which case this option is no different from
265 \fBjournal\fR\&.
266 .sp
267 \fBjournal+console\fR,
268 \fBsyslog+console\fR
269 and
270 \fBkmsg+console\fR
271 work in a similar way as the three options above but copy the output to the system console as well\&.
272 .sp
273 \fBsocket\fR
274 connects standard output to a socket acquired via socket activation\&. The semantics are similar to the same option of
275 \fIStandardInput=\fR\&.
276 .sp
277 This setting defaults to the value set with
278 \fBDefaultStandardOutput=\fR
279 in
280 \fBsystemd-system.conf\fR(5), which defaults to
281 \fBjournal\fR\&.
282 .RE
283 .PP
284 \fIStandardError=\fR
285 .RS 4
286 Controls where file descriptor 2 (STDERR) of the executed processes is connected to\&. The available options are identical to those of
287 \fIStandardOutput=\fR, with one exception: if set to
288 \fBinherit\fR
289 the file descriptor used for standard output is duplicated for standard error\&. This setting defaults to the value set with
290 \fBDefaultStandardError=\fR
291 in
292 \fBsystemd-system.conf\fR(5), which defaults to
293 \fBinherit\fR\&.
294 .RE
295 .PP
296 \fITTYPath=\fR
297 .RS 4
298 Sets the terminal device node to use if standard input, output, or error are connected to a TTY (see above)\&. Defaults to
299 /dev/console\&.
300 .RE
301 .PP
302 \fITTYReset=\fR
303 .RS 4
304 Reset the terminal device specified with
305 \fITTYPath=\fR
306 before and after execution\&. Defaults to
307 "no"\&.
308 .RE
309 .PP
310 \fITTYVHangup=\fR
311 .RS 4
312 Disconnect all clients which have opened the terminal device specified with
313 \fITTYPath=\fR
314 before and after execution\&. Defaults to
315 "no"\&.
316 .RE
317 .PP
318 \fITTYVTDisallocate=\fR
319 .RS 4
320 If the terminal device specified with
321 \fITTYPath=\fR
322 is a virtual console terminal, try to deallocate the TTY before and after execution\&. This ensures that the screen and scrollback buffer is cleared\&. Defaults to
323 "no"\&.
324 .RE
325 .PP
326 \fISyslogIdentifier=\fR
327 .RS 4
328 Sets the process name to prefix log lines sent to the logging system or the kernel log buffer with\&. If not set, defaults to the process name of the executed process\&. This option is only useful when
329 \fIStandardOutput=\fR
330 or
331 \fIStandardError=\fR
332 are set to
333 \fBsyslog\fR,
334 \fBjournal\fR
335 or
336 \fBkmsg\fR
337 (or to the same settings in combination with
338 \fB+console\fR)\&.
339 .RE
340 .PP
341 \fISyslogFacility=\fR
342 .RS 4
343 Sets the syslog facility to use when logging to syslog\&. One of
344 \fBkern\fR,
345 \fBuser\fR,
346 \fBmail\fR,
347 \fBdaemon\fR,
348 \fBauth\fR,
349 \fBsyslog\fR,
350 \fBlpr\fR,
351 \fBnews\fR,
352 \fBuucp\fR,
353 \fBcron\fR,
354 \fBauthpriv\fR,
355 \fBftp\fR,
356 \fBlocal0\fR,
357 \fBlocal1\fR,
358 \fBlocal2\fR,
359 \fBlocal3\fR,
360 \fBlocal4\fR,
361 \fBlocal5\fR,
362 \fBlocal6\fR
363 or
364 \fBlocal7\fR\&. See
365 \fBsyslog\fR(3)
366 for details\&. This option is only useful when
367 \fIStandardOutput=\fR
368 or
369 \fIStandardError=\fR
370 are set to
371 \fBsyslog\fR\&. Defaults to
372 \fBdaemon\fR\&.
373 .RE
374 .PP
375 \fISyslogLevel=\fR
376 .RS 4
377 Default syslog level to use when logging to syslog or the kernel log buffer\&. One of
378 \fBemerg\fR,
379 \fBalert\fR,
380 \fBcrit\fR,
381 \fBerr\fR,
382 \fBwarning\fR,
383 \fBnotice\fR,
384 \fBinfo\fR,
385 \fBdebug\fR\&. See
386 \fBsyslog\fR(3)
387 for details\&. This option is only useful when
388 \fIStandardOutput=\fR
389 or
390 \fIStandardError=\fR
391 are set to
392 \fBsyslog\fR
393 or
394 \fBkmsg\fR\&. Note that individual lines output by the daemon might be prefixed with a different log level which can be used to override the default log level specified here\&. The interpretation of these prefixes may be disabled with
395 \fISyslogLevelPrefix=\fR, see below\&. For details see
396 \fBsd-daemon\fR(3)\&. Defaults to
397 \fBinfo\fR\&.
398 .RE
399 .PP
400 \fISyslogLevelPrefix=\fR
401 .RS 4
402 Takes a boolean argument\&. If true and
403 \fIStandardOutput=\fR
404 or
405 \fIStandardError=\fR
406 are set to
407 \fBsyslog\fR,
408 \fBkmsg\fR
409 or
410 \fBjournal\fR, log lines written by the executed process that are prefixed with a log level will be passed on to syslog with this log level set but the prefix removed\&. If set to false, the interpretation of these prefixes is disabled and the logged lines are passed on as\-is\&. For details about this prefixing see
411 \fBsd-daemon\fR(3)\&. Defaults to true\&.
412 .RE
413 .PP
414 \fITimerSlackNSec=\fR
415 .RS 4
416 Sets the timer slack in nanoseconds for the executed processes\&. The timer slack controls the accuracy of wake\-ups triggered by timers\&. See
417 \fBprctl\fR(2)
418 for more information\&. Note that in contrast to most other time span definitions this parameter takes an integer value in nano\-seconds if no unit is specified\&. The usual time units are understood too\&.
419 .RE
420 .PP
421 \fILimitCPU=\fR, \fILimitFSIZE=\fR, \fILimitDATA=\fR, \fILimitSTACK=\fR, \fILimitCORE=\fR, \fILimitRSS=\fR, \fILimitNOFILE=\fR, \fILimitAS=\fR, \fILimitNPROC=\fR, \fILimitMEMLOCK=\fR, \fILimitLOCKS=\fR, \fILimitSIGPENDING=\fR, \fILimitMSGQUEUE=\fR, \fILimitNICE=\fR, \fILimitRTPRIO=\fR, \fILimitRTTIME=\fR
422 .RS 4
423 These settings control various resource limits for executed processes\&. See
424 \fBsetrlimit\fR(2)
425 for details\&. Use the string
426 \fIinfinity\fR
427 to configure no limit on a specific resource\&.
428 .RE
429 .PP
430 \fIPAMName=\fR
431 .RS 4
432 Sets the PAM service name to set up a session as\&. If set, the executed process will be registered as a PAM session under the specified service name\&. This is only useful in conjunction with the
433 \fIUser=\fR
434 setting\&. If not set, no PAM session will be opened for the executed processes\&. See
435 \fBpam\fR(8)
436 for details\&.
437 .RE
438 .PP
439 \fICapabilityBoundingSet=\fR
440 .RS 4
441 Controls which capabilities to include in the capability bounding set for the executed process\&. See
442 \fBcapabilities\fR(7)
443 for details\&. Takes a whitespace\-separated list of capability names as read by
444 \fBcap_from_name\fR(3), e\&.g\&.
445 \fBCAP_SYS_ADMIN\fR,
446 \fBCAP_DAC_OVERRIDE\fR,
447 \fBCAP_SYS_PTRACE\fR\&. Capabilities listed will be included in the bounding set, all others are removed\&. If the list of capabilities is prefixed with
448 "~", all but the listed capabilities will be included, the effect of the assignment inverted\&. Note that this option also affects the respective capabilities in the effective, permitted and inheritable capability sets, on top of what
449 \fICapabilities=\fR
450 does\&. If this option is not used, the capability bounding set is not modified on process execution, hence no limits on the capabilities of the process are enforced\&. This option may appear more than once in which case the bounding sets are merged\&. If the empty string is assigned to this option, the bounding set is reset to the empty capability set, and all prior settings have no effect\&. If set to
451 "~"
452 (without any further argument), the bounding set is reset to the full set of available capabilities, also undoing any previous settings\&.
453 .RE
454 .PP
455 \fISecureBits=\fR
456 .RS 4
457 Controls the secure bits set for the executed process\&. Takes a space\-separated combination of options from the following list:
458 \fBkeep\-caps\fR,
459 \fBkeep\-caps\-locked\fR,
460 \fBno\-setuid\-fixup\fR,
461 \fBno\-setuid\-fixup\-locked\fR,
462 \fBnoroot\fR, and
463 \fBnoroot\-locked\fR\&. This option may appear more than once in which case the secure bits are ORed\&. If the empty string is assigned to this option, the bits are reset to 0\&. See
464 \fBcapabilities\fR(7)
465 for details\&.
466 .RE
467 .PP
468 \fICapabilities=\fR
469 .RS 4
470 Controls the
471 \fBcapabilities\fR(7)
472 set for the executed process\&. Take a capability string describing the effective, permitted and inherited capability sets as documented in
473 \fBcap_from_text\fR(3)\&. Note that these capability sets are usually influenced (and filtered) by the capabilities attached to the executed file\&. Due to that
474 \fICapabilityBoundingSet=\fR
475 is probably a much more useful setting\&.
476 .RE
477 .PP
478 \fIReadWriteDirectories=\fR, \fIReadOnlyDirectories=\fR, \fIInaccessibleDirectories=\fR
479 .RS 4
480 Sets up a new file system namespace for executed processes\&. These options may be used to limit access a process might have to the main file system hierarchy\&. Each setting takes a space\-separated list of absolute directory paths\&. Directories listed in
481 \fIReadWriteDirectories=\fR
482 are accessible from within the namespace with the same access rights as from outside\&. Directories listed in
483 \fIReadOnlyDirectories=\fR
484 are accessible for reading only, writing will be refused even if the usual file access controls would permit this\&. Directories listed in
485 \fIInaccessibleDirectories=\fR
486 will be made inaccessible for processes inside the namespace\&. Note that restricting access with these options does not extend to submounts of a directory that are created later on\&. These options may be specified more than once in which case all directories listed will have limited access from within the namespace\&. If the empty string is assigned to this option, the specific list is reset, and all prior assignments have no effect\&.
487 .sp
488 Paths in
489 \fIReadOnlyDirectories=\fR
490 and
491 \fIInaccessibleDirectories=\fR
492 may be prefixed with
493 "\-", in which case they will be ignored when they do not exist\&. Note that using this setting will disconnect propagation of mounts from the service to the host (propagation in the opposite direction continues to work)\&. This means that this setting may not be used for services which shall be able to install mount points in the main mount namespace\&.
494 .RE
495 .PP
496 \fIPrivateTmp=\fR
497 .RS 4
498 Takes a boolean argument\&. If true, sets up a new file system namespace for the executed processes and mounts private
499 /tmp
500 and
501 /var/tmp
502 directories inside it that is not shared by processes outside of the namespace\&. This is useful to secure access to temporary files of the process, but makes sharing between processes via
503 /tmp
504 or
505 /var/tmp
506 impossible\&. If this is enabled, all temporary files created by a service in these directories will be removed after the service is stopped\&. Defaults to false\&. It is possible to run two or more units within the same private
507 /tmp
508 and
509 /var/tmp
510 namespace by using the
511 \fIJoinsNamespaceOf=\fR
512 directive, see
513 \fBsystemd.unit\fR(5)
514 for details\&. Note that using this setting will disconnect propagation of mounts from the service to the host (propagation in the opposite direction continues to work)\&. This means that this setting may not be used for services which shall be able to install mount points in the main mount namespace\&.
515 .RE
516 .PP
517 \fIPrivateDevices=\fR
518 .RS 4
519 Takes a boolean argument\&. If true, sets up a new /dev namespace for the executed processes and only adds API pseudo devices such as
520 /dev/null,
521 /dev/zero
522 or
523 /dev/random
524 (as well as the pseudo TTY subsystem) to it, but no physical devices such as
525 /dev/sda\&. This is useful to securely turn off physical device access by the executed process\&. Defaults to false\&. Enabling this option will also remove
526 \fBCAP_MKNOD\fR
527 from the capability bounding set for the unit (see above), and set
528 \fIDevicePolicy=closed\fR
529 (see
530 \fBsystemd.resource-control\fR(5)
531 for details)\&. Note that using this setting will disconnect propagation of mounts from the service to the host (propagation in the opposite direction continues to work)\&. This means that this setting may not be used for services which shall be able to install mount points in the main mount namespace\&.
532 .RE
533 .PP
534 \fIPrivateNetwork=\fR
535 .RS 4
536 Takes a boolean argument\&. If true, sets up a new network namespace for the executed processes and configures only the loopback network device
537 "lo"
538 inside it\&. No other network devices will be available to the executed process\&. This is useful to securely turn off network access by the executed process\&. Defaults to false\&. It is possible to run two or more units within the same private network namespace by using the
539 \fIJoinsNamespaceOf=\fR
540 directive, see
541 \fBsystemd.unit\fR(5)
542 for details\&. Note that this option will disconnect all socket families from the host, this includes AF_NETLINK and AF_UNIX\&. The latter has the effect that AF_UNIX sockets in the abstract socket namespace will become unavailable to the processes (however, those located in the file system will continue to be accessible)\&.
543 .RE
544 .PP
545 \fIProtectSystem=\fR
546 .RS 4
547 Takes a boolean argument or
548 "full"\&. If true, mounts the
549 /usr
550 directory read\-only for processes invoked by this unit\&. If set to
551 "full", the
552 /etc
553 directory is mounted read\-only, too\&. This setting ensures that any modification of the vendor supplied operating system (and optionally its configuration) is prohibited for the service\&. It is recommended to enable this setting for all long\-running services, unless they are involved with system updates or need to modify the operating system in other ways\&. Note however that processes retaining the CAP_SYS_ADMIN capability can undo the effect of this setting\&. This setting is hence particularly useful for daemons which have this capability removed, for example with
554 \fICapabilityBoundingSet=\fR\&. Defaults to off\&.
555 .RE
556 .PP
557 \fIProtectHome=\fR
558 .RS 4
559 Takes a boolean argument or
560 "read\-only"\&. If true, the directories
561 /home
562 and
563 /run/user
564 are made inaccessible and empty for processes invoked by this unit\&. If set to
565 "read\-only", the two directories are made read\-only instead\&. It is recommended to enable this setting for all long\-running services (in particular network\-facing ones), to ensure they cannot get access to private user data, unless the services actually require access to the user\*(Aqs private data\&. Note however that processes retaining the CAP_SYS_ADMIN capability can undo the effect of this setting\&. This setting is hence particularly useful for daemons which have this capability removed, for example with
566 \fICapabilityBoundingSet=\fR\&. Defaults to off\&.
567 .RE
568 .PP
569 \fIMountFlags=\fR
570 .RS 4
571 Takes a mount propagation flag:
572 \fBshared\fR,
573 \fBslave\fR
574 or
575 \fBprivate\fR, which control whether mounts in the file system namespace set up for this unit\*(Aqs processes will receive or propagate mounts or unmounts\&. See
576 \fBmount\fR(2)
577 for details\&. Defaults to
578 \fBshared\fR\&. Use
579 \fBshared\fR
580 to ensure that mounts and unmounts are propagated from the host to the container and vice versa\&. Use
581 \fBslave\fR
582 to run processes so that none of their mounts and unmounts will propagate to the host\&. Use
583 \fBprivate\fR
584 to also ensure that no mounts and unmounts from the host will propagate into the unit processes\*(Aq namespace\&. Note that
585 \fBslave\fR
586 means that file systems mounted on the host might stay mounted continuously in the unit\*(Aqs namespace, and thus keep the device busy\&. Note that the file system namespace related options (\fIPrivateTmp=\fR,
587 \fIPrivateDevices=\fR,
588 \fIProtectSystem=\fR,
589 \fIProtectHome=\fR,
590 \fIReadOnlyDirectories=\fR,
591 \fIInaccessibleDirectories=\fR
592 and
593 \fIReadWriteDirectories=\fR) require that mount and unmount propagation from the unit\*(Aqs file system namespace is disabled, and hence downgrade
594 \fBshared\fR
595 to
596 \fBslave\fR\&.
597 .RE
598 .PP
599 \fIUtmpIdentifier=\fR
600 .RS 4
601 Takes a four character identifier string for an utmp/wtmp entry for this service\&. This should only be set for services such as
602 \fBgetty\fR
603 implementations where utmp/wtmp entries must be created and cleared before and after execution\&. If the configured string is longer than four characters, it is truncated and the terminal four characters are used\&. This setting interprets %I style string replacements\&. This setting is unset by default, i\&.e\&. no utmp/wtmp entries are created or cleaned up for this service\&.
604 .RE
605 .PP
606 \fISELinuxContext=\fR
607 .RS 4
608 Set the SELinux security context of the executed process\&. If set, this will override the automated domain transition\&. However, the policy still needs to autorize the transition\&. This directive is ignored if SELinux is disabled\&. If prefixed by
609 "\-", all errors will be ignored\&. See
610 \fBsetexeccon\fR(3)
611 for details\&.
612 .RE
613 .PP
614 \fIAppArmorProfile=\fR
615 .RS 4
616 Takes a profile name as argument\&. The process executed by the unit will switch to this profile when started\&. Profiles must already be loaded in the kernel, or the unit will fail\&. This result in a non operation if AppArmor is not enabled\&. If prefixed by
617 "\-", all errors will be ignored\&.
618 .RE
619 .PP
620 \fIIgnoreSIGPIPE=\fR
621 .RS 4
622 Takes a boolean argument\&. If true, causes
623 \fBSIGPIPE\fR
624 to be ignored in the executed process\&. Defaults to true because
625 \fBSIGPIPE\fR
626 generally is useful only in shell pipelines\&.
627 .RE
628 .PP
629 \fINoNewPrivileges=\fR
630 .RS 4
631 Takes a boolean argument\&. If true, ensures that the service process and all its children can never gain new privileges\&. This option is more powerful than the respective secure bits flags (see above), as it also prohibits UID changes of any kind\&. This is the simplest, most effective way to ensure that a process and its children can never elevate privileges again\&.
632 .RE
633 .PP
634 \fISystemCallFilter=\fR
635 .RS 4
636 Takes a space\-separated list of system call names\&. If this setting is used, all system calls executed by the unit processes except for the listed ones will result in immediate process termination with the
637 \fBSIGSYS\fR
638 signal (whitelisting)\&. If the first character of the list is
639 "~", the effect is inverted: only the listed system calls will result in immediate process termination (blacklisting)\&. If running in user mode and this option is used,
640 \fINoNewPrivileges=yes\fR
641 is implied\&. This feature makes use of the Secure Computing Mode 2 interfaces of the kernel (\*(Aqseccomp filtering\*(Aq) and is useful for enforcing a minimal sandboxing environment\&. Note that the
642 \fBexecve\fR,
643 \fBrt_sigreturn\fR,
644 \fBsigreturn\fR,
645 \fBexit_group\fR,
646 \fBexit\fR
647 system calls are implicitly whitelisted and do not need to be listed explicitly\&. This option may be specified more than once in which case the filter masks are merged\&. If the empty string is assigned, the filter is reset, all prior assignments will have no effect\&.
648 .sp
649 If you specify both types of this option (i\&.e\&. whitelisting and blacklisting), the first encountered will take precedence and will dictate the default action (termination or approval of a system call)\&. Then the next occurrences of this option will add or delete the listed system calls from the set of the filtered system calls, depending of its type and the default action\&. (For example, if you have started with a whitelisting of
650 \fBread\fR
651 and
652 \fBwrite\fR, and right after it add a blacklisting of
653 \fBwrite\fR, then
654 \fBwrite\fR
655 will be removed from the set\&.)
656 .RE
657 .PP
658 \fISystemCallErrorNumber=\fR
659 .RS 4
660 Takes an
661 "errno"
662 error number name to return when the system call filter configured with
663 \fISystemCallFilter=\fR
664 is triggered, instead of terminating the process immediately\&. Takes an error name such as
665 \fBEPERM\fR,
666 \fBEACCES\fR
667 or
668 \fBEUCLEAN\fR\&. When this setting is not used, or when the empty string is assigned, the process will be terminated immediately when the filter is triggered\&.
669 .RE
670 .PP
671 \fISystemCallArchitectures=\fR
672 .RS 4
673 Takes a space separated list of architecture identifiers to include in the system call filter\&. The known architecture identifiers are
674 \fBx86\fR,
675 \fBx86\-64\fR,
676 \fBx32\fR,
677 \fBarm\fR
678 as well as the special identifier
679 \fBnative\fR\&. Only system calls of the specified architectures will be permitted to processes of this unit\&. This is an effective way to disable compatibility with non\-native architectures for processes, for example to prohibit execution of 32\-bit x86 binaries on 64\-bit x86\-64 systems\&. The special
680 \fBnative\fR
681 identifier implicitly maps to the native architecture of the system (or more strictly: to the architecture the system manager is compiled for)\&. If running in user mode and this option is used,
682 \fINoNewPrivileges=yes\fR
683 is implied\&. Note that setting this option to a non\-empty list implies that
684 \fBnative\fR
685 is included too\&. By default, this option is set to the empty list, i\&.e\&. no architecture system call filtering is applied\&.
686 .RE
687 .PP
688 \fIRestrictAddressFamilies=\fR
689 .RS 4
690 Restricts the set of socket address families accessible to the processes of this unit\&. Takes a space\-separated list of address family names to whitelist, such as
691 \fBAF_UNIX\fR,
692 \fBAF_INET\fR
693 or
694 \fBAF_INET6\fR\&. When prefixed with
695 \fB~\fR
696 the listed address families will be applied as blacklist, otherwise as whitelist\&. Note that this restricts access to the
697 \fBsocket\fR(2)
698 system call only\&. Sockets passed into the process by other means (for example, by using socket activation with socket units, see
699 \fBsystemd.socket\fR(5)) are unaffected\&. Also, sockets created with
700 \fBsocketpair()\fR
701 (which creates connected AF_UNIX sockets only) are unaffected\&. Note that this option has no effect on 32\-bit x86 and is ignored (but works correctly on x86\-64)\&. If running in user mode and this option is used,
702 \fINoNewPrivileges=yes\fR
703 is implied\&. By default, no restriction applies, all address families are accessible to processes\&. If assigned the empty string, any previous list changes are undone\&.
704 .sp
705 Use this option to limit exposure of processes to remote systems, in particular via exotic network protocols\&. Note that in most cases, the local
706 \fBAF_UNIX\fR
707 address family should be included in the configured whitelist as it is frequently used for local communication, including for
708 \fBsyslog\fR(2)
709 logging\&.
710 .RE
711 .PP
712 \fIPersonality=\fR
713 .RS 4
714 Controls which kernel architecture
715 \fBuname\fR(2)
716 shall report, when invoked by unit processes\&. Takes one of
717 \fBx86\fR
718 and
719 \fBx86\-64\fR\&. This is useful when running 32\-bit services on a 64\-bit host system\&. If not specified, the personality is left unmodified and thus reflects the personality of the host system\*(Aqs kernel\&.
720 .RE
721 .PP
722 \fIRuntimeDirectory=\fR, \fIRuntimeDirectoryMode=\fR
723 .RS 4
724 Takes a list of directory names\&. If set, one or more directories by the specified names will be created below
725 /run
726 (for system services) or below
727 \fI$XDG_RUNTIME_DIR\fR
728 (for user services) when the unit is started, and removed when the unit is stopped\&. The directories will have the access mode specified in
729 \fIRuntimeDirectoryMode=\fR, and will be owned by the user and group specified in
730 \fIUser=\fR
731 and
732 \fIGroup=\fR\&. Use this to manage one or more runtime directories of the unit and bind their lifetime to the daemon runtime\&. The specified directory names must be relative, and may not include a
733 "/", i\&.e\&. must refer to simple directories to create or remove\&. This is particularly useful for unprivileged daemons that cannot create runtime directories in
734 /run
735 due to lack of privileges, and to make sure the runtime directory is cleaned up automatically after use\&. For runtime directories that require more complex or different configuration or lifetime guarantees, please consider using
736 \fBtmpfiles.d\fR(5)\&.
737 .RE
738 .SH "ENVIRONMENT VARIABLES IN SPAWNED PROCESSES"
739 .PP
740 Processes started by the system are executed in a clean environment in which select variables listed below are set\&. System processes started by systemd do not inherit variables from PID 1, but processes started by user systemd instances inherit all environment variables from the user systemd instance\&.
741 .PP
742 \fI$PATH\fR
743 .RS 4
744 Colon\-separated list of directiories to use when launching executables\&. Systemd uses a fixed value of
745 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\&.
746 .RE
747 .PP
748 \fI$LANG\fR
749 .RS 4
750 Locale\&. Can be set in
751 \fBlocale.conf\fR(5)
752 or on the kernel command line (see
753 \fBsystemd\fR(1)
754 and
755 \fBkernel-command-line\fR(7))\&.
756 .RE
757 .PP
758 \fI$USER\fR, \fI$LOGNAME\fR, \fI$HOME\fR, \fI$SHELL\fR
759 .RS 4
760 User name (twice), home directory, and the login shell\&. The variables are set for the units that have
761 \fIUser=\fR
762 set, which includes user
763 \fBsystemd\fR
764 instances\&. See
765 \fBpasswd\fR(5)\&.
766 .RE
767 .PP
768 \fI$XDG_RUNTIME_DIR\fR
769 .RS 4
770 The directory for volatile state\&. Set for the user
771 \fBsystemd\fR
772 instance, and also in user sessions\&. See
773 \fBpam_systemd\fR(8)\&.
774 .RE
775 .PP
776 \fI$XDG_SESSION_ID\fR, \fI$XDG_SEAT\fR, \fI$XDG_VTNR\fR
777 .RS 4
778 The identifier of the session, the seat name, and virtual terminal of the session\&. Set by
779 \fBpam_systemd\fR(8)
780 for login sessions\&.
781 \fI$XDG_SEAT\fR
782 and
783 \fI$XDG_VTNR\fR
784 will only be set when attached to a seat and a tty\&.
785 .RE
786 .PP
787 \fI$MAINPID\fR
788 .RS 4
789 The PID of the units main process if it is known\&. This is only set for control processes as invoked by
790 \fIExecReload=\fR
791 and similar\&.
792 .RE
793 .PP
794 \fI$MANAGERPID\fR
795 .RS 4
796 The PID of the user
797 \fBsystemd\fR
798 instance, set for processes spawned by it\&.
799 .RE
800 .PP
801 \fI$LISTEN_FDS\fR, \fI$LISTEN_PID\fR
802 .RS 4
803 Information about file descriptors passed to a service for socket activation\&. See
804 \fBsd_listen_fds\fR(3)\&.
805 .RE
806 .PP
807 \fI$TERM\fR
808 .RS 4
809 Terminal type, set only for units connected to a terminal (\fIStandardInput=tty\fR,
810 \fIStandardOutput=tty\fR, or
811 \fIStandardError=tty\fR)\&. See
812 \fBtermcap\fR(5)\&.
813 .RE
814 .PP
815 Additional variables may be configured by the following means: for processes spawned in specific units, use the
816 \fIEnvironment=\fR
817 and
818 \fIEnvironmentFile=\fR
819 options above; to specify variables globally, use
820 \fIDefaultEnvironment=\fR
821 (see
822 \fBsystemd-system.conf\fR(5)) or the kernel option
823 \fIsystemd\&.setenv=\fR
824 (see
825 \fBsystemd\fR(1))\&. Additional variables may also be set through PAM, cf\&.\ \&\fBpam_env\fR(8)\&.
826 .SH "SEE ALSO"
827 .PP
828 \fBsystemd\fR(1),
829 \fBsystemctl\fR(1),
830 \fBjournalctl\fR(8),
831 \fBsystemd.unit\fR(5),
832 \fBsystemd.service\fR(5),
833 \fBsystemd.socket\fR(5),
834 \fBsystemd.swap\fR(5),
835 \fBsystemd.mount\fR(5),
836 \fBsystemd.kill\fR(5),
837 \fBsystemd.resource-control\fR(5),
838 \fBsystemd.directives\fR(7),
839 \fBtmpfiles.d\fR(5),
840 \fBexec\fR(3)
841 .SH "NOTES"
842 .IP " 1." 4
843 proc.txt
844 .RS 4
845 \%https://www.kernel.org/doc/Documentation/filesystems/proc.txt
846 .RE