]> git.proxmox.com Git - systemd.git/blob - man/systemd.exec.5
Imported Upstream version 218
[systemd.git] / man / systemd.exec.5
1 '\" t
2 .TH "SYSTEMD\&.EXEC" "5" "" "systemd 218" "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 specified 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 set both soft and hard limits of various resources 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 .sp
429 .it 1 an-trap
430 .nr an-no-space-flag 1
431 .nr an-break-flag 1
432 .br
433 .B Table\ \&1.\ \&Limit directives and their equivalent with ulimit
434 .TS
435 allbox tab(:);
436 lB lB.
437 T{
438 Directive
439 T}:T{
440 ulimit equivalent
441 T}
442 .T&
443 l l
444 l l
445 l l
446 l l
447 l l
448 l l
449 l l
450 l l
451 l l
452 l l
453 l l
454 l l
455 l l
456 l l
457 l l
458 l l.
459 T{
460 LimitCPU
461 T}:T{
462 ulimit \-t
463 T}
464 T{
465 LimitFSIZE
466 T}:T{
467 ulimit \-f
468 T}
469 T{
470 LimitDATA
471 T}:T{
472 ulimit \-d
473 T}
474 T{
475 LimitSTACK
476 T}:T{
477 ulimit \-s
478 T}
479 T{
480 LimitCORE
481 T}:T{
482 ulimit \-c
483 T}
484 T{
485 LimitRSS
486 T}:T{
487 ulimit \-m
488 T}
489 T{
490 LimitNOFILE
491 T}:T{
492 ulimit \-n
493 T}
494 T{
495 LimitAS
496 T}:T{
497 ulimit \-v
498 T}
499 T{
500 LimitNPROC
501 T}:T{
502 ulimit \-u
503 T}
504 T{
505 LimitMEMLOCK
506 T}:T{
507 ulimit \-l
508 T}
509 T{
510 LimitLOCKS
511 T}:T{
512 ulimit \-x
513 T}
514 T{
515 LimitSIGPENDING
516 T}:T{
517 ulimit \-i
518 T}
519 T{
520 LimitMSGQUEUE
521 T}:T{
522 ulimit \-q
523 T}
524 T{
525 LimitNICE
526 T}:T{
527 ulimit \-e
528 T}
529 T{
530 LimitRTPRIO
531 T}:T{
532 ulimit \-r
533 T}
534 T{
535 LimitRTTIME
536 T}:T{
537 No equivalent
538 T}
539 .TE
540 .sp 1
541 .RE
542 .PP
543 \fIPAMName=\fR
544 .RS 4
545 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
546 \fIUser=\fR
547 setting\&. If not set, no PAM session will be opened for the executed processes\&. See
548 \fBpam\fR(8)
549 for details\&.
550 .RE
551 .PP
552 \fICapabilityBoundingSet=\fR
553 .RS 4
554 Controls which capabilities to include in the capability bounding set for the executed process\&. See
555 \fBcapabilities\fR(7)
556 for details\&. Takes a whitespace\-separated list of capability names as read by
557 \fBcap_from_name\fR(3), e\&.g\&.
558 \fBCAP_SYS_ADMIN\fR,
559 \fBCAP_DAC_OVERRIDE\fR,
560 \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
561 "~", 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
562 \fICapabilities=\fR
563 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
564 "~"
565 (without any further argument), the bounding set is reset to the full set of available capabilities, also undoing any previous settings\&.
566 .RE
567 .PP
568 \fISecureBits=\fR
569 .RS 4
570 Controls the secure bits set for the executed process\&. Takes a space\-separated combination of options from the following list:
571 \fBkeep\-caps\fR,
572 \fBkeep\-caps\-locked\fR,
573 \fBno\-setuid\-fixup\fR,
574 \fBno\-setuid\-fixup\-locked\fR,
575 \fBnoroot\fR, and
576 \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
577 \fBcapabilities\fR(7)
578 for details\&.
579 .RE
580 .PP
581 \fICapabilities=\fR
582 .RS 4
583 Controls the
584 \fBcapabilities\fR(7)
585 set for the executed process\&. Take a capability string describing the effective, permitted and inherited capability sets as documented in
586 \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
587 \fICapabilityBoundingSet=\fR
588 is probably a much more useful setting\&.
589 .RE
590 .PP
591 \fIReadWriteDirectories=\fR, \fIReadOnlyDirectories=\fR, \fIInaccessibleDirectories=\fR
592 .RS 4
593 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
594 \fIReadWriteDirectories=\fR
595 are accessible from within the namespace with the same access rights as from outside\&. Directories listed in
596 \fIReadOnlyDirectories=\fR
597 are accessible for reading only, writing will be refused even if the usual file access controls would permit this\&. Directories listed in
598 \fIInaccessibleDirectories=\fR
599 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\&.
600 .sp
601 Paths in
602 \fIReadOnlyDirectories=\fR
603 and
604 \fIInaccessibleDirectories=\fR
605 may be prefixed with
606 "\-", 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\&.
607 .RE
608 .PP
609 \fIPrivateTmp=\fR
610 .RS 4
611 Takes a boolean argument\&. If true, sets up a new file system namespace for the executed processes and mounts private
612 /tmp
613 and
614 /var/tmp
615 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
616 /tmp
617 or
618 /var/tmp
619 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
620 /tmp
621 and
622 /var/tmp
623 namespace by using the
624 \fIJoinsNamespaceOf=\fR
625 directive, see
626 \fBsystemd.unit\fR(5)
627 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\&.
628 .RE
629 .PP
630 \fIPrivateDevices=\fR
631 .RS 4
632 Takes a boolean argument\&. If true, sets up a new /dev namespace for the executed processes and only adds API pseudo devices such as
633 /dev/null,
634 /dev/zero
635 or
636 /dev/random
637 (as well as the pseudo TTY subsystem) to it, but no physical devices such as
638 /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
639 \fBCAP_MKNOD\fR
640 from the capability bounding set for the unit (see above), and set
641 \fIDevicePolicy=closed\fR
642 (see
643 \fBsystemd.resource-control\fR(5)
644 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\&.
645 .RE
646 .PP
647 \fIPrivateNetwork=\fR
648 .RS 4
649 Takes a boolean argument\&. If true, sets up a new network namespace for the executed processes and configures only the loopback network device
650 "lo"
651 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
652 \fIJoinsNamespaceOf=\fR
653 directive, see
654 \fBsystemd.unit\fR(5)
655 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)\&.
656 .RE
657 .PP
658 \fIProtectSystem=\fR
659 .RS 4
660 Takes a boolean argument or
661 "full"\&. If true, mounts the
662 /usr
663 directory read\-only for processes invoked by this unit\&. If set to
664 "full", the
665 /etc
666 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
667 \fICapabilityBoundingSet=\fR\&. Defaults to off\&.
668 .RE
669 .PP
670 \fIProtectHome=\fR
671 .RS 4
672 Takes a boolean argument or
673 "read\-only"\&. If true, the directories
674 /home
675 and
676 /run/user
677 are made inaccessible and empty for processes invoked by this unit\&. If set to
678 "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
679 \fICapabilityBoundingSet=\fR\&. Defaults to off\&.
680 .RE
681 .PP
682 \fIMountFlags=\fR
683 .RS 4
684 Takes a mount propagation flag:
685 \fBshared\fR,
686 \fBslave\fR
687 or
688 \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
689 \fBmount\fR(2)
690 for details\&. Defaults to
691 \fBshared\fR\&. Use
692 \fBshared\fR
693 to ensure that mounts and unmounts are propagated from the host to the container and vice versa\&. Use
694 \fBslave\fR
695 to run processes so that none of their mounts and unmounts will propagate to the host\&. Use
696 \fBprivate\fR
697 to also ensure that no mounts and unmounts from the host will propagate into the unit processes\*(Aq namespace\&. Note that
698 \fBslave\fR
699 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,
700 \fIPrivateDevices=\fR,
701 \fIProtectSystem=\fR,
702 \fIProtectHome=\fR,
703 \fIReadOnlyDirectories=\fR,
704 \fIInaccessibleDirectories=\fR
705 and
706 \fIReadWriteDirectories=\fR) require that mount and unmount propagation from the unit\*(Aqs file system namespace is disabled, and hence downgrade
707 \fBshared\fR
708 to
709 \fBslave\fR\&.
710 .RE
711 .PP
712 \fIUtmpIdentifier=\fR
713 .RS 4
714 Takes a four character identifier string for an utmp/wtmp entry for this service\&. This should only be set for services such as
715 \fBgetty\fR
716 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\&.
717 .RE
718 .PP
719 \fISELinuxContext=\fR
720 .RS 4
721 Set the SELinux security context of the executed process\&. If set, this will override the automated domain transition\&. However, the policy still needs to authorize the transition\&. This directive is ignored if SELinux is disabled\&. If prefixed by
722 "\-", all errors will be ignored\&. See
723 \fBsetexeccon\fR(3)
724 for details\&.
725 .RE
726 .PP
727 \fIAppArmorProfile=\fR
728 .RS 4
729 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
730 "\-", all errors will be ignored\&.
731 .RE
732 .PP
733 \fISmackProcessLabel=\fR
734 .RS 4
735 Takes a
736 \fBSMACK64\fR
737 security label as argument\&. The process executed by the unit will be started under this label and SMACK will decide whether the processes is allowed to run or not based on it\&. The process will continue to run under the label specified here unless the executable has its own
738 \fBSMACK64EXEC\fR
739 label, in which case the process will transition to run under that label\&. When not specified, the label that systemd is running under is used\&. This directive is ignored if SMACK is disabled\&.
740 .sp
741 The value may be prefixed by
742 "\-", in which case all errors will be ignored\&. An empty value may be specified to unset previous assignments\&.
743 .RE
744 .PP
745 \fIIgnoreSIGPIPE=\fR
746 .RS 4
747 Takes a boolean argument\&. If true, causes
748 \fBSIGPIPE\fR
749 to be ignored in the executed process\&. Defaults to true because
750 \fBSIGPIPE\fR
751 generally is useful only in shell pipelines\&.
752 .RE
753 .PP
754 \fINoNewPrivileges=\fR
755 .RS 4
756 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\&.
757 .RE
758 .PP
759 \fISystemCallFilter=\fR
760 .RS 4
761 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
762 \fBSIGSYS\fR
763 signal (whitelisting)\&. If the first character of the list is
764 "~", 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,
765 \fINoNewPrivileges=yes\fR
766 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
767 \fBexecve\fR,
768 \fBrt_sigreturn\fR,
769 \fBsigreturn\fR,
770 \fBexit_group\fR,
771 \fBexit\fR
772 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\&.
773 .sp
774 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
775 \fBread\fR
776 and
777 \fBwrite\fR, and right after it add a blacklisting of
778 \fBwrite\fR, then
779 \fBwrite\fR
780 will be removed from the set\&.)
781 .RE
782 .PP
783 \fISystemCallErrorNumber=\fR
784 .RS 4
785 Takes an
786 "errno"
787 error number name to return when the system call filter configured with
788 \fISystemCallFilter=\fR
789 is triggered, instead of terminating the process immediately\&. Takes an error name such as
790 \fBEPERM\fR,
791 \fBEACCES\fR
792 or
793 \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\&.
794 .RE
795 .PP
796 \fISystemCallArchitectures=\fR
797 .RS 4
798 Takes a space separated list of architecture identifiers to include in the system call filter\&. The known architecture identifiers are
799 \fBx86\fR,
800 \fBx86\-64\fR,
801 \fBx32\fR,
802 \fBarm\fR
803 as well as the special identifier
804 \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
805 \fBnative\fR
806 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,
807 \fINoNewPrivileges=yes\fR
808 is implied\&. Note that setting this option to a non\-empty list implies that
809 \fBnative\fR
810 is included too\&. By default, this option is set to the empty list, i\&.e\&. no architecture system call filtering is applied\&.
811 .RE
812 .PP
813 \fIRestrictAddressFamilies=\fR
814 .RS 4
815 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
816 \fBAF_UNIX\fR,
817 \fBAF_INET\fR
818 or
819 \fBAF_INET6\fR\&. When prefixed with
820 \fB~\fR
821 the listed address families will be applied as blacklist, otherwise as whitelist\&. Note that this restricts access to the
822 \fBsocket\fR(2)
823 system call only\&. Sockets passed into the process by other means (for example, by using socket activation with socket units, see
824 \fBsystemd.socket\fR(5)) are unaffected\&. Also, sockets created with
825 \fBsocketpair()\fR
826 (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,
827 \fINoNewPrivileges=yes\fR
828 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\&.
829 .sp
830 Use this option to limit exposure of processes to remote systems, in particular via exotic network protocols\&. Note that in most cases, the local
831 \fBAF_UNIX\fR
832 address family should be included in the configured whitelist as it is frequently used for local communication, including for
833 \fBsyslog\fR(2)
834 logging\&.
835 .RE
836 .PP
837 \fIPersonality=\fR
838 .RS 4
839 Controls which kernel architecture
840 \fBuname\fR(2)
841 shall report, when invoked by unit processes\&. Takes one of
842 \fBx86\fR
843 and
844 \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\&.
845 .RE
846 .PP
847 \fIRuntimeDirectory=\fR, \fIRuntimeDirectoryMode=\fR
848 .RS 4
849 Takes a list of directory names\&. If set, one or more directories by the specified names will be created below
850 /run
851 (for system services) or below
852 \fI$XDG_RUNTIME_DIR\fR
853 (for user services) when the unit is started, and removed when the unit is stopped\&. The directories will have the access mode specified in
854 \fIRuntimeDirectoryMode=\fR, and will be owned by the user and group specified in
855 \fIUser=\fR
856 and
857 \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
858 "/", i\&.e\&. must refer to simple directories to create or remove\&. This is particularly useful for unprivileged daemons that cannot create runtime directories in
859 /run
860 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
861 \fBtmpfiles.d\fR(5)\&.
862 .RE
863 .SH "ENVIRONMENT VARIABLES IN SPAWNED PROCESSES"
864 .PP
865 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\&.
866 .PP
867 \fI$PATH\fR
868 .RS 4
869 Colon\-separated list of directories to use when launching executables\&. Systemd uses a fixed value of
870 /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin\&.
871 .RE
872 .PP
873 \fI$LANG\fR
874 .RS 4
875 Locale\&. Can be set in
876 \fBlocale.conf\fR(5)
877 or on the kernel command line (see
878 \fBsystemd\fR(1)
879 and
880 \fBkernel-command-line\fR(7))\&.
881 .RE
882 .PP
883 \fI$USER\fR, \fI$LOGNAME\fR, \fI$HOME\fR, \fI$SHELL\fR
884 .RS 4
885 User name (twice), home directory, and the login shell\&. The variables are set for the units that have
886 \fIUser=\fR
887 set, which includes user
888 \fBsystemd\fR
889 instances\&. See
890 \fBpasswd\fR(5)\&.
891 .RE
892 .PP
893 \fI$XDG_RUNTIME_DIR\fR
894 .RS 4
895 The directory for volatile state\&. Set for the user
896 \fBsystemd\fR
897 instance, and also in user sessions\&. See
898 \fBpam_systemd\fR(8)\&.
899 .RE
900 .PP
901 \fI$XDG_SESSION_ID\fR, \fI$XDG_SEAT\fR, \fI$XDG_VTNR\fR
902 .RS 4
903 The identifier of the session, the seat name, and virtual terminal of the session\&. Set by
904 \fBpam_systemd\fR(8)
905 for login sessions\&.
906 \fI$XDG_SEAT\fR
907 and
908 \fI$XDG_VTNR\fR
909 will only be set when attached to a seat and a tty\&.
910 .RE
911 .PP
912 \fI$MAINPID\fR
913 .RS 4
914 The PID of the units main process if it is known\&. This is only set for control processes as invoked by
915 \fIExecReload=\fR
916 and similar\&.
917 .RE
918 .PP
919 \fI$MANAGERPID\fR
920 .RS 4
921 The PID of the user
922 \fBsystemd\fR
923 instance, set for processes spawned by it\&.
924 .RE
925 .PP
926 \fI$LISTEN_FDS\fR, \fI$LISTEN_PID\fR
927 .RS 4
928 Information about file descriptors passed to a service for socket activation\&. See
929 \fBsd_listen_fds\fR(3)\&.
930 .RE
931 .PP
932 \fI$TERM\fR
933 .RS 4
934 Terminal type, set only for units connected to a terminal (\fIStandardInput=tty\fR,
935 \fIStandardOutput=tty\fR, or
936 \fIStandardError=tty\fR)\&. See
937 \fBtermcap\fR(5)\&.
938 .RE
939 .PP
940 Additional variables may be configured by the following means: for processes spawned in specific units, use the
941 \fIEnvironment=\fR
942 and
943 \fIEnvironmentFile=\fR
944 options above; to specify variables globally, use
945 \fIDefaultEnvironment=\fR
946 (see
947 \fBsystemd-system.conf\fR(5)) or the kernel option
948 \fIsystemd\&.setenv=\fR
949 (see
950 \fBsystemd\fR(1))\&. Additional variables may also be set through PAM, cf\&.\ \&\fBpam_env\fR(8)\&.
951 .SH "SEE ALSO"
952 .PP
953 \fBsystemd\fR(1),
954 \fBsystemctl\fR(1),
955 \fBjournalctl\fR(8),
956 \fBsystemd.unit\fR(5),
957 \fBsystemd.service\fR(5),
958 \fBsystemd.socket\fR(5),
959 \fBsystemd.swap\fR(5),
960 \fBsystemd.mount\fR(5),
961 \fBsystemd.kill\fR(5),
962 \fBsystemd.resource-control\fR(5),
963 \fBsystemd.directives\fR(7),
964 \fBtmpfiles.d\fR(5),
965 \fBexec\fR(3)
966 .SH "NOTES"
967 .IP " 1." 4
968 proc.txt
969 .RS 4
970 \%https://www.kernel.org/doc/Documentation/filesystems/proc.txt
971 .RE