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