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