]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/systemd.exec.xml
Merge pull request #2849 from keszybz/offline-updates
[thirdparty/systemd.git] / man / systemd.exec.xml
1 <?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4
5 <!--
6 This file is part of systemd.
7
8 Copyright 2010 Lennart Poettering
9
10 systemd is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
14
15 systemd is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
19
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22 -->
23
24 <refentry id="systemd.exec">
25 <refentryinfo>
26 <title>systemd.exec</title>
27 <productname>systemd</productname>
28
29 <authorgroup>
30 <author>
31 <contrib>Developer</contrib>
32 <firstname>Lennart</firstname>
33 <surname>Poettering</surname>
34 <email>lennart@poettering.net</email>
35 </author>
36 </authorgroup>
37 </refentryinfo>
38
39 <refmeta>
40 <refentrytitle>systemd.exec</refentrytitle>
41 <manvolnum>5</manvolnum>
42 </refmeta>
43
44 <refnamediv>
45 <refname>systemd.exec</refname>
46 <refpurpose>Execution environment configuration</refpurpose>
47 </refnamediv>
48
49 <refsynopsisdiv>
50 <para><filename><replaceable>service</replaceable>.service</filename>,
51 <filename><replaceable>socket</replaceable>.socket</filename>,
52 <filename><replaceable>mount</replaceable>.mount</filename>,
53 <filename><replaceable>swap</replaceable>.swap</filename></para>
54 </refsynopsisdiv>
55
56 <refsect1>
57 <title>Description</title>
58
59 <para>Unit configuration files for services, sockets, mount
60 points, and swap devices share a subset of configuration options
61 which define the execution environment of spawned
62 processes.</para>
63
64 <para>This man page lists the configuration options shared by
65 these four unit types. See
66 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
67 for the common options of all unit configuration files, and
68 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
69 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
70 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
71 and
72 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>
73 for more information on the specific unit configuration files. The
74 execution specific configuration options are configured in the
75 [Service], [Socket], [Mount], or [Swap] sections, depending on the
76 unit type.</para>
77 </refsect1>
78
79 <refsect1>
80 <title>Automatic Dependencies</title>
81
82 <para>A few execution parameters result in additional, automatic
83 dependencies to be added.</para>
84
85 <para>Units with <varname>WorkingDirectory=</varname> or
86 <varname>RootDirectory=</varname> set automatically gain
87 dependencies of type <varname>Requires=</varname> and
88 <varname>After=</varname> on all mount units required to access
89 the specified paths. This is equivalent to having them listed
90 explicitly in <varname>RequiresMountsFor=</varname>.</para>
91
92 <para>Similar, units with <varname>PrivateTmp=</varname> enabled
93 automatically get mount unit dependencies for all mounts
94 required to access <filename>/tmp</filename> and
95 <filename>/var/tmp</filename>.</para>
96
97 <para>Units whose output standard output or error output is
98 connected to any other sink but <option>null</option>,
99 <option>tty</option> and <option>socket</option> automatically
100 acquire dependencies of type <varname>After=</varname> on
101 <filename>journald.socket</filename>.</para>
102 </refsect1>
103
104 <refsect1>
105 <title>Options</title>
106
107 <variablelist class='unit-directives'>
108
109 <varlistentry>
110 <term><varname>WorkingDirectory=</varname></term>
111
112 <listitem><para>Takes an absolute directory path, or the
113 special value <literal>~</literal>. Sets the working directory
114 for executed processes. If set to <literal>~</literal>, the
115 home directory of the user specified in
116 <varname>User=</varname> is used. If not set, defaults to the
117 root directory when systemd is running as a system instance
118 and the respective user's home directory if run as user. If
119 the setting is prefixed with the <literal>-</literal>
120 character, a missing working directory is not considered
121 fatal. Note that setting this parameter might result in
122 additional dependencies to be added to the unit (see
123 above).</para></listitem>
124 </varlistentry>
125
126 <varlistentry>
127 <term><varname>RootDirectory=</varname></term>
128
129 <listitem><para>Takes an absolute directory path. Sets the
130 root directory for executed processes, with the <citerefentry
131 project='man-pages'><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
132 system call. If this is used, it must be ensured that the
133 process binary and all its auxiliary files are available in
134 the <function>chroot()</function> jail. Note that setting this
135 parameter might result in additional dependencies to be added
136 to the unit (see above).</para></listitem>
137 </varlistentry>
138
139 <varlistentry>
140 <term><varname>User=</varname></term>
141 <term><varname>Group=</varname></term>
142
143 <listitem><para>Sets the Unix user or group that the processes
144 are executed as, respectively. Takes a single user or group
145 name or ID as argument. If no group is set, the default group
146 of the user is chosen.</para></listitem>
147 </varlistentry>
148
149 <varlistentry>
150 <term><varname>SupplementaryGroups=</varname></term>
151
152 <listitem><para>Sets the supplementary Unix groups the
153 processes are executed as. This takes a space-separated list
154 of group names or IDs. This option may be specified more than
155 once, in which case all listed groups are set as supplementary
156 groups. When the empty string is assigned, the list of
157 supplementary groups is reset, and all assignments prior to
158 this one will have no effect. In any way, this option does not
159 override, but extends the list of supplementary groups
160 configured in the system group database for the
161 user.</para></listitem>
162 </varlistentry>
163
164 <varlistentry>
165 <term><varname>Nice=</varname></term>
166
167 <listitem><para>Sets the default nice level (scheduling
168 priority) for executed processes. Takes an integer between -20
169 (highest priority) and 19 (lowest priority). See
170 <citerefentry><refentrytitle>setpriority</refentrytitle><manvolnum>2</manvolnum></citerefentry>
171 for details.</para></listitem>
172 </varlistentry>
173
174 <varlistentry>
175 <term><varname>OOMScoreAdjust=</varname></term>
176
177 <listitem><para>Sets the adjustment level for the
178 Out-Of-Memory killer for executed processes. Takes an integer
179 between -1000 (to disable OOM killing for this process) and
180 1000 (to make killing of this process under memory pressure
181 very likely). See <ulink
182 url="https://www.kernel.org/doc/Documentation/filesystems/proc.txt">proc.txt</ulink>
183 for details.</para></listitem>
184 </varlistentry>
185
186 <varlistentry>
187 <term><varname>IOSchedulingClass=</varname></term>
188
189 <listitem><para>Sets the I/O scheduling class for executed
190 processes. Takes an integer between 0 and 3 or one of the
191 strings <option>none</option>, <option>realtime</option>,
192 <option>best-effort</option> or <option>idle</option>. See
193 <citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry>
194 for details.</para></listitem>
195 </varlistentry>
196
197 <varlistentry>
198 <term><varname>IOSchedulingPriority=</varname></term>
199
200 <listitem><para>Sets the I/O scheduling priority for executed
201 processes. Takes an integer between 0 (highest priority) and 7
202 (lowest priority). The available priorities depend on the
203 selected I/O scheduling class (see above). See
204 <citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry>
205 for details.</para></listitem>
206 </varlistentry>
207
208 <varlistentry>
209 <term><varname>CPUSchedulingPolicy=</varname></term>
210
211 <listitem><para>Sets the CPU scheduling policy for executed
212 processes. Takes one of
213 <option>other</option>,
214 <option>batch</option>,
215 <option>idle</option>,
216 <option>fifo</option> or
217 <option>rr</option>. See
218 <citerefentry><refentrytitle>sched_setscheduler</refentrytitle><manvolnum>2</manvolnum></citerefentry>
219 for details.</para></listitem>
220 </varlistentry>
221
222 <varlistentry>
223 <term><varname>CPUSchedulingPriority=</varname></term>
224
225 <listitem><para>Sets the CPU scheduling priority for executed
226 processes. The available priority range depends on the
227 selected CPU scheduling policy (see above). For real-time
228 scheduling policies an integer between 1 (lowest priority) and
229 99 (highest priority) can be used. See
230 <citerefentry><refentrytitle>sched_setscheduler</refentrytitle><manvolnum>2</manvolnum></citerefentry>
231 for details. </para></listitem>
232 </varlistentry>
233
234 <varlistentry>
235 <term><varname>CPUSchedulingResetOnFork=</varname></term>
236
237 <listitem><para>Takes a boolean argument. If true, elevated
238 CPU scheduling priorities and policies will be reset when the
239 executed processes fork, and can hence not leak into child
240 processes. See
241 <citerefentry><refentrytitle>sched_setscheduler</refentrytitle><manvolnum>2</manvolnum></citerefentry>
242 for details. Defaults to false.</para></listitem>
243 </varlistentry>
244
245 <varlistentry>
246 <term><varname>CPUAffinity=</varname></term>
247
248 <listitem><para>Controls the CPU affinity of the executed
249 processes. Takes a list of CPU indices or ranges separated by
250 either whitespace or commas. CPU ranges are specified by the
251 lower and upper CPU indices separated by a dash.
252 This option may be specified more than once, in which case the
253 specified CPU affinity masks are merged. If the empty string
254 is assigned, the mask is reset, all assignments prior to this
255 will have no effect. See
256 <citerefentry><refentrytitle>sched_setaffinity</refentrytitle><manvolnum>2</manvolnum></citerefentry>
257 for details.</para></listitem>
258 </varlistentry>
259
260 <varlistentry>
261 <term><varname>UMask=</varname></term>
262
263 <listitem><para>Controls the file mode creation mask. Takes an
264 access mode in octal notation. See
265 <citerefentry><refentrytitle>umask</refentrytitle><manvolnum>2</manvolnum></citerefentry>
266 for details. Defaults to 0022.</para></listitem>
267 </varlistentry>
268
269 <varlistentry>
270 <term><varname>Environment=</varname></term>
271
272 <listitem><para>Sets environment variables for executed
273 processes. Takes a space-separated list of variable
274 assignments. This option may be specified more than once, in
275 which case all listed variables will be set. If the same
276 variable is set twice, the later setting will override the
277 earlier setting. If the empty string is assigned to this
278 option, the list of environment variables is reset, all prior
279 assignments have no effect. Variable expansion is not
280 performed inside the strings, however, specifier expansion is
281 possible. The $ character has no special meaning. If you need
282 to assign a value containing spaces to a variable, use double
283 quotes (") for the assignment.</para>
284
285 <para>Example:
286 <programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"</programlisting>
287 gives three variables <literal>VAR1</literal>,
288 <literal>VAR2</literal>, <literal>VAR3</literal>
289 with the values <literal>word1 word2</literal>,
290 <literal>word3</literal>, <literal>$word 5 6</literal>.
291 </para>
292
293 <para>
294 See
295 <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
296 for details about environment variables.</para></listitem>
297 </varlistentry>
298 <varlistentry>
299 <term><varname>EnvironmentFile=</varname></term>
300 <listitem><para>Similar to <varname>Environment=</varname> but
301 reads the environment variables from a text file. The text
302 file should contain new-line-separated variable assignments.
303 Empty lines, lines without an <literal>=</literal> separator,
304 or lines starting with ; or # will be ignored,
305 which may be used for commenting. A line ending with a
306 backslash will be concatenated with the following one,
307 allowing multiline variable definitions. The parser strips
308 leading and trailing whitespace from the values of
309 assignments, unless you use double quotes (").</para>
310
311 <para>The argument passed should be an absolute filename or
312 wildcard expression, optionally prefixed with
313 <literal>-</literal>, which indicates that if the file does
314 not exist, it will not be read and no error or warning message
315 is logged. This option may be specified more than once in
316 which case all specified files are read. If the empty string
317 is assigned to this option, the list of file to read is reset,
318 all prior assignments have no effect.</para>
319
320 <para>The files listed with this directive will be read
321 shortly before the process is executed (more specifically,
322 after all processes from a previous unit state terminated.
323 This means you can generate these files in one unit state, and
324 read it with this option in the next).</para>
325
326 <para>Settings from these
327 files override settings made with
328 <varname>Environment=</varname>. If the same variable is set
329 twice from these files, the files will be read in the order
330 they are specified and the later setting will override the
331 earlier setting.</para></listitem>
332 </varlistentry>
333
334 <varlistentry>
335 <term><varname>PassEnvironment=</varname></term>
336
337 <listitem><para>Pass environment variables from the systemd system
338 manager to executed processes. Takes a space-separated list of variable
339 names. This option may be specified more than once, in which case all
340 listed variables will be set. If the empty string is assigned to this
341 option, the list of environment variables is reset, all prior
342 assignments have no effect. Variables that are not set in the system
343 manager will not be passed and will be silently ignored.</para>
344
345 <para>Variables passed from this setting are overridden by those passed
346 from <varname>Environment=</varname> or
347 <varname>EnvironmentFile=</varname>.</para>
348
349 <para>Example:
350 <programlisting>PassEnvironment=VAR1 VAR2 VAR3</programlisting>
351 passes three variables <literal>VAR1</literal>,
352 <literal>VAR2</literal>, <literal>VAR3</literal>
353 with the values set for those variables in PID1.</para>
354
355 <para>
356 See
357 <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
358 for details about environment variables.</para></listitem>
359 </varlistentry>
360
361 <varlistentry>
362 <term><varname>StandardInput=</varname></term>
363 <listitem><para>Controls where file descriptor 0 (STDIN) of
364 the executed processes is connected to. Takes one of
365 <option>null</option>,
366 <option>tty</option>,
367 <option>tty-force</option>,
368 <option>tty-fail</option> or
369 <option>socket</option>.</para>
370
371 <para>If <option>null</option> is selected, standard input
372 will be connected to <filename>/dev/null</filename>, i.e. all
373 read attempts by the process will result in immediate
374 EOF.</para>
375
376 <para>If <option>tty</option> is selected, standard input is
377 connected to a TTY (as configured by
378 <varname>TTYPath=</varname>, see below) and the executed
379 process becomes the controlling process of the terminal. If
380 the terminal is already being controlled by another process,
381 the executed process waits until the current controlling
382 process releases the terminal.</para>
383
384 <para><option>tty-force</option> is similar to
385 <option>tty</option>, but the executed process is forcefully
386 and immediately made the controlling process of the terminal,
387 potentially removing previous controlling processes from the
388 terminal.</para>
389
390 <para><option>tty-fail</option> is similar to
391 <option>tty</option> but if the terminal already has a
392 controlling process start-up of the executed process
393 fails.</para>
394
395 <para>The <option>socket</option> option is only valid in
396 socket-activated services, and only when the socket
397 configuration file (see
398 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>
399 for details) specifies a single socket only. If this option is
400 set, standard input will be connected to the socket the
401 service was activated from, which is primarily useful for
402 compatibility with daemons designed for use with the
403 traditional
404 <citerefentry project='freebsd'><refentrytitle>inetd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
405 daemon.</para>
406
407 <para>This setting defaults to
408 <option>null</option>.</para></listitem>
409 </varlistentry>
410
411 <varlistentry>
412 <term><varname>StandardOutput=</varname></term>
413 <listitem><para>Controls where file descriptor 1 (STDOUT) of
414 the executed processes is connected to. Takes one of
415 <option>inherit</option>,
416 <option>null</option>,
417 <option>tty</option>,
418 <option>journal</option>,
419 <option>syslog</option>,
420 <option>kmsg</option>,
421 <option>journal+console</option>,
422 <option>syslog+console</option>,
423 <option>kmsg+console</option> or
424 <option>socket</option>.</para>
425
426 <para><option>inherit</option> duplicates the file descriptor
427 of standard input for standard output.</para>
428
429 <para><option>null</option> connects standard output to
430 <filename>/dev/null</filename>, i.e. everything written to it
431 will be lost.</para>
432
433 <para><option>tty</option> connects standard output to a tty
434 (as configured via <varname>TTYPath=</varname>, see below). If
435 the TTY is used for output only, the executed process will not
436 become the controlling process of the terminal, and will not
437 fail or wait for other processes to release the
438 terminal.</para>
439
440 <para><option>journal</option> connects standard output with
441 the journal which is accessible via
442 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
443 Note that everything that is written to syslog or kmsg (see
444 below) is implicitly stored in the journal as well, the
445 specific two options listed below are hence supersets of this
446 one.</para>
447
448 <para><option>syslog</option> connects standard output to the
449 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
450 system syslog service, in addition to the journal. Note that
451 the journal daemon is usually configured to forward everything
452 it receives to syslog anyway, in which case this option is no
453 different from <option>journal</option>.</para>
454
455 <para><option>kmsg</option> connects standard output with the
456 kernel log buffer which is accessible via
457 <citerefentry project='man-pages'><refentrytitle>dmesg</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
458 in addition to the journal. The journal daemon might be
459 configured to send all logs to kmsg anyway, in which case this
460 option is no different from <option>journal</option>.</para>
461
462 <para><option>journal+console</option>,
463 <option>syslog+console</option> and
464 <option>kmsg+console</option> work in a similar way as the
465 three options above but copy the output to the system console
466 as well.</para>
467
468 <para><option>socket</option> connects standard output to a
469 socket acquired via socket activation. The semantics are
470 similar to the same option of
471 <varname>StandardInput=</varname>.</para>
472
473 <para>This setting defaults to the value set with
474 <option>DefaultStandardOutput=</option> in
475 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
476 which defaults to <option>journal</option>. Note that setting
477 this parameter might result in additional dependencies to be
478 added to the unit (see above).</para></listitem>
479 </varlistentry>
480
481 <varlistentry>
482 <term><varname>StandardError=</varname></term>
483 <listitem><para>Controls where file descriptor 2 (STDERR) of
484 the executed processes is connected to. The available options
485 are identical to those of <varname>StandardOutput=</varname>,
486 with one exception: if set to <option>inherit</option> the
487 file descriptor used for standard output is duplicated for
488 standard error. This setting defaults to the value set with
489 <option>DefaultStandardError=</option> in
490 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
491 which defaults to <option>inherit</option>. Note that setting
492 this parameter might result in additional dependencies to be
493 added to the unit (see above).</para></listitem>
494 </varlistentry>
495
496 <varlistentry>
497 <term><varname>TTYPath=</varname></term>
498 <listitem><para>Sets the terminal device node to use if
499 standard input, output, or error are connected to a TTY (see
500 above). Defaults to
501 <filename>/dev/console</filename>.</para></listitem>
502 </varlistentry>
503 <varlistentry>
504 <term><varname>TTYReset=</varname></term>
505 <listitem><para>Reset the terminal device specified with
506 <varname>TTYPath=</varname> before and after execution.
507 Defaults to <literal>no</literal>.</para></listitem>
508 </varlistentry>
509 <varlistentry>
510 <term><varname>TTYVHangup=</varname></term>
511 <listitem><para>Disconnect all clients which have opened the
512 terminal device specified with <varname>TTYPath=</varname>
513 before and after execution. Defaults to
514 <literal>no</literal>.</para></listitem>
515 </varlistentry>
516 <varlistentry>
517 <term><varname>TTYVTDisallocate=</varname></term>
518 <listitem><para>If the terminal device specified with
519 <varname>TTYPath=</varname> is a virtual console terminal, try
520 to deallocate the TTY before and after execution. This ensures
521 that the screen and scrollback buffer is cleared. Defaults to
522 <literal>no</literal>.</para></listitem>
523 </varlistentry>
524 <varlistentry>
525 <term><varname>SyslogIdentifier=</varname></term>
526 <listitem><para>Sets the process name to prefix log lines sent
527 to the logging system or the kernel log buffer with. If not
528 set, defaults to the process name of the executed process.
529 This option is only useful when
530 <varname>StandardOutput=</varname> or
531 <varname>StandardError=</varname> are set to
532 <option>syslog</option>, <option>journal</option> or
533 <option>kmsg</option> (or to the same settings in combination
534 with <option>+console</option>).</para></listitem>
535 </varlistentry>
536 <varlistentry>
537 <term><varname>SyslogFacility=</varname></term>
538 <listitem><para>Sets the syslog facility to use when logging
539 to syslog. One of <option>kern</option>,
540 <option>user</option>, <option>mail</option>,
541 <option>daemon</option>, <option>auth</option>,
542 <option>syslog</option>, <option>lpr</option>,
543 <option>news</option>, <option>uucp</option>,
544 <option>cron</option>, <option>authpriv</option>,
545 <option>ftp</option>, <option>local0</option>,
546 <option>local1</option>, <option>local2</option>,
547 <option>local3</option>, <option>local4</option>,
548 <option>local5</option>, <option>local6</option> or
549 <option>local7</option>. See
550 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
551 for details. This option is only useful when
552 <varname>StandardOutput=</varname> or
553 <varname>StandardError=</varname> are set to
554 <option>syslog</option>. Defaults to
555 <option>daemon</option>.</para></listitem>
556 </varlistentry>
557 <varlistentry>
558 <term><varname>SyslogLevel=</varname></term>
559 <listitem><para>The default syslog level to use when logging to
560 syslog or the kernel log buffer. One of
561 <option>emerg</option>,
562 <option>alert</option>,
563 <option>crit</option>,
564 <option>err</option>,
565 <option>warning</option>,
566 <option>notice</option>,
567 <option>info</option>,
568 <option>debug</option>. See
569 <citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>
570 for details. This option is only useful when
571 <varname>StandardOutput=</varname> or
572 <varname>StandardError=</varname> are set to
573 <option>syslog</option> or <option>kmsg</option>. Note that
574 individual lines output by the daemon might be prefixed with a
575 different log level which can be used to override the default
576 log level specified here. The interpretation of these prefixes
577 may be disabled with <varname>SyslogLevelPrefix=</varname>,
578 see below. For details, see
579 <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
580
581 Defaults to
582 <option>info</option>.</para></listitem>
583 </varlistentry>
584
585 <varlistentry>
586 <term><varname>SyslogLevelPrefix=</varname></term>
587 <listitem><para>Takes a boolean argument. If true and
588 <varname>StandardOutput=</varname> or
589 <varname>StandardError=</varname> are set to
590 <option>syslog</option>, <option>kmsg</option> or
591 <option>journal</option>, log lines written by the executed
592 process that are prefixed with a log level will be passed on
593 to syslog with this log level set but the prefix removed. If
594 set to false, the interpretation of these prefixes is disabled
595 and the logged lines are passed on as-is. For details about
596 this prefixing see
597 <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
598 Defaults to true.</para></listitem>
599 </varlistentry>
600
601 <varlistentry>
602 <term><varname>TimerSlackNSec=</varname></term>
603 <listitem><para>Sets the timer slack in nanoseconds for the
604 executed processes. The timer slack controls the accuracy of
605 wake-ups triggered by timers. See
606 <citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry>
607 for more information. Note that in contrast to most other time
608 span definitions this parameter takes an integer value in
609 nano-seconds if no unit is specified. The usual time units are
610 understood too.</para></listitem>
611 </varlistentry>
612
613 <varlistentry>
614 <term><varname>LimitCPU=</varname></term>
615 <term><varname>LimitFSIZE=</varname></term>
616 <term><varname>LimitDATA=</varname></term>
617 <term><varname>LimitSTACK=</varname></term>
618 <term><varname>LimitCORE=</varname></term>
619 <term><varname>LimitRSS=</varname></term>
620 <term><varname>LimitNOFILE=</varname></term>
621 <term><varname>LimitAS=</varname></term>
622 <term><varname>LimitNPROC=</varname></term>
623 <term><varname>LimitMEMLOCK=</varname></term>
624 <term><varname>LimitLOCKS=</varname></term>
625 <term><varname>LimitSIGPENDING=</varname></term>
626 <term><varname>LimitMSGQUEUE=</varname></term>
627 <term><varname>LimitNICE=</varname></term>
628 <term><varname>LimitRTPRIO=</varname></term>
629 <term><varname>LimitRTTIME=</varname></term>
630 <listitem><para>These settings set both soft and hard limits
631 of various resources for executed processes. See
632 <citerefentry><refentrytitle>setrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry>
633 for details. The resource limit is possible to specify in two formats,
634 <option>value</option> to set soft and hard limits to the same value,
635 or <option>soft:hard</option> to set both limits individually (e.g. LimitAS=4G:16G).
636 Use the string <varname>infinity</varname> to
637 configure no limit on a specific resource. The multiplicative
638 suffixes K (=1024), M (=1024*1024) and so on for G, T, P and E
639 may be used for resource limits measured in bytes
640 (e.g. LimitAS=16G). For the limits referring to time values,
641 the usual time units ms, s, min, h and so on may be used (see
642 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>
643 for details). Note that if no time unit is specified for
644 <varname>LimitCPU=</varname> the default unit of seconds is
645 implied, while for <varname>LimitRTTIME=</varname> the default
646 unit of microseconds is implied. Also, note that the effective
647 granularity of the limits might influence their
648 enforcement. For example, time limits specified for
649 <varname>LimitCPU=</varname> will be rounded up implicitly to
650 multiples of 1s.</para>
651
652 <para>Note that most process resource limits configured with
653 these options are per-process, and processes may fork in order
654 to acquire a new set of resources that are accounted
655 independently of the original process, and may thus escape
656 limits set. Also note that <varname>LimitRSS=</varname> is not
657 implemented on Linux, and setting it has no effect. Often it
658 is advisable to prefer the resource controls listed in
659 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
660 over these per-process limits, as they apply to services as a
661 whole, may be altered dynamically at runtime, and are
662 generally more expressive. For example,
663 <varname>MemoryLimit=</varname> is a more powerful (and
664 working) replacement for <varname>LimitRSS=</varname>.</para>
665
666 <table>
667 <title>Limit directives and their equivalent with ulimit</title>
668
669 <tgroup cols='3'>
670 <colspec colname='directive' />
671 <colspec colname='equivalent' />
672 <colspec colname='unit' />
673 <thead>
674 <row>
675 <entry>Directive</entry>
676 <entry>ulimit equivalent</entry>
677 <entry>Unit</entry>
678 </row>
679 </thead>
680 <tbody>
681 <row>
682 <entry>LimitCPU=</entry>
683 <entry>ulimit -t</entry>
684 <entry>Seconds</entry>
685 </row>
686 <row>
687 <entry>LimitFSIZE=</entry>
688 <entry>ulimit -f</entry>
689 <entry>Bytes</entry>
690 </row>
691 <row>
692 <entry>LimitDATA=</entry>
693 <entry>ulimit -d</entry>
694 <entry>Bytes</entry>
695 </row>
696 <row>
697 <entry>LimitSTACK=</entry>
698 <entry>ulimit -s</entry>
699 <entry>Bytes</entry>
700 </row>
701 <row>
702 <entry>LimitCORE=</entry>
703 <entry>ulimit -c</entry>
704 <entry>Bytes</entry>
705 </row>
706 <row>
707 <entry>LimitRSS=</entry>
708 <entry>ulimit -m</entry>
709 <entry>Bytes</entry>
710 </row>
711 <row>
712 <entry>LimitNOFILE=</entry>
713 <entry>ulimit -n</entry>
714 <entry>Number of File Descriptors</entry>
715 </row>
716 <row>
717 <entry>LimitAS=</entry>
718 <entry>ulimit -v</entry>
719 <entry>Bytes</entry>
720 </row>
721 <row>
722 <entry>LimitNPROC=</entry>
723 <entry>ulimit -u</entry>
724 <entry>Number of Processes</entry>
725 </row>
726 <row>
727 <entry>LimitMEMLOCK=</entry>
728 <entry>ulimit -l</entry>
729 <entry>Bytes</entry>
730 </row>
731 <row>
732 <entry>LimitLOCKS=</entry>
733 <entry>ulimit -x</entry>
734 <entry>Number of Locks</entry>
735 </row>
736 <row>
737 <entry>LimitSIGPENDING=</entry>
738 <entry>ulimit -i</entry>
739 <entry>Number of Queued Signals</entry>
740 </row>
741 <row>
742 <entry>LimitMSGQUEUE=</entry>
743 <entry>ulimit -q</entry>
744 <entry>Bytes</entry>
745 </row>
746 <row>
747 <entry>LimitNICE=</entry>
748 <entry>ulimit -e</entry>
749 <entry>Nice Level</entry>
750 </row>
751 <row>
752 <entry>LimitRTPRIO=</entry>
753 <entry>ulimit -r</entry>
754 <entry>Realtime Priority</entry>
755 </row>
756 <row>
757 <entry>LimitRTTIME=</entry>
758 <entry>No equivalent</entry>
759 <entry>Microseconds</entry>
760 </row>
761 </tbody>
762 </tgroup>
763 </table></listitem>
764 </varlistentry>
765
766 <varlistentry>
767 <term><varname>PAMName=</varname></term>
768 <listitem><para>Sets the PAM service name to set up a session
769 as. If set, the executed process will be registered as a PAM
770 session under the specified service name. This is only useful
771 in conjunction with the <varname>User=</varname> setting. If
772 not set, no PAM session will be opened for the executed
773 processes. See
774 <citerefentry project='man-pages'><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry>
775 for details.</para></listitem>
776 </varlistentry>
777
778 <varlistentry>
779 <term><varname>CapabilityBoundingSet=</varname></term>
780
781 <listitem><para>Controls which capabilities to include in the capability bounding set for the executed
782 process. See <citerefentry
783 project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
784 details. Takes a whitespace-separated list of capability names as read by <citerefentry
785 project='mankier'><refentrytitle>cap_from_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
786 e.g. <constant>CAP_SYS_ADMIN</constant>, <constant>CAP_DAC_OVERRIDE</constant>,
787 <constant>CAP_SYS_PTRACE</constant>. Capabilities listed will be included in the bounding set, all others are
788 removed. If the list of capabilities is prefixed with <literal>~</literal>, all but the listed capabilities
789 will be included, the effect of the assignment inverted. Note that this option also affects the respective
790 capabilities in the effective, permitted and inheritable capability sets. If this option is not used, the
791 capability bounding set is not modified on process execution, hence no limits on the capabilities of the
792 process are enforced. This option may appear more than once, in which case the bounding sets are merged. If the
793 empty string is assigned to this option, the bounding set is reset to the empty capability set, and all prior
794 settings have no effect. If set to <literal>~</literal> (without any further argument), the bounding set is
795 reset to the full set of available capabilities, also undoing any previous settings.</para></listitem>
796 </varlistentry>
797
798 <varlistentry>
799 <term><varname>AmbientCapabilities=</varname></term>
800
801 <listitem><para>Controls which capabilities to include in the
802 ambient capability set for the executed process. Takes a
803 whitespace-separated list of capability names as read by
804 <citerefentry project='mankier'><refentrytitle>cap_from_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
805 e.g. <constant>CAP_SYS_ADMIN</constant>,
806 <constant>CAP_DAC_OVERRIDE</constant>,
807 <constant>CAP_SYS_PTRACE</constant>. This option may appear more than
808 once in which case the ambient capability sets are merged.
809 If the list of capabilities is prefixed with <literal>~</literal>, all
810 but the listed capabilities will be included, the effect of the
811 assignment inverted. If the empty string is
812 assigned to this option, the ambient capability set is reset to
813 the empty capability set, and all prior settings have no effect.
814 If set to <literal>~</literal> (without any further argument), the
815 ambient capability set is reset to the full set of available
816 capabilities, also undoing any previous settings. Note that adding
817 capabilities to ambient capability set adds them to the process's
818 inherited capability set.
819 </para><para>
820 Ambient capability sets are useful if you want to execute a process
821 as a non-privileged user but still want to give it some capabilities.
822 Note that in this case option <constant>keep-caps</constant> is
823 automatically added to <varname>SecureBits=</varname> to retain the
824 capabilities over the user change.</para></listitem>
825 </varlistentry>
826
827 <varlistentry>
828 <term><varname>SecureBits=</varname></term>
829 <listitem><para>Controls the secure bits set for the executed
830 process. Takes a space-separated combination of options from
831 the following list:
832 <option>keep-caps</option>,
833 <option>keep-caps-locked</option>,
834 <option>no-setuid-fixup</option>,
835 <option>no-setuid-fixup-locked</option>,
836 <option>noroot</option>, and
837 <option>noroot-locked</option>.
838 This option may appear more than once, in which case the secure
839 bits are ORed. If the empty string is assigned to this option,
840 the bits are reset to 0. See
841 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
842 for details.</para></listitem>
843 </varlistentry>
844
845 <varlistentry>
846 <term><varname>ReadWriteDirectories=</varname></term>
847 <term><varname>ReadOnlyDirectories=</varname></term>
848 <term><varname>InaccessibleDirectories=</varname></term>
849
850 <listitem><para>Sets up a new file system namespace for
851 executed processes. These options may be used to limit access
852 a process might have to the main file system hierarchy. Each
853 setting takes a space-separated list of absolute directory
854 paths. Directories listed in
855 <varname>ReadWriteDirectories=</varname> are accessible from
856 within the namespace with the same access rights as from
857 outside. Directories listed in
858 <varname>ReadOnlyDirectories=</varname> are accessible for
859 reading only, writing will be refused even if the usual file
860 access controls would permit this. Directories listed in
861 <varname>InaccessibleDirectories=</varname> will be made
862 inaccessible for processes inside the namespace. Note that
863 restricting access with these options does not extend to
864 submounts of a directory that are created later on. These
865 options may be specified more than once, in which case all
866 directories listed will have limited access from within the
867 namespace. If the empty string is assigned to this option, the
868 specific list is reset, and all prior assignments have no
869 effect.</para>
870 <para>Paths in
871 <varname>ReadOnlyDirectories=</varname>
872 and
873 <varname>InaccessibleDirectories=</varname>
874 may be prefixed with
875 <literal>-</literal>, in which case
876 they will be ignored when they do not
877 exist. Note that using this
878 setting will disconnect propagation of
879 mounts from the service to the host
880 (propagation in the opposite direction
881 continues to work). This means that
882 this setting may not be used for
883 services which shall be able to
884 install mount points in the main mount
885 namespace.</para></listitem>
886 </varlistentry>
887
888 <varlistentry>
889 <term><varname>PrivateTmp=</varname></term>
890
891 <listitem><para>Takes a boolean argument. If true, sets up a
892 new file system namespace for the executed processes and
893 mounts private <filename>/tmp</filename> and
894 <filename>/var/tmp</filename> directories inside it that is
895 not shared by processes outside of the namespace. This is
896 useful to secure access to temporary files of the process, but
897 makes sharing between processes via <filename>/tmp</filename>
898 or <filename>/var/tmp</filename> impossible. If this is
899 enabled, all temporary files created by a service in these
900 directories will be removed after the service is stopped.
901 Defaults to false. It is possible to run two or more units
902 within the same private <filename>/tmp</filename> and
903 <filename>/var/tmp</filename> namespace by using the
904 <varname>JoinsNamespaceOf=</varname> directive, see
905 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
906 for details. Note that using this setting will disconnect
907 propagation of mounts from the service to the host
908 (propagation in the opposite direction continues to work).
909 This means that this setting may not be used for services
910 which shall be able to install mount points in the main mount
911 namespace.</para></listitem>
912 </varlistentry>
913
914 <varlistentry>
915 <term><varname>PrivateDevices=</varname></term>
916
917 <listitem><para>Takes a boolean argument. If true, sets up a
918 new /dev namespace for the executed processes and only adds
919 API pseudo devices such as <filename>/dev/null</filename>,
920 <filename>/dev/zero</filename> or
921 <filename>/dev/random</filename> (as well as the pseudo TTY
922 subsystem) to it, but no physical devices such as
923 <filename>/dev/sda</filename>. This is useful to securely turn
924 off physical device access by the executed process. Defaults
925 to false. Enabling this option will also remove
926 <constant>CAP_MKNOD</constant> from the capability bounding
927 set for the unit (see above), and set
928 <varname>DevicePolicy=closed</varname> (see
929 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
930 for details). Note that using this setting will disconnect
931 propagation of mounts from the service to the host
932 (propagation in the opposite direction continues to work).
933 This means that this setting may not be used for services
934 which shall be able to install mount points in the main mount
935 namespace.</para></listitem>
936 </varlistentry>
937
938 <varlistentry>
939 <term><varname>PrivateNetwork=</varname></term>
940
941 <listitem><para>Takes a boolean argument. If true, sets up a
942 new network namespace for the executed processes and
943 configures only the loopback network device
944 <literal>lo</literal> inside it. No other network devices will
945 be available to the executed process. This is useful to
946 securely turn off network access by the executed process.
947 Defaults to false. It is possible to run two or more units
948 within the same private network namespace by using the
949 <varname>JoinsNamespaceOf=</varname> directive, see
950 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
951 for details. Note that this option will disconnect all socket
952 families from the host, this includes AF_NETLINK and AF_UNIX.
953 The latter has the effect that AF_UNIX sockets in the abstract
954 socket namespace will become unavailable to the processes
955 (however, those located in the file system will continue to be
956 accessible).</para></listitem>
957 </varlistentry>
958
959 <varlistentry>
960 <term><varname>ProtectSystem=</varname></term>
961
962 <listitem><para>Takes a boolean argument or
963 <literal>full</literal>. If true, mounts the
964 <filename>/usr</filename> and <filename>/boot</filename>
965 directories read-only for processes invoked by this unit. If
966 set to <literal>full</literal>, the <filename>/etc</filename>
967 directory is mounted read-only, too. This setting ensures that
968 any modification of the vendor-supplied operating system (and
969 optionally its configuration) is prohibited for the service.
970 It is recommended to enable this setting for all long-running
971 services, unless they are involved with system updates or need
972 to modify the operating system in other ways. Note however
973 that processes retaining the CAP_SYS_ADMIN capability can undo
974 the effect of this setting. This setting is hence particularly
975 useful for daemons which have this capability removed, for
976 example with <varname>CapabilityBoundingSet=</varname>.
977 Defaults to off.</para></listitem>
978 </varlistentry>
979
980 <varlistentry>
981 <term><varname>ProtectHome=</varname></term>
982
983 <listitem><para>Takes a boolean argument or
984 <literal>read-only</literal>. If true, the directories
985 <filename>/home</filename>, <filename>/root</filename> and
986 <filename>/run/user</filename>
987 are made inaccessible and empty for processes invoked by this
988 unit. If set to <literal>read-only</literal>, the three
989 directories are made read-only instead. It is recommended to
990 enable this setting for all long-running services (in
991 particular network-facing ones), to ensure they cannot get
992 access to private user data, unless the services actually
993 require access to the user's private data. Note however that
994 processes retaining the CAP_SYS_ADMIN capability can undo the
995 effect of this setting. This setting is hence particularly
996 useful for daemons which have this capability removed, for
997 example with <varname>CapabilityBoundingSet=</varname>.
998 Defaults to off.</para></listitem>
999 </varlistentry>
1000
1001 <varlistentry>
1002 <term><varname>MountFlags=</varname></term>
1003
1004 <listitem><para>Takes a mount propagation flag:
1005 <option>shared</option>, <option>slave</option> or
1006 <option>private</option>, which control whether mounts in the
1007 file system namespace set up for this unit's processes will
1008 receive or propagate mounts or unmounts. See
1009 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1010 for details. Defaults to <option>shared</option>. Use
1011 <option>shared</option> to ensure that mounts and unmounts are
1012 propagated from the host to the container and vice versa. Use
1013 <option>slave</option> to run processes so that none of their
1014 mounts and unmounts will propagate to the host. Use
1015 <option>private</option> to also ensure that no mounts and
1016 unmounts from the host will propagate into the unit processes'
1017 namespace. Note that <option>slave</option> means that file
1018 systems mounted on the host might stay mounted continuously in
1019 the unit's namespace, and thus keep the device busy. Note that
1020 the file system namespace related options
1021 (<varname>PrivateTmp=</varname>,
1022 <varname>PrivateDevices=</varname>,
1023 <varname>ProtectSystem=</varname>,
1024 <varname>ProtectHome=</varname>,
1025 <varname>ReadOnlyDirectories=</varname>,
1026 <varname>InaccessibleDirectories=</varname> and
1027 <varname>ReadWriteDirectories=</varname>) require that mount
1028 and unmount propagation from the unit's file system namespace
1029 is disabled, and hence downgrade <option>shared</option> to
1030 <option>slave</option>. </para></listitem>
1031 </varlistentry>
1032
1033 <varlistentry>
1034 <term><varname>UtmpIdentifier=</varname></term>
1035
1036 <listitem><para>Takes a four character identifier string for
1037 an <citerefentry
1038 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1039 and wtmp entry for this service. This should only be
1040 set for services such as <command>getty</command>
1041 implementations (such as <citerefentry
1042 project='die-net'><refentrytitle>agetty</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
1043 where utmp/wtmp entries must be created and cleared before and
1044 after execution, or for services that shall be executed as if
1045 they were run by a <command>getty</command> process (see
1046 below). If the configured string is longer than four
1047 characters, it is truncated and the terminal four characters
1048 are used. This setting interprets %I style string
1049 replacements. This setting is unset by default, i.e. no
1050 utmp/wtmp entries are created or cleaned up for this
1051 service.</para></listitem>
1052 </varlistentry>
1053
1054 <varlistentry>
1055 <term><varname>UtmpMode=</varname></term>
1056
1057 <listitem><para>Takes one of <literal>init</literal>,
1058 <literal>login</literal> or <literal>user</literal>. If
1059 <varname>UtmpIdentifier=</varname> is set, controls which
1060 type of <citerefentry
1061 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>/wtmp
1062 entries for this service are generated. This setting has no
1063 effect unless <varname>UtmpIdentifier=</varname> is set
1064 too. If <literal>init</literal> is set, only an
1065 <constant>INIT_PROCESS</constant> entry is generated and the
1066 invoked process must implement a
1067 <command>getty</command>-compatible utmp/wtmp logic. If
1068 <literal>login</literal> is set, first an
1069 <constant>INIT_PROCESS</constant> entry, followed by a
1070 <constant>LOGIN_PROCESS</constant> entry is generated. In
1071 this case, the invoked process must implement a <citerefentry
1072 project='die-net'><refentrytitle>login</refentrytitle><manvolnum>1</manvolnum></citerefentry>-compatible
1073 utmp/wtmp logic. If <literal>user</literal> is set, first an
1074 <constant>INIT_PROCESS</constant> entry, then a
1075 <constant>LOGIN_PROCESS</constant> entry and finally a
1076 <constant>USER_PROCESS</constant> entry is generated. In this
1077 case, the invoked process may be any process that is suitable
1078 to be run as session leader. Defaults to
1079 <literal>init</literal>.</para></listitem>
1080 </varlistentry>
1081
1082 <varlistentry>
1083 <term><varname>SELinuxContext=</varname></term>
1084
1085 <listitem><para>Set the SELinux security context of the
1086 executed process. If set, this will override the automated
1087 domain transition. However, the policy still needs to
1088 authorize the transition. This directive is ignored if SELinux
1089 is disabled. If prefixed by <literal>-</literal>, all errors
1090 will be ignored. See
1091 <citerefentry project='die-net'><refentrytitle>setexeccon</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1092 for details.</para></listitem>
1093 </varlistentry>
1094
1095 <varlistentry>
1096 <term><varname>AppArmorProfile=</varname></term>
1097
1098 <listitem><para>Takes a profile name as argument. The process
1099 executed by the unit will switch to this profile when started.
1100 Profiles must already be loaded in the kernel, or the unit
1101 will fail. This result in a non operation if AppArmor is not
1102 enabled. If prefixed by <literal>-</literal>, all errors will
1103 be ignored. </para></listitem>
1104 </varlistentry>
1105
1106 <varlistentry>
1107 <term><varname>SmackProcessLabel=</varname></term>
1108
1109 <listitem><para>Takes a <option>SMACK64</option> security
1110 label as argument. The process executed by the unit will be
1111 started under this label and SMACK will decide whether the
1112 process is allowed to run or not, based on it. The process
1113 will continue to run under the label specified here unless the
1114 executable has its own <option>SMACK64EXEC</option> label, in
1115 which case the process will transition to run under that
1116 label. When not specified, the label that systemd is running
1117 under is used. This directive is ignored if SMACK is
1118 disabled.</para>
1119
1120 <para>The value may be prefixed by <literal>-</literal>, in
1121 which case all errors will be ignored. An empty value may be
1122 specified to unset previous assignments.</para>
1123 </listitem>
1124 </varlistentry>
1125
1126 <varlistentry>
1127 <term><varname>IgnoreSIGPIPE=</varname></term>
1128
1129 <listitem><para>Takes a boolean argument. If true, causes
1130 <constant>SIGPIPE</constant> to be ignored in the executed
1131 process. Defaults to true because <constant>SIGPIPE</constant>
1132 generally is useful only in shell pipelines.</para></listitem>
1133 </varlistentry>
1134
1135 <varlistentry>
1136 <term><varname>NoNewPrivileges=</varname></term>
1137
1138 <listitem><para>Takes a boolean argument. If true, ensures
1139 that the service process and all its children can never gain
1140 new privileges. This option is more powerful than the
1141 respective secure bits flags (see above), as it also prohibits
1142 UID changes of any kind. This is the simplest, most effective
1143 way to ensure that a process and its children can never
1144 elevate privileges again.</para></listitem>
1145 </varlistentry>
1146
1147 <varlistentry>
1148 <term><varname>SystemCallFilter=</varname></term>
1149
1150 <listitem><para>Takes a space-separated list of system call
1151 names. If this setting is used, all system calls executed by
1152 the unit processes except for the listed ones will result in
1153 immediate process termination with the
1154 <constant>SIGSYS</constant> signal (whitelisting). If the
1155 first character of the list is <literal>~</literal>, the
1156 effect is inverted: only the listed system calls will result
1157 in immediate process termination (blacklisting). If running in
1158 user mode, or in system mode, but without the
1159 <constant>CAP_SYS_ADMIN</constant> capabiblity (e.g. setting
1160 <varname>User=nobody</varname>),
1161 <varname>NoNewPrivileges=yes</varname> is implied. This
1162 feature makes use of the Secure Computing Mode 2 interfaces of
1163 the kernel ('seccomp filtering') and is useful for enforcing a
1164 minimal sandboxing environment. Note that the
1165 <function>execve</function>,
1166 <function>rt_sigreturn</function>,
1167 <function>sigreturn</function>,
1168 <function>exit_group</function>, <function>exit</function>
1169 system calls are implicitly whitelisted and do not need to be
1170 listed explicitly. This option may be specified more than once,
1171 in which case the filter masks are merged. If the empty string
1172 is assigned, the filter is reset, all prior assignments will
1173 have no effect.</para>
1174
1175 <para>If you specify both types of this option (i.e.
1176 whitelisting and blacklisting), the first encountered will
1177 take precedence and will dictate the default action
1178 (termination or approval of a system call). Then the next
1179 occurrences of this option will add or delete the listed
1180 system calls from the set of the filtered system calls,
1181 depending of its type and the default action. (For example, if
1182 you have started with a whitelisting of
1183 <function>read</function> and <function>write</function>, and
1184 right after it add a blacklisting of
1185 <function>write</function>, then <function>write</function>
1186 will be removed from the set.) </para></listitem>
1187 </varlistentry>
1188
1189 <varlistentry>
1190 <term><varname>SystemCallErrorNumber=</varname></term>
1191
1192 <listitem><para>Takes an <literal>errno</literal> error number
1193 name to return when the system call filter configured with
1194 <varname>SystemCallFilter=</varname> is triggered, instead of
1195 terminating the process immediately. Takes an error name such
1196 as <constant>EPERM</constant>, <constant>EACCES</constant> or
1197 <constant>EUCLEAN</constant>. When this setting is not used,
1198 or when the empty string is assigned, the process will be
1199 terminated immediately when the filter is
1200 triggered.</para></listitem>
1201 </varlistentry>
1202
1203 <varlistentry>
1204 <term><varname>SystemCallArchitectures=</varname></term>
1205
1206 <listitem><para>Takes a space-separated list of architecture
1207 identifiers to include in the system call filter. The known
1208 architecture identifiers are <constant>x86</constant>,
1209 <constant>x86-64</constant>, <constant>x32</constant>,
1210 <constant>arm</constant> as well as the special identifier
1211 <constant>native</constant>. Only system calls of the
1212 specified architectures will be permitted to processes of this
1213 unit. This is an effective way to disable compatibility with
1214 non-native architectures for processes, for example to
1215 prohibit execution of 32-bit x86 binaries on 64-bit x86-64
1216 systems. The special <constant>native</constant> identifier
1217 implicitly maps to the native architecture of the system (or
1218 more strictly: to the architecture the system manager is
1219 compiled for). If running in user mode, or in system mode,
1220 but without the <constant>CAP_SYS_ADMIN</constant>
1221 capabiblity (e.g. setting <varname>User=nobody</varname>),
1222 <varname>NoNewPrivileges=yes</varname> is implied. Note
1223 that setting this option to a non-empty list implies that
1224 <constant>native</constant> is included too. By default, this
1225 option is set to the empty list, i.e. no architecture system
1226 call filtering is applied.</para></listitem>
1227 </varlistentry>
1228
1229 <varlistentry>
1230 <term><varname>RestrictAddressFamilies=</varname></term>
1231
1232 <listitem><para>Restricts the set of socket address families
1233 accessible to the processes of this unit. Takes a
1234 space-separated list of address family names to whitelist,
1235 such as
1236 <constant>AF_UNIX</constant>,
1237 <constant>AF_INET</constant> or
1238 <constant>AF_INET6</constant>. When
1239 prefixed with <constant>~</constant> the listed address
1240 families will be applied as blacklist, otherwise as whitelist.
1241 Note that this restricts access to the
1242 <citerefentry project='man-pages'><refentrytitle>socket</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1243 system call only. Sockets passed into the process by other
1244 means (for example, by using socket activation with socket
1245 units, see
1246 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1247 are unaffected. Also, sockets created with
1248 <function>socketpair()</function> (which creates connected
1249 AF_UNIX sockets only) are unaffected. Note that this option
1250 has no effect on 32-bit x86 and is ignored (but works
1251 correctly on x86-64). If running in user mode, or in system
1252 mode, but without the <constant>CAP_SYS_ADMIN</constant>
1253 capabiblity (e.g. setting <varname>User=nobody</varname>),
1254 <varname>NoNewPrivileges=yes</varname> is implied. By
1255 default, no restriction applies, all address families are
1256 accessible to processes. If assigned the empty string, any
1257 previous list changes are undone.</para>
1258
1259 <para>Use this option to limit exposure of processes to remote
1260 systems, in particular via exotic network protocols. Note that
1261 in most cases, the local <constant>AF_UNIX</constant> address
1262 family should be included in the configured whitelist as it is
1263 frequently used for local communication, including for
1264 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1265 logging.</para></listitem>
1266 </varlistentry>
1267
1268 <varlistentry>
1269 <term><varname>Personality=</varname></term>
1270
1271 <listitem><para>Controls which kernel architecture <citerefentry
1272 project='man-pages'><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry> shall report,
1273 when invoked by unit processes. Takes one of the architecture identifiers <constant>x86</constant>,
1274 <constant>x86-64</constant>, <constant>ppc</constant>, <constant>ppc-le</constant>, <constant>ppc64</constant>,
1275 <constant>ppc64-le</constant>, <constant>s390</constant> or <constant>s390x</constant>. Which personality
1276 architectures are supported depends on the system architecture. Usually the 64bit versions of the various
1277 system architectures support their immediate 32bit personality architecture counterpart, but no others. For
1278 example, <constant>x86-64</constant> systems support the <constant>x86-64</constant> and
1279 <constant>x86</constant> personalities but no others. The personality feature is useful when running 32-bit
1280 services on a 64-bit host system. If not specified, the personality is left unmodified and thus reflects the
1281 personality of the host system's kernel.</para></listitem>
1282 </varlistentry>
1283
1284 <varlistentry>
1285 <term><varname>RuntimeDirectory=</varname></term>
1286 <term><varname>RuntimeDirectoryMode=</varname></term>
1287
1288 <listitem><para>Takes a list of directory names. If set, one
1289 or more directories by the specified names will be created
1290 below <filename>/run</filename> (for system services) or below
1291 <varname>$XDG_RUNTIME_DIR</varname> (for user services) when
1292 the unit is started, and removed when the unit is stopped. The
1293 directories will have the access mode specified in
1294 <varname>RuntimeDirectoryMode=</varname>, and will be owned by
1295 the user and group specified in <varname>User=</varname> and
1296 <varname>Group=</varname>. Use this to manage one or more
1297 runtime directories of the unit and bind their lifetime to the
1298 daemon runtime. The specified directory names must be
1299 relative, and may not include a <literal>/</literal>, i.e.
1300 must refer to simple directories to create or remove. This is
1301 particularly useful for unprivileged daemons that cannot
1302 create runtime directories in <filename>/run</filename> due to
1303 lack of privileges, and to make sure the runtime directory is
1304 cleaned up automatically after use. For runtime directories
1305 that require more complex or different configuration or
1306 lifetime guarantees, please consider using
1307 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
1308 </varlistentry>
1309
1310 </variablelist>
1311 </refsect1>
1312
1313 <refsect1>
1314 <title>Environment variables in spawned processes</title>
1315
1316 <para>Processes started by the system are executed in a clean
1317 environment in which select variables listed below are set. System
1318 processes started by systemd do not inherit variables from PID 1,
1319 but processes started by user systemd instances inherit all
1320 environment variables from the user systemd instance.
1321 </para>
1322
1323 <variablelist class='environment-variables'>
1324 <varlistentry>
1325 <term><varname>$PATH</varname></term>
1326
1327 <listitem><para>Colon-separated list of directories to use
1328 when launching executables. Systemd uses a fixed value of
1329 <filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename>:<filename>/sbin</filename>:<filename>/bin</filename>.
1330 </para></listitem>
1331 </varlistentry>
1332
1333 <varlistentry>
1334 <term><varname>$LANG</varname></term>
1335
1336 <listitem><para>Locale. Can be set in
1337 <citerefentry project='man-pages'><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1338 or on the kernel command line (see
1339 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1340 and
1341 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
1342 </para></listitem>
1343 </varlistentry>
1344
1345 <varlistentry>
1346 <term><varname>$USER</varname></term>
1347 <term><varname>$LOGNAME</varname></term>
1348 <term><varname>$HOME</varname></term>
1349 <term><varname>$SHELL</varname></term>
1350
1351 <listitem><para>User name (twice), home directory, and the
1352 login shell. The variables are set for the units that have
1353 <varname>User=</varname> set, which includes user
1354 <command>systemd</command> instances. See
1355 <citerefentry project='die-net'><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1356 </para></listitem>
1357 </varlistentry>
1358
1359 <varlistentry>
1360 <term><varname>$XDG_RUNTIME_DIR</varname></term>
1361
1362 <listitem><para>The directory for volatile state. Set for the
1363 user <command>systemd</command> instance, and also in user
1364 sessions. See
1365 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
1366 </para></listitem>
1367 </varlistentry>
1368
1369 <varlistentry>
1370 <term><varname>$XDG_SESSION_ID</varname></term>
1371 <term><varname>$XDG_SEAT</varname></term>
1372 <term><varname>$XDG_VTNR</varname></term>
1373
1374 <listitem><para>The identifier of the session, the seat name,
1375 and virtual terminal of the session. Set by
1376 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1377 for login sessions. <varname>$XDG_SEAT</varname> and
1378 <varname>$XDG_VTNR</varname> will only be set when attached to
1379 a seat and a tty.</para></listitem>
1380 </varlistentry>
1381
1382 <varlistentry>
1383 <term><varname>$MAINPID</varname></term>
1384
1385 <listitem><para>The PID of the units main process if it is
1386 known. This is only set for control processes as invoked by
1387 <varname>ExecReload=</varname> and similar. </para></listitem>
1388 </varlistentry>
1389
1390 <varlistentry>
1391 <term><varname>$MANAGERPID</varname></term>
1392
1393 <listitem><para>The PID of the user <command>systemd</command>
1394 instance, set for processes spawned by it. </para></listitem>
1395 </varlistentry>
1396
1397 <varlistentry>
1398 <term><varname>$LISTEN_FDS</varname></term>
1399 <term><varname>$LISTEN_PID</varname></term>
1400 <term><varname>$LISTEN_FDNAMES</varname></term>
1401
1402 <listitem><para>Information about file descriptors passed to a
1403 service for socket activation. See
1404 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1405 </para></listitem>
1406 </varlistentry>
1407
1408 <varlistentry>
1409 <term><varname>$NOTIFY_SOCKET</varname></term>
1410
1411 <listitem><para>The socket
1412 <function>sd_notify()</function> talks to. See
1413 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1414 </para></listitem>
1415 </varlistentry>
1416
1417 <varlistentry>
1418 <term><varname>$WATCHDOG_PID</varname></term>
1419 <term><varname>$WATCHDOG_USEC</varname></term>
1420
1421 <listitem><para>Information about watchdog keep-alive notifications. See
1422 <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1423 </para></listitem>
1424 </varlistentry>
1425
1426 <varlistentry>
1427 <term><varname>$TERM</varname></term>
1428
1429 <listitem><para>Terminal type, set only for units connected to
1430 a terminal (<varname>StandardInput=tty</varname>,
1431 <varname>StandardOutput=tty</varname>, or
1432 <varname>StandardError=tty</varname>). See
1433 <citerefentry project='man-pages'><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1434 </para></listitem>
1435 </varlistentry>
1436 </variablelist>
1437
1438 <para>Additional variables may be configured by the following
1439 means: for processes spawned in specific units, use the
1440 <varname>Environment=</varname>, <varname>EnvironmentFile=</varname>
1441 and <varname>PassEnvironment=</varname> options above; to specify
1442 variables globally, use <varname>DefaultEnvironment=</varname>
1443 (see
1444 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1445 or the kernel option <varname>systemd.setenv=</varname> (see
1446 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
1447 Additional variables may also be set through PAM,
1448 cf. <citerefentry project='man-pages'><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
1449 </refsect1>
1450
1451 <refsect1>
1452 <title>See Also</title>
1453 <para>
1454 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1455 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1456 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1457 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1458 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1459 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1460 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1461 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1462 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1463 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1464 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1465 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1466 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1467 <citerefentry project='man-pages'><refentrytitle>exec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1468 </para>
1469 </refsect1>
1470
1471 </refentry>