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