]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.exec.xml
tests: test ambient capabilities.
[thirdparty/systemd.git] / man / systemd.exec.xml
CommitLineData
023a4f67 1<?xml version='1.0'?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
dd1eb43b 2<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
12b42c76 3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
dd1eb43b
LP
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
5430f7f2
LP
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
dd1eb43b
LP
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
5430f7f2 18 Lesser General Public License for more details.
dd1eb43b 19
5430f7f2 20 You should have received a copy of the GNU Lesser General Public License
dd1eb43b
LP
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
22-->
23
24<refentry id="systemd.exec">
798d3a52
ZJS
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
c129bd5d
LP
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
798d3a52
ZJS
104 <refsect1>
105 <title>Options</title>
106
107 <variablelist class='unit-directives'>
108
109 <varlistentry>
110 <term><varname>WorkingDirectory=</varname></term>
111
5f5d8eab
LP
112 <listitem><para>Takes an absolute directory path, or the
113 special value <literal>~</literal>. Sets the working directory
b938cb90 114 for executed processes. If set to <literal>~</literal>, the
5f5d8eab
LP
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
c129bd5d
LP
121 fatal. Note that setting this parameter might result in
122 additional dependencies to be added to the unit (see
123 above).</para></listitem>
798d3a52
ZJS
124 </varlistentry>
125
126 <varlistentry>
127 <term><varname>RootDirectory=</varname></term>
128
129 <listitem><para>Takes an absolute directory path. Sets the
5f5d8eab
LP
130 root directory for executed processes, with the <citerefentry
131 project='man-pages'><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52 132 system call. If this is used, it must be ensured that the
5f5d8eab 133 process binary and all its auxiliary files are available in
c129bd5d
LP
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>
798d3a52
ZJS
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
b938cb90
JE
155 once, in which case all listed groups are set as supplementary
156 groups. When the empty string is assigned, the list of
798d3a52
ZJS
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
b938cb90 189 <listitem><para>Sets the I/O scheduling class for executed
798d3a52
ZJS
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
b938cb90 200 <listitem><para>Sets the I/O scheduling priority for executed
798d3a52
ZJS
201 processes. Takes an integer between 0 (highest priority) and 7
202 (lowest priority). The available priorities depend on the
b938cb90 203 selected I/O scheduling class (see above). See
798d3a52
ZJS
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
71b1c27a
FB
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.
b938cb90 252 This option may be specified more than once, in which case the
798d3a52
ZJS
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
b938cb90 274 assignments. This option may be specified more than once, in
798d3a52
ZJS
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.
8f0d2981
RM
303 Empty lines, lines without an <literal>=</literal> separator,
304 or lines starting with ; or # will be ignored,
798d3a52
ZJS
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
f407824d
DH
324 read it with this option in the next).</para>
325
326 <para>Settings from these
798d3a52
ZJS
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
b4c14404
FB
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
798d3a52
ZJS
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
b5c7d097 404 <citerefentry project='freebsd'><refentrytitle>inetd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
798d3a52
ZJS
405 daemon.</para>
406
407 <para>This setting defaults to
408 <option>null</option>.</para></listitem>
409 </varlistentry>
c129bd5d 410
798d3a52
ZJS
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>,
c129bd5d
LP
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>
798d3a52 479 </varlistentry>
c129bd5d 480
798d3a52
ZJS
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>,
c129bd5d
LP
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>
798d3a52 494 </varlistentry>
c129bd5d 495
798d3a52
ZJS
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>
a8eaaee7 559 <listitem><para>The default syslog level to use when logging to
798d3a52
ZJS
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>,
b938cb90 578 see below. For details, see
798d3a52
ZJS
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>
91518d20
KZ
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
a4c18002
LP
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>
798d3a52
ZJS
665
666 <table>
667 <title>Limit directives and their equivalent with ulimit</title>
668
a4c18002 669 <tgroup cols='3'>
798d3a52
ZJS
670 <colspec colname='directive' />
671 <colspec colname='equivalent' />
a4c18002 672 <colspec colname='unit' />
798d3a52
ZJS
673 <thead>
674 <row>
675 <entry>Directive</entry>
676 <entry>ulimit equivalent</entry>
a4c18002 677 <entry>Unit</entry>
798d3a52
ZJS
678 </row>
679 </thead>
680 <tbody>
681 <row>
a4c18002 682 <entry>LimitCPU=</entry>
798d3a52 683 <entry>ulimit -t</entry>
a4c18002 684 <entry>Seconds</entry>
798d3a52
ZJS
685 </row>
686 <row>
a4c18002 687 <entry>LimitFSIZE=</entry>
798d3a52 688 <entry>ulimit -f</entry>
a4c18002 689 <entry>Bytes</entry>
798d3a52
ZJS
690 </row>
691 <row>
a4c18002 692 <entry>LimitDATA=</entry>
798d3a52 693 <entry>ulimit -d</entry>
a4c18002 694 <entry>Bytes</entry>
798d3a52
ZJS
695 </row>
696 <row>
a4c18002 697 <entry>LimitSTACK=</entry>
798d3a52 698 <entry>ulimit -s</entry>
a4c18002 699 <entry>Bytes</entry>
798d3a52
ZJS
700 </row>
701 <row>
a4c18002 702 <entry>LimitCORE=</entry>
798d3a52 703 <entry>ulimit -c</entry>
a4c18002 704 <entry>Bytes</entry>
798d3a52
ZJS
705 </row>
706 <row>
a4c18002 707 <entry>LimitRSS=</entry>
798d3a52 708 <entry>ulimit -m</entry>
a4c18002 709 <entry>Bytes</entry>
798d3a52
ZJS
710 </row>
711 <row>
a4c18002 712 <entry>LimitNOFILE=</entry>
798d3a52 713 <entry>ulimit -n</entry>
a4c18002 714 <entry>Number of File Descriptors</entry>
798d3a52
ZJS
715 </row>
716 <row>
a4c18002 717 <entry>LimitAS=</entry>
798d3a52 718 <entry>ulimit -v</entry>
a4c18002 719 <entry>Bytes</entry>
798d3a52
ZJS
720 </row>
721 <row>
a4c18002 722 <entry>LimitNPROC=</entry>
798d3a52 723 <entry>ulimit -u</entry>
a4c18002 724 <entry>Number of Processes</entry>
798d3a52
ZJS
725 </row>
726 <row>
a4c18002 727 <entry>LimitMEMLOCK=</entry>
798d3a52 728 <entry>ulimit -l</entry>
a4c18002 729 <entry>Bytes</entry>
798d3a52
ZJS
730 </row>
731 <row>
a4c18002 732 <entry>LimitLOCKS=</entry>
798d3a52 733 <entry>ulimit -x</entry>
a4c18002 734 <entry>Number of Locks</entry>
798d3a52
ZJS
735 </row>
736 <row>
a4c18002 737 <entry>LimitSIGPENDING=</entry>
798d3a52 738 <entry>ulimit -i</entry>
a4c18002 739 <entry>Number of Queued Signals</entry>
798d3a52
ZJS
740 </row>
741 <row>
a4c18002 742 <entry>LimitMSGQUEUE=</entry>
798d3a52 743 <entry>ulimit -q</entry>
a4c18002 744 <entry>Bytes</entry>
798d3a52
ZJS
745 </row>
746 <row>
a4c18002 747 <entry>LimitNICE=</entry>
798d3a52 748 <entry>ulimit -e</entry>
a4c18002 749 <entry>Nice Level</entry>
798d3a52
ZJS
750 </row>
751 <row>
a4c18002 752 <entry>LimitRTPRIO=</entry>
798d3a52 753 <entry>ulimit -r</entry>
a4c18002 754 <entry>Realtime Priority</entry>
798d3a52
ZJS
755 </row>
756 <row>
a4c18002 757 <entry>LimitRTTIME=</entry>
798d3a52 758 <entry>No equivalent</entry>
a4c18002 759 <entry>Microseconds</entry>
798d3a52
ZJS
760 </row>
761 </tbody>
762 </tgroup>
a4c18002 763 </table></listitem>
798d3a52
ZJS
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
782 capability bounding set for the executed process. See
783 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
784 for details. Takes a whitespace-separated list of capability
785 names as read by
3ba3a79d 786 <citerefentry project='mankier'><refentrytitle>cap_from_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
798d3a52
ZJS
787 e.g. <constant>CAP_SYS_ADMIN</constant>,
788 <constant>CAP_DAC_OVERRIDE</constant>,
789 <constant>CAP_SYS_PTRACE</constant>. Capabilities listed will
790 be included in the bounding set, all others are removed. If
791 the list of capabilities is prefixed with
792 <literal>~</literal>, all but the listed capabilities will be
793 included, the effect of the assignment inverted. Note that
794 this option also affects the respective capabilities in the
795 effective, permitted and inheritable capability sets, on top
796 of what <varname>Capabilities=</varname> does. If this option
797 is not used, the capability bounding set is not modified on
798 process execution, hence no limits on the capabilities of the
b938cb90 799 process are enforced. This option may appear more than once, in
798d3a52
ZJS
800 which case the bounding sets are merged. If the empty string
801 is assigned to this option, the bounding set is reset to the
802 empty capability set, and all prior settings have no effect.
803 If set to <literal>~</literal> (without any further argument),
804 the bounding set is reset to the full set of available
805 capabilities, also undoing any previous
806 settings.</para></listitem>
807 </varlistentry>
808
809 <varlistentry>
810 <term><varname>SecureBits=</varname></term>
811 <listitem><para>Controls the secure bits set for the executed
812 process. Takes a space-separated combination of options from
813 the following list:
814 <option>keep-caps</option>,
815 <option>keep-caps-locked</option>,
816 <option>no-setuid-fixup</option>,
817 <option>no-setuid-fixup-locked</option>,
818 <option>noroot</option>, and
819 <option>noroot-locked</option>.
b938cb90 820 This option may appear more than once, in which case the secure
798d3a52
ZJS
821 bits are ORed. If the empty string is assigned to this option,
822 the bits are reset to 0. See
823 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
824 for details.</para></listitem>
825 </varlistentry>
826
827 <varlistentry>
828 <term><varname>Capabilities=</varname></term>
829 <listitem><para>Controls the
830 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
831 set for the executed process. Take a capability string
832 describing the effective, permitted and inherited capability
833 sets as documented in
3ba3a79d 834 <citerefentry project='mankier'><refentrytitle>cap_from_text</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
798d3a52
ZJS
835 Note that these capability sets are usually influenced (and
836 filtered) by the capabilities attached to the executed file.
837 Due to that <varname>CapabilityBoundingSet=</varname> is
838 probably a much more useful setting.</para></listitem>
839 </varlistentry>
840
841 <varlistentry>
842 <term><varname>ReadWriteDirectories=</varname></term>
843 <term><varname>ReadOnlyDirectories=</varname></term>
844 <term><varname>InaccessibleDirectories=</varname></term>
845
846 <listitem><para>Sets up a new file system namespace for
847 executed processes. These options may be used to limit access
848 a process might have to the main file system hierarchy. Each
849 setting takes a space-separated list of absolute directory
850 paths. Directories listed in
851 <varname>ReadWriteDirectories=</varname> are accessible from
852 within the namespace with the same access rights as from
853 outside. Directories listed in
854 <varname>ReadOnlyDirectories=</varname> are accessible for
855 reading only, writing will be refused even if the usual file
856 access controls would permit this. Directories listed in
857 <varname>InaccessibleDirectories=</varname> will be made
858 inaccessible for processes inside the namespace. Note that
859 restricting access with these options does not extend to
860 submounts of a directory that are created later on. These
b938cb90 861 options may be specified more than once, in which case all
798d3a52
ZJS
862 directories listed will have limited access from within the
863 namespace. If the empty string is assigned to this option, the
864 specific list is reset, and all prior assignments have no
865 effect.</para>
866 <para>Paths in
867 <varname>ReadOnlyDirectories=</varname>
868 and
869 <varname>InaccessibleDirectories=</varname>
870 may be prefixed with
871 <literal>-</literal>, in which case
872 they will be ignored when they do not
873 exist. Note that using this
874 setting will disconnect propagation of
875 mounts from the service to the host
876 (propagation in the opposite direction
877 continues to work). This means that
878 this setting may not be used for
879 services which shall be able to
880 install mount points in the main mount
881 namespace.</para></listitem>
882 </varlistentry>
883
884 <varlistentry>
885 <term><varname>PrivateTmp=</varname></term>
886
887 <listitem><para>Takes a boolean argument. If true, sets up a
888 new file system namespace for the executed processes and
889 mounts private <filename>/tmp</filename> and
890 <filename>/var/tmp</filename> directories inside it that is
891 not shared by processes outside of the namespace. This is
892 useful to secure access to temporary files of the process, but
893 makes sharing between processes via <filename>/tmp</filename>
894 or <filename>/var/tmp</filename> impossible. If this is
895 enabled, all temporary files created by a service in these
896 directories will be removed after the service is stopped.
897 Defaults to false. It is possible to run two or more units
898 within the same private <filename>/tmp</filename> and
899 <filename>/var/tmp</filename> namespace by using the
900 <varname>JoinsNamespaceOf=</varname> directive, see
901 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
902 for details. Note that using this setting will disconnect
903 propagation of mounts from the service to the host
904 (propagation in the opposite direction continues to work).
905 This means that this setting may not be used for services
906 which shall be able to install mount points in the main mount
907 namespace.</para></listitem>
908 </varlistentry>
909
910 <varlistentry>
911 <term><varname>PrivateDevices=</varname></term>
912
913 <listitem><para>Takes a boolean argument. If true, sets up a
914 new /dev namespace for the executed processes and only adds
915 API pseudo devices such as <filename>/dev/null</filename>,
916 <filename>/dev/zero</filename> or
917 <filename>/dev/random</filename> (as well as the pseudo TTY
918 subsystem) to it, but no physical devices such as
919 <filename>/dev/sda</filename>. This is useful to securely turn
920 off physical device access by the executed process. Defaults
921 to false. Enabling this option will also remove
922 <constant>CAP_MKNOD</constant> from the capability bounding
923 set for the unit (see above), and set
924 <varname>DevicePolicy=closed</varname> (see
925 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
926 for details). Note that using this setting will disconnect
927 propagation of mounts from the service to the host
928 (propagation in the opposite direction continues to work).
929 This means that this setting may not be used for services
930 which shall be able to install mount points in the main mount
931 namespace.</para></listitem>
932 </varlistentry>
933
934 <varlistentry>
935 <term><varname>PrivateNetwork=</varname></term>
936
937 <listitem><para>Takes a boolean argument. If true, sets up a
938 new network namespace for the executed processes and
939 configures only the loopback network device
940 <literal>lo</literal> inside it. No other network devices will
941 be available to the executed process. This is useful to
942 securely turn off network access by the executed process.
943 Defaults to false. It is possible to run two or more units
944 within the same private network namespace by using the
945 <varname>JoinsNamespaceOf=</varname> directive, see
946 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
947 for details. Note that this option will disconnect all socket
948 families from the host, this includes AF_NETLINK and AF_UNIX.
949 The latter has the effect that AF_UNIX sockets in the abstract
950 socket namespace will become unavailable to the processes
951 (however, those located in the file system will continue to be
952 accessible).</para></listitem>
953 </varlistentry>
954
955 <varlistentry>
956 <term><varname>ProtectSystem=</varname></term>
957
958 <listitem><para>Takes a boolean argument or
959 <literal>full</literal>. If true, mounts the
960 <filename>/usr</filename> and <filename>/boot</filename>
961 directories read-only for processes invoked by this unit. If
962 set to <literal>full</literal>, the <filename>/etc</filename>
963 directory is mounted read-only, too. This setting ensures that
b938cb90 964 any modification of the vendor-supplied operating system (and
798d3a52
ZJS
965 optionally its configuration) is prohibited for the service.
966 It is recommended to enable this setting for all long-running
967 services, unless they are involved with system updates or need
968 to modify the operating system in other ways. Note however
969 that processes retaining the CAP_SYS_ADMIN capability can undo
970 the effect of this setting. This setting is hence particularly
971 useful for daemons which have this capability removed, for
972 example with <varname>CapabilityBoundingSet=</varname>.
973 Defaults to off.</para></listitem>
974 </varlistentry>
975
976 <varlistentry>
977 <term><varname>ProtectHome=</varname></term>
978
979 <listitem><para>Takes a boolean argument or
980 <literal>read-only</literal>. If true, the directories
58331437
CH
981 <filename>/home</filename>, <filename>/root</filename> and
982 <filename>/run/user</filename>
798d3a52 983 are made inaccessible and empty for processes invoked by this
58331437 984 unit. If set to <literal>read-only</literal>, the three
798d3a52
ZJS
985 directories are made read-only instead. It is recommended to
986 enable this setting for all long-running services (in
987 particular network-facing ones), to ensure they cannot get
988 access to private user data, unless the services actually
989 require access to the user's private data. Note however that
990 processes retaining the CAP_SYS_ADMIN capability can undo the
991 effect of this setting. This setting is hence particularly
992 useful for daemons which have this capability removed, for
993 example with <varname>CapabilityBoundingSet=</varname>.
994 Defaults to off.</para></listitem>
995 </varlistentry>
996
997 <varlistentry>
998 <term><varname>MountFlags=</varname></term>
999
1000 <listitem><para>Takes a mount propagation flag:
1001 <option>shared</option>, <option>slave</option> or
1002 <option>private</option>, which control whether mounts in the
1003 file system namespace set up for this unit's processes will
1004 receive or propagate mounts or unmounts. See
3ba3a79d 1005 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1006 for details. Defaults to <option>shared</option>. Use
1007 <option>shared</option> to ensure that mounts and unmounts are
1008 propagated from the host to the container and vice versa. Use
1009 <option>slave</option> to run processes so that none of their
1010 mounts and unmounts will propagate to the host. Use
1011 <option>private</option> to also ensure that no mounts and
1012 unmounts from the host will propagate into the unit processes'
1013 namespace. Note that <option>slave</option> means that file
1014 systems mounted on the host might stay mounted continuously in
1015 the unit's namespace, and thus keep the device busy. Note that
1016 the file system namespace related options
1017 (<varname>PrivateTmp=</varname>,
1018 <varname>PrivateDevices=</varname>,
1019 <varname>ProtectSystem=</varname>,
1020 <varname>ProtectHome=</varname>,
1021 <varname>ReadOnlyDirectories=</varname>,
1022 <varname>InaccessibleDirectories=</varname> and
1023 <varname>ReadWriteDirectories=</varname>) require that mount
1024 and unmount propagation from the unit's file system namespace
1025 is disabled, and hence downgrade <option>shared</option> to
1026 <option>slave</option>. </para></listitem>
1027 </varlistentry>
1028
1029 <varlistentry>
1030 <term><varname>UtmpIdentifier=</varname></term>
1031
1032 <listitem><para>Takes a four character identifier string for
023a4f67
LP
1033 an <citerefentry
1034 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1035 and wtmp entry for this service. This should only be
1036 set for services such as <command>getty</command>
1037 implementations (such as <citerefentry
1038 project='die-net'><refentrytitle>agetty</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
798d3a52 1039 where utmp/wtmp entries must be created and cleared before and
023a4f67
LP
1040 after execution, or for services that shall be executed as if
1041 they were run by a <command>getty</command> process (see
1042 below). If the configured string is longer than four
798d3a52
ZJS
1043 characters, it is truncated and the terminal four characters
1044 are used. This setting interprets %I style string
1045 replacements. This setting is unset by default, i.e. no
1046 utmp/wtmp entries are created or cleaned up for this
1047 service.</para></listitem>
1048 </varlistentry>
1049
023a4f67
LP
1050 <varlistentry>
1051 <term><varname>UtmpMode=</varname></term>
1052
1053 <listitem><para>Takes one of <literal>init</literal>,
1054 <literal>login</literal> or <literal>user</literal>. If
1055 <varname>UtmpIdentifier=</varname> is set, controls which
1056 type of <citerefentry
1057 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>/wtmp
1058 entries for this service are generated. This setting has no
1059 effect unless <varname>UtmpIdentifier=</varname> is set
1060 too. If <literal>init</literal> is set, only an
1061 <constant>INIT_PROCESS</constant> entry is generated and the
6cd16034
LP
1062 invoked process must implement a
1063 <command>getty</command>-compatible utmp/wtmp logic. If
1064 <literal>login</literal> is set, first an
a8eaaee7 1065 <constant>INIT_PROCESS</constant> entry, followed by a
6cd16034 1066 <constant>LOGIN_PROCESS</constant> entry is generated. In
b938cb90 1067 this case, the invoked process must implement a <citerefentry
023a4f67
LP
1068 project='die-net'><refentrytitle>login</refentrytitle><manvolnum>1</manvolnum></citerefentry>-compatible
1069 utmp/wtmp logic. If <literal>user</literal> is set, first an
1070 <constant>INIT_PROCESS</constant> entry, then a
a8eaaee7 1071 <constant>LOGIN_PROCESS</constant> entry and finally a
023a4f67 1072 <constant>USER_PROCESS</constant> entry is generated. In this
b938cb90 1073 case, the invoked process may be any process that is suitable
023a4f67
LP
1074 to be run as session leader. Defaults to
1075 <literal>init</literal>.</para></listitem>
1076 </varlistentry>
1077
798d3a52
ZJS
1078 <varlistentry>
1079 <term><varname>SELinuxContext=</varname></term>
1080
1081 <listitem><para>Set the SELinux security context of the
1082 executed process. If set, this will override the automated
1083 domain transition. However, the policy still needs to
1084 authorize the transition. This directive is ignored if SELinux
1085 is disabled. If prefixed by <literal>-</literal>, all errors
1086 will be ignored. See
3ba3a79d 1087 <citerefentry project='die-net'><refentrytitle>setexeccon</refentrytitle><manvolnum>3</manvolnum></citerefentry>
798d3a52
ZJS
1088 for details.</para></listitem>
1089 </varlistentry>
1090
1091 <varlistentry>
1092 <term><varname>AppArmorProfile=</varname></term>
1093
1094 <listitem><para>Takes a profile name as argument. The process
1095 executed by the unit will switch to this profile when started.
1096 Profiles must already be loaded in the kernel, or the unit
1097 will fail. This result in a non operation if AppArmor is not
1098 enabled. If prefixed by <literal>-</literal>, all errors will
1099 be ignored. </para></listitem>
1100 </varlistentry>
1101
1102 <varlistentry>
1103 <term><varname>SmackProcessLabel=</varname></term>
1104
1105 <listitem><para>Takes a <option>SMACK64</option> security
1106 label as argument. The process executed by the unit will be
1107 started under this label and SMACK will decide whether the
b938cb90 1108 process is allowed to run or not, based on it. The process
798d3a52
ZJS
1109 will continue to run under the label specified here unless the
1110 executable has its own <option>SMACK64EXEC</option> label, in
1111 which case the process will transition to run under that
1112 label. When not specified, the label that systemd is running
1113 under is used. This directive is ignored if SMACK is
1114 disabled.</para>
1115
1116 <para>The value may be prefixed by <literal>-</literal>, in
1117 which case all errors will be ignored. An empty value may be
1118 specified to unset previous assignments.</para>
1119 </listitem>
1120 </varlistentry>
1121
1122 <varlistentry>
1123 <term><varname>IgnoreSIGPIPE=</varname></term>
1124
1125 <listitem><para>Takes a boolean argument. If true, causes
1126 <constant>SIGPIPE</constant> to be ignored in the executed
1127 process. Defaults to true because <constant>SIGPIPE</constant>
1128 generally is useful only in shell pipelines.</para></listitem>
1129 </varlistentry>
1130
1131 <varlistentry>
1132 <term><varname>NoNewPrivileges=</varname></term>
1133
1134 <listitem><para>Takes a boolean argument. If true, ensures
1135 that the service process and all its children can never gain
1136 new privileges. This option is more powerful than the
1137 respective secure bits flags (see above), as it also prohibits
1138 UID changes of any kind. This is the simplest, most effective
1139 way to ensure that a process and its children can never
1140 elevate privileges again.</para></listitem>
1141 </varlistentry>
1142
1143 <varlistentry>
1144 <term><varname>SystemCallFilter=</varname></term>
1145
1146 <listitem><para>Takes a space-separated list of system call
1147 names. If this setting is used, all system calls executed by
1148 the unit processes except for the listed ones will result in
1149 immediate process termination with the
1150 <constant>SIGSYS</constant> signal (whitelisting). If the
1151 first character of the list is <literal>~</literal>, the
1152 effect is inverted: only the listed system calls will result
1153 in immediate process termination (blacklisting). If running in
1154 user mode and this option is used,
1155 <varname>NoNewPrivileges=yes</varname> is implied. This
1156 feature makes use of the Secure Computing Mode 2 interfaces of
1157 the kernel ('seccomp filtering') and is useful for enforcing a
1158 minimal sandboxing environment. Note that the
1159 <function>execve</function>,
1160 <function>rt_sigreturn</function>,
1161 <function>sigreturn</function>,
1162 <function>exit_group</function>, <function>exit</function>
1163 system calls are implicitly whitelisted and do not need to be
b938cb90 1164 listed explicitly. This option may be specified more than once,
798d3a52
ZJS
1165 in which case the filter masks are merged. If the empty string
1166 is assigned, the filter is reset, all prior assignments will
1167 have no effect.</para>
1168
1169 <para>If you specify both types of this option (i.e.
1170 whitelisting and blacklisting), the first encountered will
1171 take precedence and will dictate the default action
1172 (termination or approval of a system call). Then the next
1173 occurrences of this option will add or delete the listed
1174 system calls from the set of the filtered system calls,
1175 depending of its type and the default action. (For example, if
1176 you have started with a whitelisting of
1177 <function>read</function> and <function>write</function>, and
1178 right after it add a blacklisting of
1179 <function>write</function>, then <function>write</function>
1180 will be removed from the set.) </para></listitem>
1181 </varlistentry>
1182
1183 <varlistentry>
1184 <term><varname>SystemCallErrorNumber=</varname></term>
1185
1186 <listitem><para>Takes an <literal>errno</literal> error number
1187 name to return when the system call filter configured with
1188 <varname>SystemCallFilter=</varname> is triggered, instead of
1189 terminating the process immediately. Takes an error name such
1190 as <constant>EPERM</constant>, <constant>EACCES</constant> or
1191 <constant>EUCLEAN</constant>. When this setting is not used,
1192 or when the empty string is assigned, the process will be
1193 terminated immediately when the filter is
1194 triggered.</para></listitem>
1195 </varlistentry>
1196
1197 <varlistentry>
1198 <term><varname>SystemCallArchitectures=</varname></term>
1199
b938cb90 1200 <listitem><para>Takes a space-separated list of architecture
798d3a52
ZJS
1201 identifiers to include in the system call filter. The known
1202 architecture identifiers are <constant>x86</constant>,
1203 <constant>x86-64</constant>, <constant>x32</constant>,
1204 <constant>arm</constant> as well as the special identifier
1205 <constant>native</constant>. Only system calls of the
1206 specified architectures will be permitted to processes of this
1207 unit. This is an effective way to disable compatibility with
1208 non-native architectures for processes, for example to
1209 prohibit execution of 32-bit x86 binaries on 64-bit x86-64
1210 systems. The special <constant>native</constant> identifier
1211 implicitly maps to the native architecture of the system (or
1212 more strictly: to the architecture the system manager is
1213 compiled for). If running in user mode and this option is
1214 used, <varname>NoNewPrivileges=yes</varname> is implied. Note
1215 that setting this option to a non-empty list implies that
1216 <constant>native</constant> is included too. By default, this
1217 option is set to the empty list, i.e. no architecture system
1218 call filtering is applied.</para></listitem>
1219 </varlistentry>
1220
1221 <varlistentry>
1222 <term><varname>RestrictAddressFamilies=</varname></term>
1223
1224 <listitem><para>Restricts the set of socket address families
1225 accessible to the processes of this unit. Takes a
1226 space-separated list of address family names to whitelist,
1227 such as
1228 <constant>AF_UNIX</constant>,
1229 <constant>AF_INET</constant> or
1230 <constant>AF_INET6</constant>. When
1231 prefixed with <constant>~</constant> the listed address
1232 families will be applied as blacklist, otherwise as whitelist.
1233 Note that this restricts access to the
3ba3a79d 1234 <citerefentry project='man-pages'><refentrytitle>socket</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1235 system call only. Sockets passed into the process by other
1236 means (for example, by using socket activation with socket
1237 units, see
1238 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1239 are unaffected. Also, sockets created with
1240 <function>socketpair()</function> (which creates connected
1241 AF_UNIX sockets only) are unaffected. Note that this option
1242 has no effect on 32-bit x86 and is ignored (but works
1243 correctly on x86-64). If running in user mode and this option
1244 is used, <varname>NoNewPrivileges=yes</varname> is implied. By
1245 default, no restriction applies, all address families are
1246 accessible to processes. If assigned the empty string, any
1247 previous list changes are undone.</para>
1248
1249 <para>Use this option to limit exposure of processes to remote
1250 systems, in particular via exotic network protocols. Note that
1251 in most cases, the local <constant>AF_UNIX</constant> address
1252 family should be included in the configured whitelist as it is
1253 frequently used for local communication, including for
1254 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1255 logging.</para></listitem>
1256 </varlistentry>
1257
1258 <varlistentry>
1259 <term><varname>Personality=</varname></term>
1260
1261 <listitem><para>Controls which kernel architecture
3ba3a79d 1262 <citerefentry project='man-pages'><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1263 shall report, when invoked by unit processes. Takes one of
1264 <constant>x86</constant> and <constant>x86-64</constant>. This
1265 is useful when running 32-bit services on a 64-bit host
1266 system. If not specified, the personality is left unmodified
1267 and thus reflects the personality of the host system's
1268 kernel.</para></listitem>
1269 </varlistentry>
1270
1271 <varlistentry>
1272 <term><varname>RuntimeDirectory=</varname></term>
1273 <term><varname>RuntimeDirectoryMode=</varname></term>
1274
1275 <listitem><para>Takes a list of directory names. If set, one
1276 or more directories by the specified names will be created
1277 below <filename>/run</filename> (for system services) or below
1278 <varname>$XDG_RUNTIME_DIR</varname> (for user services) when
1279 the unit is started, and removed when the unit is stopped. The
1280 directories will have the access mode specified in
1281 <varname>RuntimeDirectoryMode=</varname>, and will be owned by
1282 the user and group specified in <varname>User=</varname> and
1283 <varname>Group=</varname>. Use this to manage one or more
1284 runtime directories of the unit and bind their lifetime to the
1285 daemon runtime. The specified directory names must be
1286 relative, and may not include a <literal>/</literal>, i.e.
1287 must refer to simple directories to create or remove. This is
1288 particularly useful for unprivileged daemons that cannot
1289 create runtime directories in <filename>/run</filename> due to
1290 lack of privileges, and to make sure the runtime directory is
1291 cleaned up automatically after use. For runtime directories
1292 that require more complex or different configuration or
1293 lifetime guarantees, please consider using
1294 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
1295 </varlistentry>
1296
1297 </variablelist>
1298 </refsect1>
1299
1300 <refsect1>
1301 <title>Environment variables in spawned processes</title>
1302
1303 <para>Processes started by the system are executed in a clean
1304 environment in which select variables listed below are set. System
1305 processes started by systemd do not inherit variables from PID 1,
1306 but processes started by user systemd instances inherit all
1307 environment variables from the user systemd instance.
1308 </para>
1309
1310 <variablelist class='environment-variables'>
1311 <varlistentry>
1312 <term><varname>$PATH</varname></term>
1313
1314 <listitem><para>Colon-separated list of directories to use
1315 when launching executables. Systemd uses a fixed value of
1316 <filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename>:<filename>/sbin</filename>:<filename>/bin</filename>.
1317 </para></listitem>
1318 </varlistentry>
1319
1320 <varlistentry>
1321 <term><varname>$LANG</varname></term>
1322
1323 <listitem><para>Locale. Can be set in
3ba3a79d 1324 <citerefentry project='man-pages'><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
1325 or on the kernel command line (see
1326 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1327 and
1328 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
1329 </para></listitem>
1330 </varlistentry>
1331
1332 <varlistentry>
1333 <term><varname>$USER</varname></term>
1334 <term><varname>$LOGNAME</varname></term>
1335 <term><varname>$HOME</varname></term>
1336 <term><varname>$SHELL</varname></term>
1337
1338 <listitem><para>User name (twice), home directory, and the
1339 login shell. The variables are set for the units that have
1340 <varname>User=</varname> set, which includes user
1341 <command>systemd</command> instances. See
3ba3a79d 1342 <citerefentry project='die-net'><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
798d3a52
ZJS
1343 </para></listitem>
1344 </varlistentry>
1345
1346 <varlistentry>
1347 <term><varname>$XDG_RUNTIME_DIR</varname></term>
1348
1349 <listitem><para>The directory for volatile state. Set for the
1350 user <command>systemd</command> instance, and also in user
1351 sessions. See
1352 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
1353 </para></listitem>
1354 </varlistentry>
1355
1356 <varlistentry>
1357 <term><varname>$XDG_SESSION_ID</varname></term>
1358 <term><varname>$XDG_SEAT</varname></term>
1359 <term><varname>$XDG_VTNR</varname></term>
1360
1361 <listitem><para>The identifier of the session, the seat name,
1362 and virtual terminal of the session. Set by
1363 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1364 for login sessions. <varname>$XDG_SEAT</varname> and
1365 <varname>$XDG_VTNR</varname> will only be set when attached to
1366 a seat and a tty.</para></listitem>
1367 </varlistentry>
1368
1369 <varlistentry>
1370 <term><varname>$MAINPID</varname></term>
1371
1372 <listitem><para>The PID of the units main process if it is
1373 known. This is only set for control processes as invoked by
1374 <varname>ExecReload=</varname> and similar. </para></listitem>
1375 </varlistentry>
1376
1377 <varlistentry>
1378 <term><varname>$MANAGERPID</varname></term>
1379
1380 <listitem><para>The PID of the user <command>systemd</command>
1381 instance, set for processes spawned by it. </para></listitem>
1382 </varlistentry>
1383
1384 <varlistentry>
1385 <term><varname>$LISTEN_FDS</varname></term>
1386 <term><varname>$LISTEN_PID</varname></term>
5c019cf2 1387 <term><varname>$LISTEN_FDNAMES</varname></term>
798d3a52
ZJS
1388
1389 <listitem><para>Information about file descriptors passed to a
1390 service for socket activation. See
1391 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1392 </para></listitem>
1393 </varlistentry>
1394
5c019cf2
EV
1395 <varlistentry>
1396 <term><varname>$NOTIFY_SOCKET</varname></term>
1397
1398 <listitem><para>The socket
1399 <function>sd_notify()</function> talks to. See
1400 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1401 </para></listitem>
1402 </varlistentry>
1403
1404 <varlistentry>
1405 <term><varname>$WATCHDOG_PID</varname></term>
1406 <term><varname>$WATCHDOG_USEC</varname></term>
1407
1408 <listitem><para>Information about watchdog keep-alive notifications. See
1409 <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1410 </para></listitem>
1411 </varlistentry>
1412
798d3a52
ZJS
1413 <varlistentry>
1414 <term><varname>$TERM</varname></term>
1415
1416 <listitem><para>Terminal type, set only for units connected to
1417 a terminal (<varname>StandardInput=tty</varname>,
1418 <varname>StandardOutput=tty</varname>, or
1419 <varname>StandardError=tty</varname>). See
1420 <citerefentry project='man-pages'><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1421 </para></listitem>
1422 </varlistentry>
1423 </variablelist>
1424
1425 <para>Additional variables may be configured by the following
1426 means: for processes spawned in specific units, use the
5c019cf2
EV
1427 <varname>Environment=</varname>, <varname>EnvironmentFile=</varname>
1428 and <varname>PassEnvironment=</varname> options above; to specify
798d3a52
ZJS
1429 variables globally, use <varname>DefaultEnvironment=</varname>
1430 (see
1431 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1432 or the kernel option <varname>systemd.setenv=</varname> (see
1433 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
1434 Additional variables may also be set through PAM,
1435 cf. <citerefentry project='man-pages'><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
1436 </refsect1>
1437
1438 <refsect1>
1439 <title>See Also</title>
1440 <para>
1441 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1442 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1443 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1444 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1445 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1446 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1447 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1448 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1449 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1450 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
a4c18002 1451 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
798d3a52
ZJS
1452 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1453 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1454 <citerefentry project='man-pages'><refentrytitle>exec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1455 </para>
1456 </refsect1>
dd1eb43b
LP
1457
1458</refentry>