]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.exec.xml
journal-file: make seeking in corrupted files work
[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
479050b3
LP
781 <listitem><para>Controls which capabilities to include in the capability bounding set for the executed
782 process. See <citerefentry
783 project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> for
784 details. Takes a whitespace-separated list of capability names as read by <citerefentry
785 project='mankier'><refentrytitle>cap_from_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
786 e.g. <constant>CAP_SYS_ADMIN</constant>, <constant>CAP_DAC_OVERRIDE</constant>,
787 <constant>CAP_SYS_PTRACE</constant>. Capabilities listed will be included in the bounding set, all others are
788 removed. If the list of capabilities is prefixed with <literal>~</literal>, all but the listed capabilities
789 will be included, the effect of the assignment inverted. Note that this option also affects the respective
790 capabilities in the effective, permitted and inheritable capability sets. If this option is not used, the
791 capability bounding set is not modified on process execution, hence no limits on the capabilities of the
792 process are enforced. This option may appear more than once, in which case the bounding sets are merged. If the
793 empty string is assigned to this option, the bounding set is reset to the empty capability set, and all prior
794 settings have no effect. If set to <literal>~</literal> (without any further argument), the bounding set is
795 reset to the full set of available capabilities, also undoing any previous settings.</para></listitem>
798d3a52
ZJS
796 </varlistentry>
797
ece87975
IP
798 <varlistentry>
799 <term><varname>AmbientCapabilities=</varname></term>
800
801 <listitem><para>Controls which capabilities to include in the
802 ambient capability set for the executed process. Takes a
803 whitespace-separated list of capability names as read by
804 <citerefentry project='mankier'><refentrytitle>cap_from_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
805 e.g. <constant>CAP_SYS_ADMIN</constant>,
806 <constant>CAP_DAC_OVERRIDE</constant>,
807 <constant>CAP_SYS_PTRACE</constant>. This option may appear more than
808 once in which case the ambient capability sets are merged.
809 If the list of capabilities is prefixed with <literal>~</literal>, all
810 but the listed capabilities will be included, the effect of the
811 assignment inverted. If the empty string is
812 assigned to this option, the ambient capability set is reset to
813 the empty capability set, and all prior settings have no effect.
814 If set to <literal>~</literal> (without any further argument), the
815 ambient capability set is reset to the full set of available
816 capabilities, also undoing any previous settings. Note that adding
817 capabilities to ambient capability set adds them to the process's
818 inherited capability set.
819 </para><para>
820 Ambient capability sets are useful if you want to execute a process
821 as a non-privileged user but still want to give it some capabilities.
822 Note that in this case option <constant>keep-caps</constant> is
823 automatically added to <varname>SecureBits=</varname> to retain the
824 capabilities over the user change.</para></listitem>
825 </varlistentry>
826
798d3a52
ZJS
827 <varlistentry>
828 <term><varname>SecureBits=</varname></term>
829 <listitem><para>Controls the secure bits set for the executed
830 process. Takes a space-separated combination of options from
831 the following list:
832 <option>keep-caps</option>,
833 <option>keep-caps-locked</option>,
834 <option>no-setuid-fixup</option>,
835 <option>no-setuid-fixup-locked</option>,
836 <option>noroot</option>, and
837 <option>noroot-locked</option>.
b938cb90 838 This option may appear more than once, in which case the secure
798d3a52
ZJS
839 bits are ORed. If the empty string is assigned to this option,
840 the bits are reset to 0. See
841 <citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>
842 for details.</para></listitem>
843 </varlistentry>
844
798d3a52
ZJS
845 <varlistentry>
846 <term><varname>ReadWriteDirectories=</varname></term>
847 <term><varname>ReadOnlyDirectories=</varname></term>
848 <term><varname>InaccessibleDirectories=</varname></term>
849
850 <listitem><para>Sets up a new file system namespace for
851 executed processes. These options may be used to limit access
852 a process might have to the main file system hierarchy. Each
853 setting takes a space-separated list of absolute directory
854 paths. Directories listed in
855 <varname>ReadWriteDirectories=</varname> are accessible from
856 within the namespace with the same access rights as from
857 outside. Directories listed in
858 <varname>ReadOnlyDirectories=</varname> are accessible for
859 reading only, writing will be refused even if the usual file
860 access controls would permit this. Directories listed in
861 <varname>InaccessibleDirectories=</varname> will be made
b50a16af
NBS
862 inaccessible for processes inside the namespace, and may not
863 countain any other mountpoints, including those specified by
864 <varname>ReadWriteDirectories=</varname> or
865 <varname>ReadOnlyDirectories=</varname>.
866 Note that restricting access with these options does not extend
867 to submounts of a directory that are created later on. These
b938cb90 868 options may be specified more than once, in which case all
798d3a52
ZJS
869 directories listed will have limited access from within the
870 namespace. If the empty string is assigned to this option, the
871 specific list is reset, and all prior assignments have no
872 effect.</para>
873 <para>Paths in
874 <varname>ReadOnlyDirectories=</varname>
875 and
876 <varname>InaccessibleDirectories=</varname>
877 may be prefixed with
878 <literal>-</literal>, in which case
879 they will be ignored when they do not
880 exist. Note that using this
881 setting will disconnect propagation of
882 mounts from the service to the host
883 (propagation in the opposite direction
884 continues to work). This means that
885 this setting may not be used for
886 services which shall be able to
887 install mount points in the main mount
888 namespace.</para></listitem>
889 </varlistentry>
890
891 <varlistentry>
892 <term><varname>PrivateTmp=</varname></term>
893
894 <listitem><para>Takes a boolean argument. If true, sets up a
895 new file system namespace for the executed processes and
896 mounts private <filename>/tmp</filename> and
897 <filename>/var/tmp</filename> directories inside it that is
898 not shared by processes outside of the namespace. This is
899 useful to secure access to temporary files of the process, but
900 makes sharing between processes via <filename>/tmp</filename>
901 or <filename>/var/tmp</filename> impossible. If this is
902 enabled, all temporary files created by a service in these
903 directories will be removed after the service is stopped.
904 Defaults to false. It is possible to run two or more units
905 within the same private <filename>/tmp</filename> and
906 <filename>/var/tmp</filename> namespace by using the
907 <varname>JoinsNamespaceOf=</varname> directive, see
908 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
909 for details. Note that using this setting will disconnect
910 propagation of mounts from the service to the host
911 (propagation in the opposite direction continues to work).
912 This means that this setting may not be used for services
913 which shall be able to install mount points in the main mount
914 namespace.</para></listitem>
915 </varlistentry>
916
917 <varlistentry>
918 <term><varname>PrivateDevices=</varname></term>
919
920 <listitem><para>Takes a boolean argument. If true, sets up a
921 new /dev namespace for the executed processes and only adds
922 API pseudo devices such as <filename>/dev/null</filename>,
923 <filename>/dev/zero</filename> or
924 <filename>/dev/random</filename> (as well as the pseudo TTY
925 subsystem) to it, but no physical devices such as
926 <filename>/dev/sda</filename>. This is useful to securely turn
927 off physical device access by the executed process. Defaults
928 to false. Enabling this option will also remove
929 <constant>CAP_MKNOD</constant> from the capability bounding
930 set for the unit (see above), and set
931 <varname>DevicePolicy=closed</varname> (see
932 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
933 for details). Note that using this setting will disconnect
934 propagation of mounts from the service to the host
935 (propagation in the opposite direction continues to work).
936 This means that this setting may not be used for services
937 which shall be able to install mount points in the main mount
938 namespace.</para></listitem>
939 </varlistentry>
940
941 <varlistentry>
942 <term><varname>PrivateNetwork=</varname></term>
943
944 <listitem><para>Takes a boolean argument. If true, sets up a
945 new network namespace for the executed processes and
946 configures only the loopback network device
947 <literal>lo</literal> inside it. No other network devices will
948 be available to the executed process. This is useful to
949 securely turn off network access by the executed process.
950 Defaults to false. It is possible to run two or more units
951 within the same private network namespace by using the
952 <varname>JoinsNamespaceOf=</varname> directive, see
953 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
954 for details. Note that this option will disconnect all socket
955 families from the host, this includes AF_NETLINK and AF_UNIX.
956 The latter has the effect that AF_UNIX sockets in the abstract
957 socket namespace will become unavailable to the processes
958 (however, those located in the file system will continue to be
959 accessible).</para></listitem>
960 </varlistentry>
961
962 <varlistentry>
963 <term><varname>ProtectSystem=</varname></term>
964
965 <listitem><para>Takes a boolean argument or
966 <literal>full</literal>. If true, mounts the
967 <filename>/usr</filename> and <filename>/boot</filename>
968 directories read-only for processes invoked by this unit. If
969 set to <literal>full</literal>, the <filename>/etc</filename>
970 directory is mounted read-only, too. This setting ensures that
b938cb90 971 any modification of the vendor-supplied operating system (and
798d3a52
ZJS
972 optionally its configuration) is prohibited for the service.
973 It is recommended to enable this setting for all long-running
974 services, unless they are involved with system updates or need
975 to modify the operating system in other ways. Note however
976 that processes retaining the CAP_SYS_ADMIN capability can undo
977 the effect of this setting. This setting is hence particularly
978 useful for daemons which have this capability removed, for
979 example with <varname>CapabilityBoundingSet=</varname>.
980 Defaults to off.</para></listitem>
981 </varlistentry>
982
983 <varlistentry>
984 <term><varname>ProtectHome=</varname></term>
985
986 <listitem><para>Takes a boolean argument or
987 <literal>read-only</literal>. If true, the directories
58331437
CH
988 <filename>/home</filename>, <filename>/root</filename> and
989 <filename>/run/user</filename>
798d3a52 990 are made inaccessible and empty for processes invoked by this
58331437 991 unit. If set to <literal>read-only</literal>, the three
798d3a52
ZJS
992 directories are made read-only instead. It is recommended to
993 enable this setting for all long-running services (in
994 particular network-facing ones), to ensure they cannot get
995 access to private user data, unless the services actually
996 require access to the user's private data. Note however that
997 processes retaining the CAP_SYS_ADMIN capability can undo the
998 effect of this setting. This setting is hence particularly
999 useful for daemons which have this capability removed, for
1000 example with <varname>CapabilityBoundingSet=</varname>.
1001 Defaults to off.</para></listitem>
1002 </varlistentry>
1003
1004 <varlistentry>
1005 <term><varname>MountFlags=</varname></term>
1006
1007 <listitem><para>Takes a mount propagation flag:
1008 <option>shared</option>, <option>slave</option> or
1009 <option>private</option>, which control whether mounts in the
1010 file system namespace set up for this unit's processes will
1011 receive or propagate mounts or unmounts. See
3ba3a79d 1012 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1013 for details. Defaults to <option>shared</option>. Use
1014 <option>shared</option> to ensure that mounts and unmounts are
1015 propagated from the host to the container and vice versa. Use
1016 <option>slave</option> to run processes so that none of their
1017 mounts and unmounts will propagate to the host. Use
1018 <option>private</option> to also ensure that no mounts and
1019 unmounts from the host will propagate into the unit processes'
1020 namespace. Note that <option>slave</option> means that file
1021 systems mounted on the host might stay mounted continuously in
1022 the unit's namespace, and thus keep the device busy. Note that
1023 the file system namespace related options
1024 (<varname>PrivateTmp=</varname>,
1025 <varname>PrivateDevices=</varname>,
1026 <varname>ProtectSystem=</varname>,
1027 <varname>ProtectHome=</varname>,
1028 <varname>ReadOnlyDirectories=</varname>,
1029 <varname>InaccessibleDirectories=</varname> and
1030 <varname>ReadWriteDirectories=</varname>) require that mount
1031 and unmount propagation from the unit's file system namespace
1032 is disabled, and hence downgrade <option>shared</option> to
1033 <option>slave</option>. </para></listitem>
1034 </varlistentry>
1035
1036 <varlistentry>
1037 <term><varname>UtmpIdentifier=</varname></term>
1038
1039 <listitem><para>Takes a four character identifier string for
023a4f67
LP
1040 an <citerefentry
1041 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1042 and wtmp entry for this service. This should only be
1043 set for services such as <command>getty</command>
1044 implementations (such as <citerefentry
1045 project='die-net'><refentrytitle>agetty</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
798d3a52 1046 where utmp/wtmp entries must be created and cleared before and
023a4f67
LP
1047 after execution, or for services that shall be executed as if
1048 they were run by a <command>getty</command> process (see
1049 below). If the configured string is longer than four
798d3a52
ZJS
1050 characters, it is truncated and the terminal four characters
1051 are used. This setting interprets %I style string
1052 replacements. This setting is unset by default, i.e. no
1053 utmp/wtmp entries are created or cleaned up for this
1054 service.</para></listitem>
1055 </varlistentry>
1056
023a4f67
LP
1057 <varlistentry>
1058 <term><varname>UtmpMode=</varname></term>
1059
1060 <listitem><para>Takes one of <literal>init</literal>,
1061 <literal>login</literal> or <literal>user</literal>. If
1062 <varname>UtmpIdentifier=</varname> is set, controls which
1063 type of <citerefentry
1064 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>/wtmp
1065 entries for this service are generated. This setting has no
1066 effect unless <varname>UtmpIdentifier=</varname> is set
1067 too. If <literal>init</literal> is set, only an
1068 <constant>INIT_PROCESS</constant> entry is generated and the
6cd16034
LP
1069 invoked process must implement a
1070 <command>getty</command>-compatible utmp/wtmp logic. If
1071 <literal>login</literal> is set, first an
a8eaaee7 1072 <constant>INIT_PROCESS</constant> entry, followed by a
6cd16034 1073 <constant>LOGIN_PROCESS</constant> entry is generated. In
b938cb90 1074 this case, the invoked process must implement a <citerefentry
023a4f67
LP
1075 project='die-net'><refentrytitle>login</refentrytitle><manvolnum>1</manvolnum></citerefentry>-compatible
1076 utmp/wtmp logic. If <literal>user</literal> is set, first an
1077 <constant>INIT_PROCESS</constant> entry, then a
a8eaaee7 1078 <constant>LOGIN_PROCESS</constant> entry and finally a
023a4f67 1079 <constant>USER_PROCESS</constant> entry is generated. In this
b938cb90 1080 case, the invoked process may be any process that is suitable
023a4f67
LP
1081 to be run as session leader. Defaults to
1082 <literal>init</literal>.</para></listitem>
1083 </varlistentry>
1084
798d3a52
ZJS
1085 <varlistentry>
1086 <term><varname>SELinuxContext=</varname></term>
1087
1088 <listitem><para>Set the SELinux security context of the
1089 executed process. If set, this will override the automated
1090 domain transition. However, the policy still needs to
1091 authorize the transition. This directive is ignored if SELinux
1092 is disabled. If prefixed by <literal>-</literal>, all errors
1093 will be ignored. See
3ba3a79d 1094 <citerefentry project='die-net'><refentrytitle>setexeccon</refentrytitle><manvolnum>3</manvolnum></citerefentry>
798d3a52
ZJS
1095 for details.</para></listitem>
1096 </varlistentry>
1097
1098 <varlistentry>
1099 <term><varname>AppArmorProfile=</varname></term>
1100
1101 <listitem><para>Takes a profile name as argument. The process
1102 executed by the unit will switch to this profile when started.
1103 Profiles must already be loaded in the kernel, or the unit
1104 will fail. This result in a non operation if AppArmor is not
1105 enabled. If prefixed by <literal>-</literal>, all errors will
1106 be ignored. </para></listitem>
1107 </varlistentry>
1108
1109 <varlistentry>
1110 <term><varname>SmackProcessLabel=</varname></term>
1111
1112 <listitem><para>Takes a <option>SMACK64</option> security
1113 label as argument. The process executed by the unit will be
1114 started under this label and SMACK will decide whether the
b938cb90 1115 process is allowed to run or not, based on it. The process
798d3a52
ZJS
1116 will continue to run under the label specified here unless the
1117 executable has its own <option>SMACK64EXEC</option> label, in
1118 which case the process will transition to run under that
1119 label. When not specified, the label that systemd is running
1120 under is used. This directive is ignored if SMACK is
1121 disabled.</para>
1122
1123 <para>The value may be prefixed by <literal>-</literal>, in
1124 which case all errors will be ignored. An empty value may be
1125 specified to unset previous assignments.</para>
1126 </listitem>
1127 </varlistentry>
1128
1129 <varlistentry>
1130 <term><varname>IgnoreSIGPIPE=</varname></term>
1131
1132 <listitem><para>Takes a boolean argument. If true, causes
1133 <constant>SIGPIPE</constant> to be ignored in the executed
1134 process. Defaults to true because <constant>SIGPIPE</constant>
1135 generally is useful only in shell pipelines.</para></listitem>
1136 </varlistentry>
1137
1138 <varlistentry>
1139 <term><varname>NoNewPrivileges=</varname></term>
1140
1141 <listitem><para>Takes a boolean argument. If true, ensures
1142 that the service process and all its children can never gain
1143 new privileges. This option is more powerful than the
1144 respective secure bits flags (see above), as it also prohibits
1145 UID changes of any kind. This is the simplest, most effective
1146 way to ensure that a process and its children can never
1147 elevate privileges again.</para></listitem>
1148 </varlistentry>
1149
1150 <varlistentry>
1151 <term><varname>SystemCallFilter=</varname></term>
1152
1153 <listitem><para>Takes a space-separated list of system call
1154 names. If this setting is used, all system calls executed by
1155 the unit processes except for the listed ones will result in
1156 immediate process termination with the
1157 <constant>SIGSYS</constant> signal (whitelisting). If the
1158 first character of the list is <literal>~</literal>, the
1159 effect is inverted: only the listed system calls will result
1160 in immediate process termination (blacklisting). If running in
19c0b0b9
RC
1161 user mode, or in system mode, but without the
1162 <constant>CAP_SYS_ADMIN</constant> capabiblity (e.g. setting
1163 <varname>User=nobody</varname>),
798d3a52
ZJS
1164 <varname>NoNewPrivileges=yes</varname> is implied. This
1165 feature makes use of the Secure Computing Mode 2 interfaces of
1166 the kernel ('seccomp filtering') and is useful for enforcing a
1167 minimal sandboxing environment. Note that the
1168 <function>execve</function>,
1169 <function>rt_sigreturn</function>,
1170 <function>sigreturn</function>,
1171 <function>exit_group</function>, <function>exit</function>
1172 system calls are implicitly whitelisted and do not need to be
b938cb90 1173 listed explicitly. This option may be specified more than once,
798d3a52
ZJS
1174 in which case the filter masks are merged. If the empty string
1175 is assigned, the filter is reset, all prior assignments will
1176 have no effect.</para>
1177
1178 <para>If you specify both types of this option (i.e.
1179 whitelisting and blacklisting), the first encountered will
1180 take precedence and will dictate the default action
1181 (termination or approval of a system call). Then the next
1182 occurrences of this option will add or delete the listed
1183 system calls from the set of the filtered system calls,
1184 depending of its type and the default action. (For example, if
1185 you have started with a whitelisting of
1186 <function>read</function> and <function>write</function>, and
1187 right after it add a blacklisting of
1188 <function>write</function>, then <function>write</function>
1189 will be removed from the set.) </para></listitem>
1190 </varlistentry>
1191
1192 <varlistentry>
1193 <term><varname>SystemCallErrorNumber=</varname></term>
1194
1195 <listitem><para>Takes an <literal>errno</literal> error number
1196 name to return when the system call filter configured with
1197 <varname>SystemCallFilter=</varname> is triggered, instead of
1198 terminating the process immediately. Takes an error name such
1199 as <constant>EPERM</constant>, <constant>EACCES</constant> or
1200 <constant>EUCLEAN</constant>. When this setting is not used,
1201 or when the empty string is assigned, the process will be
1202 terminated immediately when the filter is
1203 triggered.</para></listitem>
1204 </varlistentry>
1205
1206 <varlistentry>
1207 <term><varname>SystemCallArchitectures=</varname></term>
1208
b938cb90 1209 <listitem><para>Takes a space-separated list of architecture
798d3a52
ZJS
1210 identifiers to include in the system call filter. The known
1211 architecture identifiers are <constant>x86</constant>,
1212 <constant>x86-64</constant>, <constant>x32</constant>,
1213 <constant>arm</constant> as well as the special identifier
1214 <constant>native</constant>. Only system calls of the
1215 specified architectures will be permitted to processes of this
1216 unit. This is an effective way to disable compatibility with
1217 non-native architectures for processes, for example to
1218 prohibit execution of 32-bit x86 binaries on 64-bit x86-64
1219 systems. The special <constant>native</constant> identifier
1220 implicitly maps to the native architecture of the system (or
1221 more strictly: to the architecture the system manager is
19c0b0b9
RC
1222 compiled for). If running in user mode, or in system mode,
1223 but without the <constant>CAP_SYS_ADMIN</constant>
1224 capabiblity (e.g. setting <varname>User=nobody</varname>),
1225 <varname>NoNewPrivileges=yes</varname> is implied. Note
798d3a52
ZJS
1226 that setting this option to a non-empty list implies that
1227 <constant>native</constant> is included too. By default, this
1228 option is set to the empty list, i.e. no architecture system
1229 call filtering is applied.</para></listitem>
1230 </varlistentry>
1231
1232 <varlistentry>
1233 <term><varname>RestrictAddressFamilies=</varname></term>
1234
1235 <listitem><para>Restricts the set of socket address families
1236 accessible to the processes of this unit. Takes a
1237 space-separated list of address family names to whitelist,
1238 such as
1239 <constant>AF_UNIX</constant>,
1240 <constant>AF_INET</constant> or
1241 <constant>AF_INET6</constant>. When
1242 prefixed with <constant>~</constant> the listed address
1243 families will be applied as blacklist, otherwise as whitelist.
1244 Note that this restricts access to the
3ba3a79d 1245 <citerefentry project='man-pages'><refentrytitle>socket</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1246 system call only. Sockets passed into the process by other
1247 means (for example, by using socket activation with socket
1248 units, see
1249 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1250 are unaffected. Also, sockets created with
1251 <function>socketpair()</function> (which creates connected
1252 AF_UNIX sockets only) are unaffected. Note that this option
1253 has no effect on 32-bit x86 and is ignored (but works
19c0b0b9
RC
1254 correctly on x86-64). If running in user mode, or in system
1255 mode, but without the <constant>CAP_SYS_ADMIN</constant>
1256 capabiblity (e.g. setting <varname>User=nobody</varname>),
1257 <varname>NoNewPrivileges=yes</varname> is implied. By
798d3a52
ZJS
1258 default, no restriction applies, all address families are
1259 accessible to processes. If assigned the empty string, any
1260 previous list changes are undone.</para>
1261
1262 <para>Use this option to limit exposure of processes to remote
1263 systems, in particular via exotic network protocols. Note that
1264 in most cases, the local <constant>AF_UNIX</constant> address
1265 family should be included in the configured whitelist as it is
1266 frequently used for local communication, including for
1267 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1268 logging.</para></listitem>
1269 </varlistentry>
1270
1271 <varlistentry>
1272 <term><varname>Personality=</varname></term>
1273
7882632d
LP
1274 <listitem><para>Controls which kernel architecture <citerefentry
1275 project='man-pages'><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry> shall report,
1276 when invoked by unit processes. Takes one of the architecture identifiers <constant>x86</constant>,
1277 <constant>x86-64</constant>, <constant>ppc</constant>, <constant>ppc-le</constant>, <constant>ppc64</constant>,
1278 <constant>ppc64-le</constant>, <constant>s390</constant> or <constant>s390x</constant>. Which personality
1279 architectures are supported depends on the system architecture. Usually the 64bit versions of the various
1280 system architectures support their immediate 32bit personality architecture counterpart, but no others. For
1281 example, <constant>x86-64</constant> systems support the <constant>x86-64</constant> and
1282 <constant>x86</constant> personalities but no others. The personality feature is useful when running 32-bit
1283 services on a 64-bit host system. If not specified, the personality is left unmodified and thus reflects the
1284 personality of the host system's kernel.</para></listitem>
798d3a52
ZJS
1285 </varlistentry>
1286
1287 <varlistentry>
1288 <term><varname>RuntimeDirectory=</varname></term>
1289 <term><varname>RuntimeDirectoryMode=</varname></term>
1290
1291 <listitem><para>Takes a list of directory names. If set, one
1292 or more directories by the specified names will be created
1293 below <filename>/run</filename> (for system services) or below
1294 <varname>$XDG_RUNTIME_DIR</varname> (for user services) when
1295 the unit is started, and removed when the unit is stopped. The
1296 directories will have the access mode specified in
1297 <varname>RuntimeDirectoryMode=</varname>, and will be owned by
1298 the user and group specified in <varname>User=</varname> and
1299 <varname>Group=</varname>. Use this to manage one or more
1300 runtime directories of the unit and bind their lifetime to the
1301 daemon runtime. The specified directory names must be
1302 relative, and may not include a <literal>/</literal>, i.e.
1303 must refer to simple directories to create or remove. This is
1304 particularly useful for unprivileged daemons that cannot
1305 create runtime directories in <filename>/run</filename> due to
1306 lack of privileges, and to make sure the runtime directory is
1307 cleaned up automatically after use. For runtime directories
1308 that require more complex or different configuration or
1309 lifetime guarantees, please consider using
1310 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
1311 </varlistentry>
1312
1313 </variablelist>
1314 </refsect1>
1315
1316 <refsect1>
1317 <title>Environment variables in spawned processes</title>
1318
1319 <para>Processes started by the system are executed in a clean
1320 environment in which select variables listed below are set. System
1321 processes started by systemd do not inherit variables from PID 1,
1322 but processes started by user systemd instances inherit all
1323 environment variables from the user systemd instance.
1324 </para>
1325
1326 <variablelist class='environment-variables'>
1327 <varlistentry>
1328 <term><varname>$PATH</varname></term>
1329
1330 <listitem><para>Colon-separated list of directories to use
1331 when launching executables. Systemd uses a fixed value of
1332 <filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename>:<filename>/sbin</filename>:<filename>/bin</filename>.
1333 </para></listitem>
1334 </varlistentry>
1335
1336 <varlistentry>
1337 <term><varname>$LANG</varname></term>
1338
1339 <listitem><para>Locale. Can be set in
3ba3a79d 1340 <citerefentry project='man-pages'><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
1341 or on the kernel command line (see
1342 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1343 and
1344 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
1345 </para></listitem>
1346 </varlistentry>
1347
1348 <varlistentry>
1349 <term><varname>$USER</varname></term>
1350 <term><varname>$LOGNAME</varname></term>
1351 <term><varname>$HOME</varname></term>
1352 <term><varname>$SHELL</varname></term>
1353
1354 <listitem><para>User name (twice), home directory, and the
1355 login shell. The variables are set for the units that have
1356 <varname>User=</varname> set, which includes user
1357 <command>systemd</command> instances. See
3ba3a79d 1358 <citerefentry project='die-net'><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
798d3a52
ZJS
1359 </para></listitem>
1360 </varlistentry>
1361
1362 <varlistentry>
1363 <term><varname>$XDG_RUNTIME_DIR</varname></term>
1364
1365 <listitem><para>The directory for volatile state. Set for the
1366 user <command>systemd</command> instance, and also in user
1367 sessions. See
1368 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
1369 </para></listitem>
1370 </varlistentry>
1371
1372 <varlistentry>
1373 <term><varname>$XDG_SESSION_ID</varname></term>
1374 <term><varname>$XDG_SEAT</varname></term>
1375 <term><varname>$XDG_VTNR</varname></term>
1376
1377 <listitem><para>The identifier of the session, the seat name,
1378 and virtual terminal of the session. Set by
1379 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1380 for login sessions. <varname>$XDG_SEAT</varname> and
1381 <varname>$XDG_VTNR</varname> will only be set when attached to
1382 a seat and a tty.</para></listitem>
1383 </varlistentry>
1384
1385 <varlistentry>
1386 <term><varname>$MAINPID</varname></term>
1387
1388 <listitem><para>The PID of the units main process if it is
1389 known. This is only set for control processes as invoked by
1390 <varname>ExecReload=</varname> and similar. </para></listitem>
1391 </varlistentry>
1392
1393 <varlistentry>
1394 <term><varname>$MANAGERPID</varname></term>
1395
1396 <listitem><para>The PID of the user <command>systemd</command>
1397 instance, set for processes spawned by it. </para></listitem>
1398 </varlistentry>
1399
1400 <varlistentry>
1401 <term><varname>$LISTEN_FDS</varname></term>
1402 <term><varname>$LISTEN_PID</varname></term>
5c019cf2 1403 <term><varname>$LISTEN_FDNAMES</varname></term>
798d3a52
ZJS
1404
1405 <listitem><para>Information about file descriptors passed to a
1406 service for socket activation. See
1407 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1408 </para></listitem>
1409 </varlistentry>
1410
5c019cf2
EV
1411 <varlistentry>
1412 <term><varname>$NOTIFY_SOCKET</varname></term>
1413
1414 <listitem><para>The socket
1415 <function>sd_notify()</function> talks to. See
1416 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1417 </para></listitem>
1418 </varlistentry>
1419
1420 <varlistentry>
1421 <term><varname>$WATCHDOG_PID</varname></term>
1422 <term><varname>$WATCHDOG_USEC</varname></term>
1423
1424 <listitem><para>Information about watchdog keep-alive notifications. See
1425 <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1426 </para></listitem>
1427 </varlistentry>
1428
798d3a52
ZJS
1429 <varlistentry>
1430 <term><varname>$TERM</varname></term>
1431
1432 <listitem><para>Terminal type, set only for units connected to
1433 a terminal (<varname>StandardInput=tty</varname>,
1434 <varname>StandardOutput=tty</varname>, or
1435 <varname>StandardError=tty</varname>). See
1436 <citerefentry project='man-pages'><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1437 </para></listitem>
1438 </varlistentry>
1439 </variablelist>
1440
1441 <para>Additional variables may be configured by the following
1442 means: for processes spawned in specific units, use the
5c019cf2
EV
1443 <varname>Environment=</varname>, <varname>EnvironmentFile=</varname>
1444 and <varname>PassEnvironment=</varname> options above; to specify
798d3a52
ZJS
1445 variables globally, use <varname>DefaultEnvironment=</varname>
1446 (see
1447 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1448 or the kernel option <varname>systemd.setenv=</varname> (see
1449 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
1450 Additional variables may also be set through PAM,
1451 cf. <citerefentry project='man-pages'><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
1452 </refsect1>
1453
1454 <refsect1>
1455 <title>See Also</title>
1456 <para>
1457 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1458 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1459 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1460 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1461 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1462 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1463 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1464 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1465 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1466 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
a4c18002 1467 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
798d3a52
ZJS
1468 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1469 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1470 <citerefentry project='man-pages'><refentrytitle>exec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1471 </para>
1472 </refsect1>
dd1eb43b
LP
1473
1474</refentry>