]> git.ipfire.org Git - thirdparty/systemd.git/blame - man/systemd.exec.xml
doc,core: Read{Write,Only}Paths= and InaccessiblePaths=
[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 850 <varlistentry>
2a624c36
AP
851 <term><varname>ReadWritePaths=</varname></term>
852 <term><varname>ReadOnlyPaths=</varname></term>
853 <term><varname>InaccessiblePaths=</varname></term>
798d3a52
ZJS
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
c4b41707 858 setting takes a space-separated list of paths relative to
043cc715 859 the host's root directory (i.e. the system running the service manager).
c4b41707 860 Note that if entries contain symlinks, they are resolved from the host's root directory as well.
2a624c36
AP
861 Entries (files or directories) listed in
862 <varname>ReadWritePaths=</varname> are accessible from
798d3a52 863 within the namespace with the same access rights as from
c4b41707 864 outside. Entries listed in
2a624c36 865 <varname>ReadOnlyPaths=</varname> are accessible for
798d3a52 866 reading only, writing will be refused even if the usual file
c4b41707 867 access controls would permit this. Entries listed in
2a624c36 868 <varname>InaccessiblePaths=</varname> will be made
b50a16af
NBS
869 inaccessible for processes inside the namespace, and may not
870 countain any other mountpoints, including those specified by
2a624c36
AP
871 <varname>ReadWritePaths=</varname> or
872 <varname>ReadOnlyPaths=</varname>.
b50a16af 873 Note that restricting access with these options does not extend
c4b41707
AP
874 to submounts of a directory that are created later on.
875 Non-directory paths can be specified as well. These
b938cb90 876 options may be specified more than once, in which case all
c4b41707 877 paths listed will have limited access from within the
798d3a52
ZJS
878 namespace. If the empty string is assigned to this option, the
879 specific list is reset, and all prior assignments have no
880 effect.</para>
881 <para>Paths in
2a624c36 882 <varname>ReadOnlyPaths=</varname>
798d3a52 883 and
2a624c36 884 <varname>InaccessiblePaths=</varname>
798d3a52
ZJS
885 may be prefixed with
886 <literal>-</literal>, in which case
887 they will be ignored when they do not
888 exist. Note that using this
889 setting will disconnect propagation of
890 mounts from the service to the host
891 (propagation in the opposite direction
892 continues to work). This means that
893 this setting may not be used for
894 services which shall be able to
895 install mount points in the main mount
896 namespace.</para></listitem>
897 </varlistentry>
898
899 <varlistentry>
900 <term><varname>PrivateTmp=</varname></term>
901
902 <listitem><para>Takes a boolean argument. If true, sets up a
903 new file system namespace for the executed processes and
904 mounts private <filename>/tmp</filename> and
905 <filename>/var/tmp</filename> directories inside it that is
906 not shared by processes outside of the namespace. This is
907 useful to secure access to temporary files of the process, but
908 makes sharing between processes via <filename>/tmp</filename>
909 or <filename>/var/tmp</filename> impossible. If this is
910 enabled, all temporary files created by a service in these
911 directories will be removed after the service is stopped.
912 Defaults to false. It is possible to run two or more units
913 within the same private <filename>/tmp</filename> and
914 <filename>/var/tmp</filename> namespace by using the
915 <varname>JoinsNamespaceOf=</varname> directive, see
916 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
917 for details. Note that using this setting will disconnect
918 propagation of mounts from the service to the host
919 (propagation in the opposite direction continues to work).
920 This means that this setting may not be used for services
921 which shall be able to install mount points in the main mount
922 namespace.</para></listitem>
923 </varlistentry>
924
925 <varlistentry>
926 <term><varname>PrivateDevices=</varname></term>
927
928 <listitem><para>Takes a boolean argument. If true, sets up a
929 new /dev namespace for the executed processes and only adds
930 API pseudo devices such as <filename>/dev/null</filename>,
931 <filename>/dev/zero</filename> or
932 <filename>/dev/random</filename> (as well as the pseudo TTY
933 subsystem) to it, but no physical devices such as
934 <filename>/dev/sda</filename>. This is useful to securely turn
935 off physical device access by the executed process. Defaults
936 to false. Enabling this option will also remove
937 <constant>CAP_MKNOD</constant> from the capability bounding
938 set for the unit (see above), and set
939 <varname>DevicePolicy=closed</varname> (see
940 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>
941 for details). Note that using this setting will disconnect
942 propagation of mounts from the service to the host
943 (propagation in the opposite direction continues to work).
944 This means that this setting may not be used for services
945 which shall be able to install mount points in the main mount
737ba3c8 946 namespace. The /dev namespace will be mounted read-only and 'noexec'.
947 The latter may break old programs which try to set up executable
948 memory by using <citerefentry><refentrytitle>mmap</refentrytitle><manvolnum>2</manvolnum></citerefentry>
949 of <filename>/dev/zero</filename> instead of using <constant>MAP_ANON</constant>.</para></listitem>
798d3a52
ZJS
950 </varlistentry>
951
952 <varlistentry>
953 <term><varname>PrivateNetwork=</varname></term>
954
955 <listitem><para>Takes a boolean argument. If true, sets up a
956 new network namespace for the executed processes and
957 configures only the loopback network device
958 <literal>lo</literal> inside it. No other network devices will
959 be available to the executed process. This is useful to
960 securely turn off network access by the executed process.
961 Defaults to false. It is possible to run two or more units
962 within the same private network namespace by using the
963 <varname>JoinsNamespaceOf=</varname> directive, see
964 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>
965 for details. Note that this option will disconnect all socket
966 families from the host, this includes AF_NETLINK and AF_UNIX.
967 The latter has the effect that AF_UNIX sockets in the abstract
968 socket namespace will become unavailable to the processes
969 (however, those located in the file system will continue to be
970 accessible).</para></listitem>
971 </varlistentry>
972
973 <varlistentry>
974 <term><varname>ProtectSystem=</varname></term>
975
976 <listitem><para>Takes a boolean argument or
977 <literal>full</literal>. If true, mounts the
978 <filename>/usr</filename> and <filename>/boot</filename>
979 directories read-only for processes invoked by this unit. If
980 set to <literal>full</literal>, the <filename>/etc</filename>
981 directory is mounted read-only, too. This setting ensures that
b938cb90 982 any modification of the vendor-supplied operating system (and
798d3a52
ZJS
983 optionally its configuration) is prohibited for the service.
984 It is recommended to enable this setting for all long-running
985 services, unless they are involved with system updates or need
986 to modify the operating system in other ways. Note however
987 that processes retaining the CAP_SYS_ADMIN capability can undo
988 the effect of this setting. This setting is hence particularly
989 useful for daemons which have this capability removed, for
990 example with <varname>CapabilityBoundingSet=</varname>.
991 Defaults to off.</para></listitem>
992 </varlistentry>
993
994 <varlistentry>
995 <term><varname>ProtectHome=</varname></term>
996
997 <listitem><para>Takes a boolean argument or
998 <literal>read-only</literal>. If true, the directories
58331437
CH
999 <filename>/home</filename>, <filename>/root</filename> and
1000 <filename>/run/user</filename>
798d3a52 1001 are made inaccessible and empty for processes invoked by this
58331437 1002 unit. If set to <literal>read-only</literal>, the three
798d3a52
ZJS
1003 directories are made read-only instead. It is recommended to
1004 enable this setting for all long-running services (in
1005 particular network-facing ones), to ensure they cannot get
1006 access to private user data, unless the services actually
1007 require access to the user's private data. Note however that
1008 processes retaining the CAP_SYS_ADMIN capability can undo the
1009 effect of this setting. This setting is hence particularly
1010 useful for daemons which have this capability removed, for
1011 example with <varname>CapabilityBoundingSet=</varname>.
1012 Defaults to off.</para></listitem>
1013 </varlistentry>
1014
1015 <varlistentry>
1016 <term><varname>MountFlags=</varname></term>
1017
1018 <listitem><para>Takes a mount propagation flag:
1019 <option>shared</option>, <option>slave</option> or
1020 <option>private</option>, which control whether mounts in the
1021 file system namespace set up for this unit's processes will
1022 receive or propagate mounts or unmounts. See
3ba3a79d 1023 <citerefentry project='man-pages'><refentrytitle>mount</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1024 for details. Defaults to <option>shared</option>. Use
1025 <option>shared</option> to ensure that mounts and unmounts are
1026 propagated from the host to the container and vice versa. Use
1027 <option>slave</option> to run processes so that none of their
1028 mounts and unmounts will propagate to the host. Use
1029 <option>private</option> to also ensure that no mounts and
1030 unmounts from the host will propagate into the unit processes'
1031 namespace. Note that <option>slave</option> means that file
1032 systems mounted on the host might stay mounted continuously in
1033 the unit's namespace, and thus keep the device busy. Note that
1034 the file system namespace related options
1035 (<varname>PrivateTmp=</varname>,
1036 <varname>PrivateDevices=</varname>,
1037 <varname>ProtectSystem=</varname>,
1038 <varname>ProtectHome=</varname>,
2a624c36
AP
1039 <varname>ReadOnlyPaths=</varname>,
1040 <varname>InaccessiblePaths=</varname> and
1041 <varname>ReadWritePaths=</varname>) require that mount
798d3a52
ZJS
1042 and unmount propagation from the unit's file system namespace
1043 is disabled, and hence downgrade <option>shared</option> to
1044 <option>slave</option>. </para></listitem>
1045 </varlistentry>
1046
1047 <varlistentry>
1048 <term><varname>UtmpIdentifier=</varname></term>
1049
1050 <listitem><para>Takes a four character identifier string for
023a4f67
LP
1051 an <citerefentry
1052 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1053 and wtmp entry for this service. This should only be
1054 set for services such as <command>getty</command>
1055 implementations (such as <citerefentry
1056 project='die-net'><refentrytitle>agetty</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
798d3a52 1057 where utmp/wtmp entries must be created and cleared before and
023a4f67
LP
1058 after execution, or for services that shall be executed as if
1059 they were run by a <command>getty</command> process (see
1060 below). If the configured string is longer than four
798d3a52
ZJS
1061 characters, it is truncated and the terminal four characters
1062 are used. This setting interprets %I style string
1063 replacements. This setting is unset by default, i.e. no
1064 utmp/wtmp entries are created or cleaned up for this
1065 service.</para></listitem>
1066 </varlistentry>
1067
023a4f67
LP
1068 <varlistentry>
1069 <term><varname>UtmpMode=</varname></term>
1070
1071 <listitem><para>Takes one of <literal>init</literal>,
1072 <literal>login</literal> or <literal>user</literal>. If
1073 <varname>UtmpIdentifier=</varname> is set, controls which
1074 type of <citerefentry
1075 project='man-pages'><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry>/wtmp
1076 entries for this service are generated. This setting has no
1077 effect unless <varname>UtmpIdentifier=</varname> is set
1078 too. If <literal>init</literal> is set, only an
1079 <constant>INIT_PROCESS</constant> entry is generated and the
6cd16034
LP
1080 invoked process must implement a
1081 <command>getty</command>-compatible utmp/wtmp logic. If
1082 <literal>login</literal> is set, first an
a8eaaee7 1083 <constant>INIT_PROCESS</constant> entry, followed by a
6cd16034 1084 <constant>LOGIN_PROCESS</constant> entry is generated. In
b938cb90 1085 this case, the invoked process must implement a <citerefentry
023a4f67
LP
1086 project='die-net'><refentrytitle>login</refentrytitle><manvolnum>1</manvolnum></citerefentry>-compatible
1087 utmp/wtmp logic. If <literal>user</literal> is set, first an
1088 <constant>INIT_PROCESS</constant> entry, then a
a8eaaee7 1089 <constant>LOGIN_PROCESS</constant> entry and finally a
023a4f67 1090 <constant>USER_PROCESS</constant> entry is generated. In this
b938cb90 1091 case, the invoked process may be any process that is suitable
023a4f67
LP
1092 to be run as session leader. Defaults to
1093 <literal>init</literal>.</para></listitem>
1094 </varlistentry>
1095
798d3a52
ZJS
1096 <varlistentry>
1097 <term><varname>SELinuxContext=</varname></term>
1098
1099 <listitem><para>Set the SELinux security context of the
1100 executed process. If set, this will override the automated
1101 domain transition. However, the policy still needs to
1102 authorize the transition. This directive is ignored if SELinux
1103 is disabled. If prefixed by <literal>-</literal>, all errors
cf677fe6
AP
1104 will be ignored. This does not affect commands prefixed with <literal>!</literal>.
1105 See <citerefentry project='die-net'><refentrytitle>setexeccon</refentrytitle><manvolnum>3</manvolnum></citerefentry>
798d3a52
ZJS
1106 for details.</para></listitem>
1107 </varlistentry>
1108
1109 <varlistentry>
1110 <term><varname>AppArmorProfile=</varname></term>
1111
1112 <listitem><para>Takes a profile name as argument. The process
1113 executed by the unit will switch to this profile when started.
1114 Profiles must already be loaded in the kernel, or the unit
1115 will fail. This result in a non operation if AppArmor is not
1116 enabled. If prefixed by <literal>-</literal>, all errors will
cf677fe6 1117 be ignored. This does not affect commands prefixed with <literal>!</literal>.</para></listitem>
798d3a52
ZJS
1118 </varlistentry>
1119
1120 <varlistentry>
1121 <term><varname>SmackProcessLabel=</varname></term>
1122
1123 <listitem><para>Takes a <option>SMACK64</option> security
1124 label as argument. The process executed by the unit will be
1125 started under this label and SMACK will decide whether the
b938cb90 1126 process is allowed to run or not, based on it. The process
798d3a52
ZJS
1127 will continue to run under the label specified here unless the
1128 executable has its own <option>SMACK64EXEC</option> label, in
1129 which case the process will transition to run under that
1130 label. When not specified, the label that systemd is running
1131 under is used. This directive is ignored if SMACK is
1132 disabled.</para>
1133
1134 <para>The value may be prefixed by <literal>-</literal>, in
1135 which case all errors will be ignored. An empty value may be
cf677fe6
AP
1136 specified to unset previous assignments. This does not affect
1137 commands prefixed with <literal>!</literal>.</para>
798d3a52
ZJS
1138 </listitem>
1139 </varlistentry>
1140
1141 <varlistentry>
1142 <term><varname>IgnoreSIGPIPE=</varname></term>
1143
1144 <listitem><para>Takes a boolean argument. If true, causes
1145 <constant>SIGPIPE</constant> to be ignored in the executed
1146 process. Defaults to true because <constant>SIGPIPE</constant>
1147 generally is useful only in shell pipelines.</para></listitem>
1148 </varlistentry>
1149
1150 <varlistentry>
1151 <term><varname>NoNewPrivileges=</varname></term>
1152
1153 <listitem><para>Takes a boolean argument. If true, ensures
1154 that the service process and all its children can never gain
1155 new privileges. This option is more powerful than the
1156 respective secure bits flags (see above), as it also prohibits
1157 UID changes of any kind. This is the simplest, most effective
1158 way to ensure that a process and its children can never
1159 elevate privileges again.</para></listitem>
1160 </varlistentry>
1161
1162 <varlistentry>
1163 <term><varname>SystemCallFilter=</varname></term>
1164
1165 <listitem><para>Takes a space-separated list of system call
1166 names. If this setting is used, all system calls executed by
1167 the unit processes except for the listed ones will result in
1168 immediate process termination with the
1169 <constant>SIGSYS</constant> signal (whitelisting). If the
1170 first character of the list is <literal>~</literal>, the
1171 effect is inverted: only the listed system calls will result
1172 in immediate process termination (blacklisting). If running in
19c0b0b9 1173 user mode, or in system mode, but without the
008dce38 1174 <constant>CAP_SYS_ADMIN</constant> capability (e.g. setting
19c0b0b9 1175 <varname>User=nobody</varname>),
798d3a52
ZJS
1176 <varname>NoNewPrivileges=yes</varname> is implied. This
1177 feature makes use of the Secure Computing Mode 2 interfaces of
1178 the kernel ('seccomp filtering') and is useful for enforcing a
1179 minimal sandboxing environment. Note that the
1180 <function>execve</function>,
1181 <function>rt_sigreturn</function>,
1182 <function>sigreturn</function>,
1183 <function>exit_group</function>, <function>exit</function>
1184 system calls are implicitly whitelisted and do not need to be
b938cb90 1185 listed explicitly. This option may be specified more than once,
798d3a52
ZJS
1186 in which case the filter masks are merged. If the empty string
1187 is assigned, the filter is reset, all prior assignments will
cf677fe6 1188 have no effect. This does not affect commands prefixed with <literal>!</literal>.</para>
798d3a52
ZJS
1189
1190 <para>If you specify both types of this option (i.e.
1191 whitelisting and blacklisting), the first encountered will
1192 take precedence and will dictate the default action
1193 (termination or approval of a system call). Then the next
1194 occurrences of this option will add or delete the listed
1195 system calls from the set of the filtered system calls,
1196 depending of its type and the default action. (For example, if
1197 you have started with a whitelisting of
1198 <function>read</function> and <function>write</function>, and
1199 right after it add a blacklisting of
1200 <function>write</function>, then <function>write</function>
201c1cc2
TM
1201 will be removed from the set.)</para>
1202
1203 <para>As the number of possible system
1204 calls is large, predefined sets of system calls are provided.
1205 A set starts with <literal>@</literal> character, followed by
1206 name of the set.
1207
1208 <table>
1209 <title>Currently predefined system call sets</title>
1210
1211 <tgroup cols='2'>
1212 <colspec colname='set' />
1213 <colspec colname='description' />
1214 <thead>
1215 <row>
1216 <entry>Set</entry>
1217 <entry>Description</entry>
1218 </row>
1219 </thead>
1220 <tbody>
1221 <row>
1222 <entry>@clock</entry>
1f9ac68b
LP
1223 <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>
1224 </row>
1225 <row>
1226 <entry>@cpu-emulation</entry>
1227 <entry>System calls for CPU emulation functionality (<citerefentry project='man-pages'><refentrytitle>vm86</refentrytitle><manvolnum>2</manvolnum></citerefentry> and related calls)</entry>
1228 </row>
1229 <row>
1230 <entry>@debug</entry>
1231 <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
1232 </row>
1233 <row>
1234 <entry>@io-event</entry>
1f9ac68b 1235 <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
1236 </row>
1237 <row>
1238 <entry>@ipc</entry>
1f9ac68b
LP
1239 <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>
1240 </row>
1241 <row>
1242 <entry>@keyring</entry>
1243 <entry>Kernel keyring access (<citerefentry project='man-pages'><refentrytitle>keyctl</refentrytitle><manvolnum>2</manvolnum></citerefentry> and related calls)</entry>
201c1cc2
TM
1244 </row>
1245 <row>
1246 <entry>@module</entry>
1f9ac68b 1247 <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
1248 </row>
1249 <row>
1250 <entry>@mount</entry>
1f9ac68b 1251 <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
1252 </row>
1253 <row>
1254 <entry>@network-io</entry>
1f9ac68b 1255 <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
1256 </row>
1257 <row>
1258 <entry>@obsolete</entry>
1f9ac68b 1259 <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
1260 </row>
1261 <row>
1262 <entry>@privileged</entry>
1f9ac68b 1263 <entry>All system calls which need super-user capabilities (<citerefentry project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry>)</entry>
201c1cc2
TM
1264 </row>
1265 <row>
1266 <entry>@process</entry>
1f9ac68b 1267 <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
1268 </row>
1269 <row>
1270 <entry>@raw-io</entry>
1f9ac68b 1271 <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
1272 </row>
1273 </tbody>
1274 </tgroup>
1275 </table>
1276
1277 Note, that as new system calls are added to the kernel, additional system calls might be added to the groups
1278 above, so the contents of the sets may change between systemd versions.</para></listitem>
798d3a52
ZJS
1279 </varlistentry>
1280
1281 <varlistentry>
1282 <term><varname>SystemCallErrorNumber=</varname></term>
1283
1284 <listitem><para>Takes an <literal>errno</literal> error number
1285 name to return when the system call filter configured with
1286 <varname>SystemCallFilter=</varname> is triggered, instead of
1287 terminating the process immediately. Takes an error name such
1288 as <constant>EPERM</constant>, <constant>EACCES</constant> or
1289 <constant>EUCLEAN</constant>. When this setting is not used,
1290 or when the empty string is assigned, the process will be
1291 terminated immediately when the filter is
1292 triggered.</para></listitem>
1293 </varlistentry>
1294
1295 <varlistentry>
1296 <term><varname>SystemCallArchitectures=</varname></term>
1297
b938cb90 1298 <listitem><para>Takes a space-separated list of architecture
798d3a52
ZJS
1299 identifiers to include in the system call filter. The known
1300 architecture identifiers are <constant>x86</constant>,
1301 <constant>x86-64</constant>, <constant>x32</constant>,
1302 <constant>arm</constant> as well as the special identifier
1303 <constant>native</constant>. Only system calls of the
1304 specified architectures will be permitted to processes of this
1305 unit. This is an effective way to disable compatibility with
1306 non-native architectures for processes, for example to
1307 prohibit execution of 32-bit x86 binaries on 64-bit x86-64
1308 systems. The special <constant>native</constant> identifier
1309 implicitly maps to the native architecture of the system (or
1310 more strictly: to the architecture the system manager is
19c0b0b9
RC
1311 compiled for). If running in user mode, or in system mode,
1312 but without the <constant>CAP_SYS_ADMIN</constant>
008dce38 1313 capability (e.g. setting <varname>User=nobody</varname>),
19c0b0b9 1314 <varname>NoNewPrivileges=yes</varname> is implied. Note
798d3a52
ZJS
1315 that setting this option to a non-empty list implies that
1316 <constant>native</constant> is included too. By default, this
1317 option is set to the empty list, i.e. no architecture system
1318 call filtering is applied.</para></listitem>
1319 </varlistentry>
1320
1321 <varlistentry>
1322 <term><varname>RestrictAddressFamilies=</varname></term>
1323
1324 <listitem><para>Restricts the set of socket address families
1325 accessible to the processes of this unit. Takes a
1326 space-separated list of address family names to whitelist,
1327 such as
1328 <constant>AF_UNIX</constant>,
1329 <constant>AF_INET</constant> or
1330 <constant>AF_INET6</constant>. When
1331 prefixed with <constant>~</constant> the listed address
1332 families will be applied as blacklist, otherwise as whitelist.
1333 Note that this restricts access to the
3ba3a79d 1334 <citerefentry project='man-pages'><refentrytitle>socket</refentrytitle><manvolnum>2</manvolnum></citerefentry>
798d3a52
ZJS
1335 system call only. Sockets passed into the process by other
1336 means (for example, by using socket activation with socket
1337 units, see
1338 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1339 are unaffected. Also, sockets created with
1340 <function>socketpair()</function> (which creates connected
1341 AF_UNIX sockets only) are unaffected. Note that this option
1342 has no effect on 32-bit x86 and is ignored (but works
19c0b0b9
RC
1343 correctly on x86-64). If running in user mode, or in system
1344 mode, but without the <constant>CAP_SYS_ADMIN</constant>
008dce38 1345 capability (e.g. setting <varname>User=nobody</varname>),
19c0b0b9 1346 <varname>NoNewPrivileges=yes</varname> is implied. By
798d3a52
ZJS
1347 default, no restriction applies, all address families are
1348 accessible to processes. If assigned the empty string, any
1349 previous list changes are undone.</para>
1350
1351 <para>Use this option to limit exposure of processes to remote
1352 systems, in particular via exotic network protocols. Note that
1353 in most cases, the local <constant>AF_UNIX</constant> address
1354 family should be included in the configured whitelist as it is
1355 frequently used for local communication, including for
1356 <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>2</manvolnum></citerefentry>
cf677fe6 1357 logging. This does not affect commands prefixed with <literal>!</literal>.</para></listitem>
798d3a52
ZJS
1358 </varlistentry>
1359
1360 <varlistentry>
1361 <term><varname>Personality=</varname></term>
1362
7882632d
LP
1363 <listitem><para>Controls which kernel architecture <citerefentry
1364 project='man-pages'><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry> shall report,
1365 when invoked by unit processes. Takes one of the architecture identifiers <constant>x86</constant>,
1366 <constant>x86-64</constant>, <constant>ppc</constant>, <constant>ppc-le</constant>, <constant>ppc64</constant>,
1367 <constant>ppc64-le</constant>, <constant>s390</constant> or <constant>s390x</constant>. Which personality
1368 architectures are supported depends on the system architecture. Usually the 64bit versions of the various
1369 system architectures support their immediate 32bit personality architecture counterpart, but no others. For
1370 example, <constant>x86-64</constant> systems support the <constant>x86-64</constant> and
1371 <constant>x86</constant> personalities but no others. The personality feature is useful when running 32-bit
1372 services on a 64-bit host system. If not specified, the personality is left unmodified and thus reflects the
1373 personality of the host system's kernel.</para></listitem>
798d3a52
ZJS
1374 </varlistentry>
1375
1376 <varlistentry>
1377 <term><varname>RuntimeDirectory=</varname></term>
1378 <term><varname>RuntimeDirectoryMode=</varname></term>
1379
1380 <listitem><para>Takes a list of directory names. If set, one
1381 or more directories by the specified names will be created
1382 below <filename>/run</filename> (for system services) or below
1383 <varname>$XDG_RUNTIME_DIR</varname> (for user services) when
1384 the unit is started, and removed when the unit is stopped. The
1385 directories will have the access mode specified in
1386 <varname>RuntimeDirectoryMode=</varname>, and will be owned by
1387 the user and group specified in <varname>User=</varname> and
1388 <varname>Group=</varname>. Use this to manage one or more
1389 runtime directories of the unit and bind their lifetime to the
1390 daemon runtime. The specified directory names must be
1391 relative, and may not include a <literal>/</literal>, i.e.
1392 must refer to simple directories to create or remove. This is
1393 particularly useful for unprivileged daemons that cannot
1394 create runtime directories in <filename>/run</filename> due to
1395 lack of privileges, and to make sure the runtime directory is
1396 cleaned up automatically after use. For runtime directories
1397 that require more complex or different configuration or
1398 lifetime guarantees, please consider using
1399 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem>
1400 </varlistentry>
1401
f3e43635
TM
1402 <varlistentry>
1403 <term><varname>MemoryDenyWriteExecute=</varname></term>
1404
1405 <listitem><para>Takes a boolean argument. If set, attempts to create memory mappings that are writable and
1406 executable at the same time, or to change existing memory mappings to become executable are prohibited.
1407 Specifically, a system call filter is added that rejects
1408 <citerefentry><refentrytitle>mmap</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1409 system calls with both <constant>PROT_EXEC</constant> and <constant>PROT_WRITE</constant> set
1410 and <citerefentry><refentrytitle>mprotect</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1411 system calls with <constant>PROT_EXEC</constant> set. Note that this option is incompatible with programs
1412 that generate program code dynamically at runtime, such as JIT execution engines, or programs compiled making
1413 use of the code "trampoline" feature of various C compilers. This option improves service security, as it makes
1414 harder for software exploits to change running code dynamically.
1415 </para></listitem>
1416 </varlistentry>
1417
f4170c67
LP
1418 <varlistentry>
1419 <term><varname>RestrictRealtime=</varname></term>
1420
1421 <listitem><para>Takes a boolean argument. If set, any attempts to enable realtime scheduling in a process of
1422 the unit are refused. This restricts access to realtime task scheduling policies such as
1423 <constant>SCHED_FIFO</constant>, <constant>SCHED_RR</constant> or <constant>SCHED_DEADLINE</constant>. See
1424 <citerefentry><refentrytitle>sched</refentrytitle><manvolnum>7</manvolnum></citerefentry> for details about
1425 these scheduling policies. Realtime scheduling policies may be used to monopolize CPU time for longer periods
1426 of time, and may hence be used to lock up or otherwise trigger Denial-of-Service situations on the system. It
1427 is hence recommended to restrict access to realtime scheduling to the few programs that actually require
1428 them. Defaults to off.</para></listitem>
1429 </varlistentry>
1430
798d3a52
ZJS
1431 </variablelist>
1432 </refsect1>
1433
1434 <refsect1>
1435 <title>Environment variables in spawned processes</title>
1436
1437 <para>Processes started by the system are executed in a clean
1438 environment in which select variables listed below are set. System
1439 processes started by systemd do not inherit variables from PID 1,
1440 but processes started by user systemd instances inherit all
1441 environment variables from the user systemd instance.
1442 </para>
1443
1444 <variablelist class='environment-variables'>
1445 <varlistentry>
1446 <term><varname>$PATH</varname></term>
1447
1448 <listitem><para>Colon-separated list of directories to use
1449 when launching executables. Systemd uses a fixed value of
1450 <filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename>:<filename>/sbin</filename>:<filename>/bin</filename>.
1451 </para></listitem>
1452 </varlistentry>
1453
1454 <varlistentry>
1455 <term><varname>$LANG</varname></term>
1456
1457 <listitem><para>Locale. Can be set in
3ba3a79d 1458 <citerefentry project='man-pages'><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
798d3a52
ZJS
1459 or on the kernel command line (see
1460 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1461 and
1462 <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
1463 </para></listitem>
1464 </varlistentry>
1465
1466 <varlistentry>
1467 <term><varname>$USER</varname></term>
1468 <term><varname>$LOGNAME</varname></term>
1469 <term><varname>$HOME</varname></term>
1470 <term><varname>$SHELL</varname></term>
1471
1472 <listitem><para>User name (twice), home directory, and the
1473 login shell. The variables are set for the units that have
1474 <varname>User=</varname> set, which includes user
1475 <command>systemd</command> instances. See
3ba3a79d 1476 <citerefentry project='die-net'><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
798d3a52
ZJS
1477 </para></listitem>
1478 </varlistentry>
1479
1480 <varlistentry>
1481 <term><varname>$XDG_RUNTIME_DIR</varname></term>
1482
1483 <listitem><para>The directory for volatile state. Set for the
1484 user <command>systemd</command> instance, and also in user
1485 sessions. See
1486 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
1487 </para></listitem>
1488 </varlistentry>
1489
1490 <varlistentry>
1491 <term><varname>$XDG_SESSION_ID</varname></term>
1492 <term><varname>$XDG_SEAT</varname></term>
1493 <term><varname>$XDG_VTNR</varname></term>
1494
1495 <listitem><para>The identifier of the session, the seat name,
1496 and virtual terminal of the session. Set by
1497 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1498 for login sessions. <varname>$XDG_SEAT</varname> and
1499 <varname>$XDG_VTNR</varname> will only be set when attached to
1500 a seat and a tty.</para></listitem>
1501 </varlistentry>
1502
1503 <varlistentry>
1504 <term><varname>$MAINPID</varname></term>
1505
1506 <listitem><para>The PID of the units main process if it is
1507 known. This is only set for control processes as invoked by
1508 <varname>ExecReload=</varname> and similar. </para></listitem>
1509 </varlistentry>
1510
1511 <varlistentry>
1512 <term><varname>$MANAGERPID</varname></term>
1513
1514 <listitem><para>The PID of the user <command>systemd</command>
1515 instance, set for processes spawned by it. </para></listitem>
1516 </varlistentry>
1517
1518 <varlistentry>
1519 <term><varname>$LISTEN_FDS</varname></term>
1520 <term><varname>$LISTEN_PID</varname></term>
5c019cf2 1521 <term><varname>$LISTEN_FDNAMES</varname></term>
798d3a52
ZJS
1522
1523 <listitem><para>Information about file descriptors passed to a
1524 service for socket activation. See
1525 <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1526 </para></listitem>
1527 </varlistentry>
1528
5c019cf2
EV
1529 <varlistentry>
1530 <term><varname>$NOTIFY_SOCKET</varname></term>
1531
1532 <listitem><para>The socket
1533 <function>sd_notify()</function> talks to. See
1534 <citerefentry><refentrytitle>sd_notify</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1535 </para></listitem>
1536 </varlistentry>
1537
1538 <varlistentry>
1539 <term><varname>$WATCHDOG_PID</varname></term>
1540 <term><varname>$WATCHDOG_USEC</varname></term>
1541
1542 <listitem><para>Information about watchdog keep-alive notifications. See
1543 <citerefentry><refentrytitle>sd_watchdog_enabled</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1544 </para></listitem>
1545 </varlistentry>
1546
798d3a52
ZJS
1547 <varlistentry>
1548 <term><varname>$TERM</varname></term>
1549
1550 <listitem><para>Terminal type, set only for units connected to
1551 a terminal (<varname>StandardInput=tty</varname>,
1552 <varname>StandardOutput=tty</varname>, or
1553 <varname>StandardError=tty</varname>). See
1554 <citerefentry project='man-pages'><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1555 </para></listitem>
1556 </varlistentry>
7bce046b
LP
1557
1558 <varlistentry>
1559 <term><varname>$JOURNAL_STREAM</varname></term>
1560
1561 <listitem><para>If the standard output or standard error output of the executed processes are connected to the
1562 journal (for example, by setting <varname>StandardError=journal</varname>) <varname>$JOURNAL_STREAM</varname>
1563 contains the device and inode numbers of the connection file descriptor, formatted in decimal, separated by a
1564 colon (<literal>:</literal>). This permits invoked processes to safely detect whether their standard output or
1565 standard error output are connected to the journal. The device and inode numbers of the file descriptors should
1566 be compared with the values set in the environment variable to determine whether the process output is still
1567 connected to the journal. Note that it is generally not sufficient to only check whether
1568 <varname>$JOURNAL_STREAM</varname> is set at all as services might invoke external processes replacing their
1569 standard output or standard error output, without unsetting the environment variable.</para>
1570
1571 <para>This environment variable is primarily useful to allow services to optionally upgrade their used log
1572 protocol to the native journal protocol (using
1573 <citerefentry><refentrytitle>sd_journal_print</refentrytitle><manvolnum>3</manvolnum></citerefentry> and other
1574 functions) if their standard output or standard error output is connected to the journal anyway, thus enabling
1575 delivery of structured metadata along with logged messages.</para></listitem>
1576 </varlistentry>
798d3a52
ZJS
1577 </variablelist>
1578
1579 <para>Additional variables may be configured by the following
1580 means: for processes spawned in specific units, use the
5c019cf2
EV
1581 <varname>Environment=</varname>, <varname>EnvironmentFile=</varname>
1582 and <varname>PassEnvironment=</varname> options above; to specify
798d3a52
ZJS
1583 variables globally, use <varname>DefaultEnvironment=</varname>
1584 (see
1585 <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1586 or the kernel option <varname>systemd.setenv=</varname> (see
1587 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
1588 Additional variables may also be set through PAM,
1589 cf. <citerefentry project='man-pages'><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
1590 </refsect1>
1591
1592 <refsect1>
1593 <title>See Also</title>
1594 <para>
1595 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1596 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1597 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1598 <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1599 <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1600 <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1601 <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1602 <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1603 <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1604 <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
a4c18002 1605 <citerefentry><refentrytitle>systemd.time</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
798d3a52
ZJS
1606 <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1607 <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1608 <citerefentry project='man-pages'><refentrytitle>exec</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1609 </para>
1610 </refsect1>
dd1eb43b
LP
1611
1612</refentry>