1 <?xml version='
1.0'
?> <!--*- Mode: nxml; nxml-child-indent: 2; indent-tabs-mode: nil -*-->
2 <!DOCTYPE refentry PUBLIC
"-//OASIS//DTD DocBook XML V4.2//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
6 This file is part of systemd.
8 Copyright 2010 Lennart Poettering
10 systemd is free software; you can redistribute it and/or modify it
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
13 (at your option) any later version.
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
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with systemd; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id=
"systemd.exec">
26 <title>systemd.exec
</title>
27 <productname>systemd
</productname>
31 <contrib>Developer
</contrib>
32 <firstname>Lennart
</firstname>
33 <surname>Poettering
</surname>
34 <email>lennart@poettering.net
</email>
40 <refentrytitle>systemd.exec
</refentrytitle>
41 <manvolnum>5</manvolnum>
45 <refname>systemd.exec
</refname>
46 <refpurpose>Execution environment configuration
</refpurpose>
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>
57 <title>Description
</title>
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
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>,
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
80 <title>Automatic Dependencies
</title>
82 <para>A few execution parameters result in additional, automatic
83 dependencies to be added.
</para>
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>
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>
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>
103 <title>Options
</title>
105 <variablelist class='unit-directives'
>
108 <term><varname>WorkingDirectory=
</varname></term>
110 <listitem><para>Takes a directory path relative to the service's root
111 directory specified by
<varname>RootDirectory=
</varname>, or the
112 special value
<literal>~
</literal>. Sets the working directory
113 for executed processes. If set to
<literal>~
</literal>, the
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
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
124 additional dependencies to be added to the unit (see
125 above).
</para></listitem>
129 <term><varname>RootDirectory=
</varname></term>
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
133 root directory for executed processes, with the
<citerefentry
134 project='man-pages'
><refentrytitle>chroot
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
135 system call. If this is used, it must be ensured that the
136 process binary and all its auxiliary files are available in
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>
143 <term><varname>User=
</varname></term>
144 <term><varname>Group=
</varname></term>
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
149 of the user is chosen.
</para></listitem>
153 <term><varname>SupplementaryGroups=
</varname></term>
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
158 once, in which case all listed groups are set as supplementary
159 groups. When the empty string is assigned, the list of
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
164 user.
</para></listitem>
168 <term><varname>Nice=
</varname></term>
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>
178 <term><varname>OOMScoreAdjust=
</varname></term>
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>
190 <term><varname>IOSchedulingClass=
</varname></term>
192 <listitem><para>Sets the I/O scheduling class for executed
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>
201 <term><varname>IOSchedulingPriority=
</varname></term>
203 <listitem><para>Sets the I/O scheduling priority for executed
204 processes. Takes an integer between
0 (highest priority) and
7
205 (lowest priority). The available priorities depend on the
206 selected I/O scheduling class (see above). See
207 <citerefentry><refentrytitle>ioprio_set
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
208 for details.
</para></listitem>
212 <term><varname>CPUSchedulingPolicy=
</varname></term>
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>
226 <term><varname>CPUSchedulingPriority=
</varname></term>
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>
238 <term><varname>CPUSchedulingResetOnFork=
</varname></term>
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
244 <citerefentry><refentrytitle>sched_setscheduler
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
245 for details. Defaults to false.
</para></listitem>
249 <term><varname>CPUAffinity=
</varname></term>
251 <listitem><para>Controls the CPU affinity of the executed
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.
255 This option may be specified more than once, in which case the
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>
264 <term><varname>UMask=
</varname></term>
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>
273 <term><varname>Environment=
</varname></term>
275 <listitem><para>Sets environment variables for executed
276 processes. Takes a space-separated list of variable
277 assignments. This option may be specified more than once, in
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>
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>.
298 <citerefentry project='man-pages'><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry>
299 for details about environment variables.</para></listitem>
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.
306 Empty lines, lines without an <literal>=</literal> separator,
307 or lines starting with ; or # will be ignored,
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>
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>
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
327 read it with this option in the next).
</para>
329 <para>Settings from these
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>
338 <term><varname>PassEnvironment=
</varname></term>
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>
348 <para>Variables passed from this setting are overridden by those passed
349 from
<varname>Environment=
</varname> or
350 <varname>EnvironmentFile=
</varname>.
</para>
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>
360 <citerefentry project='man-pages'
><refentrytitle>environ
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
361 for details about environment variables.
</para></listitem>
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>
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
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>
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
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
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
407 <citerefentry project='freebsd'
><refentrytitle>inetd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
410 <para>This setting defaults to
411 <option>null
</option>.
</para></listitem>
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>
429 <para><option>inherit
</option> duplicates the file descriptor
430 of standard input for standard output.
</para>
432 <para><option>null
</option> connects standard output to
433 <filename>/dev/null
</filename>, i.e. everything written to it
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
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
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>
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>
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
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>
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
478 <filename>systemd-journald.socket
</filename> (also see the automatic dependencies section above).
</para>
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>,
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>
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>,
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>
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
508 <filename>/dev/console
</filename>.
</para></listitem>
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>
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>
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>
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>
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>
565 <term><varname>SyslogLevel=
</varname></term>
566 <listitem><para>The default syslog level to use when logging to
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>,
585 see below. For details, see
586 <citerefentry><refentrytitle>sd-daemon
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
589 <option>info
</option>.
</para></listitem>
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
604 <citerefentry><refentrytitle>sd-daemon
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
605 Defaults to true.
</para></listitem>
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>
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>
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>
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>
670 <title>Limit directives and their equivalent with ulimit
</title>
673 <colspec colname='directive'
/>
674 <colspec colname='equivalent'
/>
675 <colspec colname='unit'
/>
678 <entry>Directive
</entry>
679 <entry>ulimit equivalent
</entry>
685 <entry>LimitCPU=
</entry>
686 <entry>ulimit -t
</entry>
687 <entry>Seconds
</entry>
690 <entry>LimitFSIZE=
</entry>
691 <entry>ulimit -f
</entry>
695 <entry>LimitDATA=
</entry>
696 <entry>ulimit -d
</entry>
700 <entry>LimitSTACK=
</entry>
701 <entry>ulimit -s
</entry>
705 <entry>LimitCORE=
</entry>
706 <entry>ulimit -c
</entry>
710 <entry>LimitRSS=
</entry>
711 <entry>ulimit -m
</entry>
715 <entry>LimitNOFILE=
</entry>
716 <entry>ulimit -n
</entry>
717 <entry>Number of File Descriptors
</entry>
720 <entry>LimitAS=
</entry>
721 <entry>ulimit -v
</entry>
725 <entry>LimitNPROC=
</entry>
726 <entry>ulimit -u
</entry>
727 <entry>Number of Processes
</entry>
730 <entry>LimitMEMLOCK=
</entry>
731 <entry>ulimit -l
</entry>
735 <entry>LimitLOCKS=
</entry>
736 <entry>ulimit -x
</entry>
737 <entry>Number of Locks
</entry>
740 <entry>LimitSIGPENDING=
</entry>
741 <entry>ulimit -i
</entry>
742 <entry>Number of Queued Signals
</entry>
745 <entry>LimitMSGQUEUE=
</entry>
746 <entry>ulimit -q
</entry>
750 <entry>LimitNICE=
</entry>
751 <entry>ulimit -e
</entry>
752 <entry>Nice Level
</entry>
755 <entry>LimitRTPRIO=
</entry>
756 <entry>ulimit -r
</entry>
757 <entry>Realtime Priority
</entry>
760 <entry>LimitRTTIME=
</entry>
761 <entry>No equivalent
</entry>
762 <entry>Microseconds
</entry>
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
777 <citerefentry project='man-pages'
><refentrytitle>pam
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
778 for details.
</para></listitem>
782 <term><varname>CapabilityBoundingSet=
</varname></term>
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
798 reset to the full set of available capabilities, also undoing any previous settings.
</para></listitem>
802 <term><varname>AmbientCapabilities=
</varname></term>
804 <listitem><para>Controls which capabilities to include in the
805 ambient capability set for the executed process. Takes a
806 whitespace-separated list of capability names as read by
807 <citerefentry project='mankier'
><refentrytitle>cap_from_name
</refentrytitle><manvolnum>3</manvolnum></citerefentry>,
808 e.g.
<constant>CAP_SYS_ADMIN
</constant>,
809 <constant>CAP_DAC_OVERRIDE
</constant>,
810 <constant>CAP_SYS_PTRACE
</constant>. This option may appear more than
811 once in which case the ambient capability sets are merged.
812 If the list of capabilities is prefixed with
<literal>~
</literal>, all
813 but the listed capabilities will be included, the effect of the
814 assignment inverted. If the empty string is
815 assigned to this option, the ambient capability set is reset to
816 the empty capability set, and all prior settings have no effect.
817 If set to
<literal>~
</literal> (without any further argument), the
818 ambient capability set is reset to the full set of available
819 capabilities, also undoing any previous settings. Note that adding
820 capabilities to ambient capability set adds them to the process's
821 inherited capability set.
823 Ambient capability sets are useful if you want to execute a process
824 as a non-privileged user but still want to give it some capabilities.
825 Note that in this case option
<constant>keep-caps
</constant> is
826 automatically added to
<varname>SecureBits=
</varname> to retain the
827 capabilities over the user change.
</para></listitem>
831 <term><varname>SecureBits=
</varname></term>
832 <listitem><para>Controls the secure bits set for the executed
833 process. Takes a space-separated combination of options from
835 <option>keep-caps
</option>,
836 <option>keep-caps-locked
</option>,
837 <option>no-setuid-fixup
</option>,
838 <option>no-setuid-fixup-locked
</option>,
839 <option>noroot
</option>, and
840 <option>noroot-locked
</option>.
841 This option may appear more than once, in which case the secure
842 bits are ORed. If the empty string is assigned to this option,
843 the bits are reset to
0. See
844 <citerefentry project='man-pages'
><refentrytitle>capabilities
</refentrytitle><manvolnum>7</manvolnum></citerefentry>
845 for details.
</para></listitem>
849 <term><varname>ReadWriteDirectories=
</varname></term>
850 <term><varname>ReadOnlyDirectories=
</varname></term>
851 <term><varname>InaccessibleDirectories=
</varname></term>
853 <listitem><para>Sets up a new file system namespace for
854 executed processes. These options may be used to limit access
855 a process might have to the main file system hierarchy. Each
856 setting takes a space-separated list of directory paths relative to
857 the host's root directory (i.e. the system running the service manager).
858 Directories listed in
859 <varname>ReadWriteDirectories=
</varname> are accessible from
860 within the namespace with the same access rights as from
861 outside. Directories listed in
862 <varname>ReadOnlyDirectories=
</varname> are accessible for
863 reading only, writing will be refused even if the usual file
864 access controls would permit this. Directories listed in
865 <varname>InaccessibleDirectories=
</varname> will be made
866 inaccessible for processes inside the namespace, and may not
867 countain any other mountpoints, including those specified by
868 <varname>ReadWriteDirectories=
</varname> or
869 <varname>ReadOnlyDirectories=
</varname>.
870 Note that restricting access with these options does not extend
871 to submounts of a directory that are created later on. These
872 options may be specified more than once, in which case all
873 directories listed will have limited access from within the
874 namespace. If the empty string is assigned to this option, the
875 specific list is reset, and all prior assignments have no
878 <varname>ReadOnlyDirectories=
</varname>
880 <varname>InaccessibleDirectories=
</varname>
882 <literal>-
</literal>, in which case
883 they will be ignored when they do not
884 exist. Note that using this
885 setting will disconnect propagation of
886 mounts from the service to the host
887 (propagation in the opposite direction
888 continues to work). This means that
889 this setting may not be used for
890 services which shall be able to
891 install mount points in the main mount
892 namespace.
</para></listitem>
896 <term><varname>PrivateTmp=
</varname></term>
898 <listitem><para>Takes a boolean argument. If true, sets up a
899 new file system namespace for the executed processes and
900 mounts private
<filename>/tmp
</filename> and
901 <filename>/var/tmp
</filename> directories inside it that is
902 not shared by processes outside of the namespace. This is
903 useful to secure access to temporary files of the process, but
904 makes sharing between processes via
<filename>/tmp
</filename>
905 or
<filename>/var/tmp
</filename> impossible. If this is
906 enabled, all temporary files created by a service in these
907 directories will be removed after the service is stopped.
908 Defaults to false. It is possible to run two or more units
909 within the same private
<filename>/tmp
</filename> and
910 <filename>/var/tmp
</filename> namespace by using the
911 <varname>JoinsNamespaceOf=
</varname> directive, see
912 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
913 for details. Note that using this setting will disconnect
914 propagation of mounts from the service to the host
915 (propagation in the opposite direction continues to work).
916 This means that this setting may not be used for services
917 which shall be able to install mount points in the main mount
918 namespace.
</para></listitem>
922 <term><varname>PrivateDevices=
</varname></term>
924 <listitem><para>Takes a boolean argument. If true, sets up a
925 new /dev namespace for the executed processes and only adds
926 API pseudo devices such as
<filename>/dev/null
</filename>,
927 <filename>/dev/zero
</filename> or
928 <filename>/dev/random
</filename> (as well as the pseudo TTY
929 subsystem) to it, but no physical devices such as
930 <filename>/dev/sda
</filename>. This is useful to securely turn
931 off physical device access by the executed process. Defaults
932 to false. Enabling this option will also remove
933 <constant>CAP_MKNOD
</constant> from the capability bounding
934 set for the unit (see above), and set
935 <varname>DevicePolicy=closed
</varname> (see
936 <citerefentry><refentrytitle>systemd.resource-control
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
937 for details). Note that using this setting will disconnect
938 propagation of mounts from the service to the host
939 (propagation in the opposite direction continues to work).
940 This means that this setting may not be used for services
941 which shall be able to install mount points in the main mount
942 namespace. The /dev namespace will be mounted read-only and 'noexec'.
943 The latter may break old programs which try to set up executable
944 memory by using
<citerefentry><refentrytitle>mmap
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
945 of
<filename>/dev/zero
</filename> instead of using
<constant>MAP_ANON
</constant>.
</para></listitem>
949 <term><varname>PrivateNetwork=
</varname></term>
951 <listitem><para>Takes a boolean argument. If true, sets up a
952 new network namespace for the executed processes and
953 configures only the loopback network device
954 <literal>lo
</literal> inside it. No other network devices will
955 be available to the executed process. This is useful to
956 securely turn off network access by the executed process.
957 Defaults to false. It is possible to run two or more units
958 within the same private network namespace by using the
959 <varname>JoinsNamespaceOf=
</varname> directive, see
960 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
961 for details. Note that this option will disconnect all socket
962 families from the host, this includes AF_NETLINK and AF_UNIX.
963 The latter has the effect that AF_UNIX sockets in the abstract
964 socket namespace will become unavailable to the processes
965 (however, those located in the file system will continue to be
966 accessible).
</para></listitem>
970 <term><varname>ProtectSystem=
</varname></term>
972 <listitem><para>Takes a boolean argument or
973 <literal>full
</literal>. If true, mounts the
974 <filename>/usr
</filename> and
<filename>/boot
</filename>
975 directories read-only for processes invoked by this unit. If
976 set to
<literal>full
</literal>, the
<filename>/etc
</filename>
977 directory is mounted read-only, too. This setting ensures that
978 any modification of the vendor-supplied operating system (and
979 optionally its configuration) is prohibited for the service.
980 It is recommended to enable this setting for all long-running
981 services, unless they are involved with system updates or need
982 to modify the operating system in other ways. Note however
983 that processes retaining the CAP_SYS_ADMIN capability can undo
984 the effect of this setting. This setting is hence particularly
985 useful for daemons which have this capability removed, for
986 example with
<varname>CapabilityBoundingSet=
</varname>.
987 Defaults to off.
</para></listitem>
991 <term><varname>ProtectHome=
</varname></term>
993 <listitem><para>Takes a boolean argument or
994 <literal>read-only
</literal>. If true, the directories
995 <filename>/home
</filename>,
<filename>/root
</filename> and
996 <filename>/run/user
</filename>
997 are made inaccessible and empty for processes invoked by this
998 unit. If set to
<literal>read-only
</literal>, the three
999 directories are made read-only instead. It is recommended to
1000 enable this setting for all long-running services (in
1001 particular network-facing ones), to ensure they cannot get
1002 access to private user data, unless the services actually
1003 require access to the user's private data. Note however that
1004 processes retaining the CAP_SYS_ADMIN capability can undo the
1005 effect of this setting. This setting is hence particularly
1006 useful for daemons which have this capability removed, for
1007 example with
<varname>CapabilityBoundingSet=
</varname>.
1008 Defaults to off.
</para></listitem>
1012 <term><varname>MountFlags=
</varname></term>
1014 <listitem><para>Takes a mount propagation flag:
1015 <option>shared
</option>,
<option>slave
</option> or
1016 <option>private
</option>, which control whether mounts in the
1017 file system namespace set up for this unit's processes will
1018 receive or propagate mounts or unmounts. See
1019 <citerefentry project='man-pages'
><refentrytitle>mount
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1020 for details. Defaults to
<option>shared
</option>. Use
1021 <option>shared
</option> to ensure that mounts and unmounts are
1022 propagated from the host to the container and vice versa. Use
1023 <option>slave
</option> to run processes so that none of their
1024 mounts and unmounts will propagate to the host. Use
1025 <option>private
</option> to also ensure that no mounts and
1026 unmounts from the host will propagate into the unit processes'
1027 namespace. Note that
<option>slave
</option> means that file
1028 systems mounted on the host might stay mounted continuously in
1029 the unit's namespace, and thus keep the device busy. Note that
1030 the file system namespace related options
1031 (
<varname>PrivateTmp=
</varname>,
1032 <varname>PrivateDevices=
</varname>,
1033 <varname>ProtectSystem=
</varname>,
1034 <varname>ProtectHome=
</varname>,
1035 <varname>ReadOnlyDirectories=
</varname>,
1036 <varname>InaccessibleDirectories=
</varname> and
1037 <varname>ReadWriteDirectories=
</varname>) require that mount
1038 and unmount propagation from the unit's file system namespace
1039 is disabled, and hence downgrade
<option>shared
</option> to
1040 <option>slave
</option>.
</para></listitem>
1044 <term><varname>UtmpIdentifier=
</varname></term>
1046 <listitem><para>Takes a four character identifier string for
1048 project='man-pages'
><refentrytitle>utmp
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1049 and wtmp entry for this service. This should only be
1050 set for services such as
<command>getty
</command>
1051 implementations (such as
<citerefentry
1052 project='die-net'
><refentrytitle>agetty
</refentrytitle><manvolnum>8</manvolnum></citerefentry>)
1053 where utmp/wtmp entries must be created and cleared before and
1054 after execution, or for services that shall be executed as if
1055 they were run by a
<command>getty
</command> process (see
1056 below). If the configured string is longer than four
1057 characters, it is truncated and the terminal four characters
1058 are used. This setting interprets %I style string
1059 replacements. This setting is unset by default, i.e. no
1060 utmp/wtmp entries are created or cleaned up for this
1061 service.
</para></listitem>
1065 <term><varname>UtmpMode=
</varname></term>
1067 <listitem><para>Takes one of
<literal>init
</literal>,
1068 <literal>login
</literal> or
<literal>user
</literal>. If
1069 <varname>UtmpIdentifier=
</varname> is set, controls which
1070 type of
<citerefentry
1071 project='man-pages'
><refentrytitle>utmp
</refentrytitle><manvolnum>5</manvolnum></citerefentry>/wtmp
1072 entries for this service are generated. This setting has no
1073 effect unless
<varname>UtmpIdentifier=
</varname> is set
1074 too. If
<literal>init
</literal> is set, only an
1075 <constant>INIT_PROCESS
</constant> entry is generated and the
1076 invoked process must implement a
1077 <command>getty
</command>-compatible utmp/wtmp logic. If
1078 <literal>login
</literal> is set, first an
1079 <constant>INIT_PROCESS
</constant> entry, followed by a
1080 <constant>LOGIN_PROCESS
</constant> entry is generated. In
1081 this case, the invoked process must implement a
<citerefentry
1082 project='die-net'
><refentrytitle>login
</refentrytitle><manvolnum>1</manvolnum></citerefentry>-compatible
1083 utmp/wtmp logic. If
<literal>user
</literal> is set, first an
1084 <constant>INIT_PROCESS
</constant> entry, then a
1085 <constant>LOGIN_PROCESS
</constant> entry and finally a
1086 <constant>USER_PROCESS
</constant> entry is generated. In this
1087 case, the invoked process may be any process that is suitable
1088 to be run as session leader. Defaults to
1089 <literal>init
</literal>.
</para></listitem>
1093 <term><varname>SELinuxContext=
</varname></term>
1095 <listitem><para>Set the SELinux security context of the
1096 executed process. If set, this will override the automated
1097 domain transition. However, the policy still needs to
1098 authorize the transition. This directive is ignored if SELinux
1099 is disabled. If prefixed by
<literal>-
</literal>, all errors
1100 will be ignored. See
1101 <citerefentry project='die-net'
><refentrytitle>setexeccon
</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1102 for details.
</para></listitem>
1106 <term><varname>AppArmorProfile=
</varname></term>
1108 <listitem><para>Takes a profile name as argument. The process
1109 executed by the unit will switch to this profile when started.
1110 Profiles must already be loaded in the kernel, or the unit
1111 will fail. This result in a non operation if AppArmor is not
1112 enabled. If prefixed by
<literal>-
</literal>, all errors will
1113 be ignored.
</para></listitem>
1117 <term><varname>SmackProcessLabel=
</varname></term>
1119 <listitem><para>Takes a
<option>SMACK64
</option> security
1120 label as argument. The process executed by the unit will be
1121 started under this label and SMACK will decide whether the
1122 process is allowed to run or not, based on it. The process
1123 will continue to run under the label specified here unless the
1124 executable has its own
<option>SMACK64EXEC
</option> label, in
1125 which case the process will transition to run under that
1126 label. When not specified, the label that systemd is running
1127 under is used. This directive is ignored if SMACK is
1130 <para>The value may be prefixed by
<literal>-
</literal>, in
1131 which case all errors will be ignored. An empty value may be
1132 specified to unset previous assignments.
</para>
1137 <term><varname>IgnoreSIGPIPE=
</varname></term>
1139 <listitem><para>Takes a boolean argument. If true, causes
1140 <constant>SIGPIPE
</constant> to be ignored in the executed
1141 process. Defaults to true because
<constant>SIGPIPE
</constant>
1142 generally is useful only in shell pipelines.
</para></listitem>
1146 <term><varname>NoNewPrivileges=
</varname></term>
1148 <listitem><para>Takes a boolean argument. If true, ensures
1149 that the service process and all its children can never gain
1150 new privileges. This option is more powerful than the
1151 respective secure bits flags (see above), as it also prohibits
1152 UID changes of any kind. This is the simplest, most effective
1153 way to ensure that a process and its children can never
1154 elevate privileges again.
</para></listitem>
1158 <term><varname>SystemCallFilter=
</varname></term>
1160 <listitem><para>Takes a space-separated list of system call
1161 names. If this setting is used, all system calls executed by
1162 the unit processes except for the listed ones will result in
1163 immediate process termination with the
1164 <constant>SIGSYS
</constant> signal (whitelisting). If the
1165 first character of the list is
<literal>~
</literal>, the
1166 effect is inverted: only the listed system calls will result
1167 in immediate process termination (blacklisting). If running in
1168 user mode, or in system mode, but without the
1169 <constant>CAP_SYS_ADMIN
</constant> capability (e.g. setting
1170 <varname>User=nobody
</varname>),
1171 <varname>NoNewPrivileges=yes
</varname> is implied. This
1172 feature makes use of the Secure Computing Mode
2 interfaces of
1173 the kernel ('seccomp filtering') and is useful for enforcing a
1174 minimal sandboxing environment. Note that the
1175 <function>execve
</function>,
1176 <function>rt_sigreturn
</function>,
1177 <function>sigreturn
</function>,
1178 <function>exit_group
</function>,
<function>exit
</function>
1179 system calls are implicitly whitelisted and do not need to be
1180 listed explicitly. This option may be specified more than once,
1181 in which case the filter masks are merged. If the empty string
1182 is assigned, the filter is reset, all prior assignments will
1183 have no effect.
</para>
1185 <para>If you specify both types of this option (i.e.
1186 whitelisting and blacklisting), the first encountered will
1187 take precedence and will dictate the default action
1188 (termination or approval of a system call). Then the next
1189 occurrences of this option will add or delete the listed
1190 system calls from the set of the filtered system calls,
1191 depending of its type and the default action. (For example, if
1192 you have started with a whitelisting of
1193 <function>read
</function> and
<function>write
</function>, and
1194 right after it add a blacklisting of
1195 <function>write
</function>, then
<function>write
</function>
1196 will be removed from the set.)
</para>
1198 <para>As the number of possible system
1199 calls is large, predefined sets of system calls are provided.
1200 A set starts with
<literal>@
</literal> character, followed by
1204 <title>Currently predefined system call sets
</title>
1207 <colspec colname='set'
/>
1208 <colspec colname='description'
/>
1212 <entry>Description
</entry>
1217 <entry>@clock
</entry>
1218 <entry>System calls for changing the system clock (
<function>adjtimex()
</function>,
1219 <function>settimeofday()
</function>)
</entry>
1222 <entry>@io-event
</entry>
1223 <entry>Event loop use (
<function>poll()
</function>,
<function>select()
</function>,
1224 <citerefentry project='man-pages'
><refentrytitle>epoll
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1225 <function>eventfd()
</function>...)
</entry>
1229 <entry>SysV IPC, POSIX Message Queues or other IPC (
<citerefentry project='man-pages'
><refentrytitle>mq_overview
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1230 <citerefentry project='man-pages'
><refentrytitle>svipc
</refentrytitle><manvolnum>7</manvolnum></citerefentry>)
</entry>
1233 <entry>@module
</entry>
1234 <entry>Kernel module control (
<function>create_module()
</function>,
<function>init_module()
</function>...)
</entry>
1237 <entry>@mount
</entry>
1238 <entry>File system mounting and unmounting (
<function>chroot()
</function>,
<function>mount()
</function>...)
</entry>
1241 <entry>@network-io
</entry>
1242 <entry>Socket I/O (including local AF_UNIX):
1243 <citerefentry project='man-pages'
><refentrytitle>socket
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1244 <citerefentry project='man-pages'
><refentrytitle>unix
</refentrytitle><manvolnum>7</manvolnum></citerefentry></entry>
1247 <entry>@obsolete
</entry>
1248 <entry>Unusual, obsolete or unimplemented (
<function>fattach()
</function>,
<function>gtty()
</function>,
<function>vm86()
</function>...)
</entry>
1251 <entry>@privileged
</entry>
1252 <entry>All system calls which need superuser capabilities (
<citerefentry project='man-pages'
><refentrytitle>capabilities
</refentrytitle><manvolnum>7</manvolnum></citerefentry>)
</entry>
1255 <entry>@process
</entry>
1256 <entry>Process control, execution, namespaces (
<function>execve()
</function>,
<function>kill()
</function>,
<citerefentry project='man-pages'
><refentrytitle>namespaces
</refentrytitle><manvolnum>7</manvolnum></citerefentry>...)
</entry>
1259 <entry>@raw-io
</entry>
1260 <entry>Raw I/O ports (
<function>ioperm()
</function>,
<function>iopl()
</function>,
<function>pciconfig_read()
</function>...)
</entry>
1266 Note, that as new system calls are added to the kernel, additional system calls might be added to the groups
1267 above, so the contents of the sets may change between systemd versions.
</para></listitem>
1271 <term><varname>SystemCallErrorNumber=
</varname></term>
1273 <listitem><para>Takes an
<literal>errno
</literal> error number
1274 name to return when the system call filter configured with
1275 <varname>SystemCallFilter=
</varname> is triggered, instead of
1276 terminating the process immediately. Takes an error name such
1277 as
<constant>EPERM
</constant>,
<constant>EACCES
</constant> or
1278 <constant>EUCLEAN
</constant>. When this setting is not used,
1279 or when the empty string is assigned, the process will be
1280 terminated immediately when the filter is
1281 triggered.
</para></listitem>
1285 <term><varname>SystemCallArchitectures=
</varname></term>
1287 <listitem><para>Takes a space-separated list of architecture
1288 identifiers to include in the system call filter. The known
1289 architecture identifiers are
<constant>x86
</constant>,
1290 <constant>x86-
64</constant>,
<constant>x32
</constant>,
1291 <constant>arm
</constant> as well as the special identifier
1292 <constant>native
</constant>. Only system calls of the
1293 specified architectures will be permitted to processes of this
1294 unit. This is an effective way to disable compatibility with
1295 non-native architectures for processes, for example to
1296 prohibit execution of
32-bit x86 binaries on
64-bit x86-
64
1297 systems. The special
<constant>native
</constant> identifier
1298 implicitly maps to the native architecture of the system (or
1299 more strictly: to the architecture the system manager is
1300 compiled for). If running in user mode, or in system mode,
1301 but without the
<constant>CAP_SYS_ADMIN
</constant>
1302 capability (e.g. setting
<varname>User=nobody
</varname>),
1303 <varname>NoNewPrivileges=yes
</varname> is implied. Note
1304 that setting this option to a non-empty list implies that
1305 <constant>native
</constant> is included too. By default, this
1306 option is set to the empty list, i.e. no architecture system
1307 call filtering is applied.
</para></listitem>
1311 <term><varname>RestrictAddressFamilies=
</varname></term>
1313 <listitem><para>Restricts the set of socket address families
1314 accessible to the processes of this unit. Takes a
1315 space-separated list of address family names to whitelist,
1317 <constant>AF_UNIX
</constant>,
1318 <constant>AF_INET
</constant> or
1319 <constant>AF_INET6
</constant>. When
1320 prefixed with
<constant>~
</constant> the listed address
1321 families will be applied as blacklist, otherwise as whitelist.
1322 Note that this restricts access to the
1323 <citerefentry project='man-pages'
><refentrytitle>socket
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1324 system call only. Sockets passed into the process by other
1325 means (for example, by using socket activation with socket
1327 <citerefentry><refentrytitle>systemd.socket
</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1328 are unaffected. Also, sockets created with
1329 <function>socketpair()
</function> (which creates connected
1330 AF_UNIX sockets only) are unaffected. Note that this option
1331 has no effect on
32-bit x86 and is ignored (but works
1332 correctly on x86-
64). If running in user mode, or in system
1333 mode, but without the
<constant>CAP_SYS_ADMIN
</constant>
1334 capability (e.g. setting
<varname>User=nobody
</varname>),
1335 <varname>NoNewPrivileges=yes
</varname> is implied. By
1336 default, no restriction applies, all address families are
1337 accessible to processes. If assigned the empty string, any
1338 previous list changes are undone.
</para>
1340 <para>Use this option to limit exposure of processes to remote
1341 systems, in particular via exotic network protocols. Note that
1342 in most cases, the local
<constant>AF_UNIX
</constant> address
1343 family should be included in the configured whitelist as it is
1344 frequently used for local communication, including for
1345 <citerefentry><refentrytitle>syslog
</refentrytitle><manvolnum>2</manvolnum></citerefentry>
1346 logging.
</para></listitem>
1350 <term><varname>Personality=
</varname></term>
1352 <listitem><para>Controls which kernel architecture
<citerefentry
1353 project='man-pages'
><refentrytitle>uname
</refentrytitle><manvolnum>2</manvolnum></citerefentry> shall report,
1354 when invoked by unit processes. Takes one of the architecture identifiers
<constant>x86
</constant>,
1355 <constant>x86-
64</constant>,
<constant>ppc
</constant>,
<constant>ppc-le
</constant>,
<constant>ppc64
</constant>,
1356 <constant>ppc64-le
</constant>,
<constant>s390
</constant> or
<constant>s390x
</constant>. Which personality
1357 architectures are supported depends on the system architecture. Usually the
64bit versions of the various
1358 system architectures support their immediate
32bit personality architecture counterpart, but no others. For
1359 example,
<constant>x86-
64</constant> systems support the
<constant>x86-
64</constant> and
1360 <constant>x86
</constant> personalities but no others. The personality feature is useful when running
32-bit
1361 services on a
64-bit host system. If not specified, the personality is left unmodified and thus reflects the
1362 personality of the host system's kernel.
</para></listitem>
1366 <term><varname>RuntimeDirectory=
</varname></term>
1367 <term><varname>RuntimeDirectoryMode=
</varname></term>
1369 <listitem><para>Takes a list of directory names. If set, one
1370 or more directories by the specified names will be created
1371 below
<filename>/run
</filename> (for system services) or below
1372 <varname>$XDG_RUNTIME_DIR
</varname> (for user services) when
1373 the unit is started, and removed when the unit is stopped. The
1374 directories will have the access mode specified in
1375 <varname>RuntimeDirectoryMode=
</varname>, and will be owned by
1376 the user and group specified in
<varname>User=
</varname> and
1377 <varname>Group=
</varname>. Use this to manage one or more
1378 runtime directories of the unit and bind their lifetime to the
1379 daemon runtime. The specified directory names must be
1380 relative, and may not include a
<literal>/
</literal>, i.e.
1381 must refer to simple directories to create or remove. This is
1382 particularly useful for unprivileged daemons that cannot
1383 create runtime directories in
<filename>/run
</filename> due to
1384 lack of privileges, and to make sure the runtime directory is
1385 cleaned up automatically after use. For runtime directories
1386 that require more complex or different configuration or
1387 lifetime guarantees, please consider using
1388 <citerefentry><refentrytitle>tmpfiles.d
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
</para></listitem>
1395 <title>Environment variables in spawned processes
</title>
1397 <para>Processes started by the system are executed in a clean
1398 environment in which select variables listed below are set. System
1399 processes started by systemd do not inherit variables from PID
1,
1400 but processes started by user systemd instances inherit all
1401 environment variables from the user systemd instance.
1404 <variablelist class='environment-variables'
>
1406 <term><varname>$PATH
</varname></term>
1408 <listitem><para>Colon-separated list of directories to use
1409 when launching executables. Systemd uses a fixed value of
1410 <filename>/usr/local/sbin
</filename>:
<filename>/usr/local/bin
</filename>:
<filename>/usr/sbin
</filename>:
<filename>/usr/bin
</filename>:
<filename>/sbin
</filename>:
<filename>/bin
</filename>.
1415 <term><varname>$LANG
</varname></term>
1417 <listitem><para>Locale. Can be set in
1418 <citerefentry project='man-pages'
><refentrytitle>locale.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>
1419 or on the kernel command line (see
1420 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>
1422 <citerefentry><refentrytitle>kernel-command-line
</refentrytitle><manvolnum>7</manvolnum></citerefentry>).
1427 <term><varname>$USER
</varname></term>
1428 <term><varname>$LOGNAME
</varname></term>
1429 <term><varname>$HOME
</varname></term>
1430 <term><varname>$SHELL
</varname></term>
1432 <listitem><para>User name (twice), home directory, and the
1433 login shell. The variables are set for the units that have
1434 <varname>User=
</varname> set, which includes user
1435 <command>systemd
</command> instances. See
1436 <citerefentry project='die-net'
><refentrytitle>passwd
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1441 <term><varname>$XDG_RUNTIME_DIR
</varname></term>
1443 <listitem><para>The directory for volatile state. Set for the
1444 user
<command>systemd
</command> instance, and also in user
1446 <citerefentry><refentrytitle>pam_systemd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
1451 <term><varname>$XDG_SESSION_ID
</varname></term>
1452 <term><varname>$XDG_SEAT
</varname></term>
1453 <term><varname>$XDG_VTNR
</varname></term>
1455 <listitem><para>The identifier of the session, the seat name,
1456 and virtual terminal of the session. Set by
1457 <citerefentry><refentrytitle>pam_systemd
</refentrytitle><manvolnum>8</manvolnum></citerefentry>
1458 for login sessions.
<varname>$XDG_SEAT
</varname> and
1459 <varname>$XDG_VTNR
</varname> will only be set when attached to
1460 a seat and a tty.
</para></listitem>
1464 <term><varname>$MAINPID
</varname></term>
1466 <listitem><para>The PID of the units main process if it is
1467 known. This is only set for control processes as invoked by
1468 <varname>ExecReload=
</varname> and similar.
</para></listitem>
1472 <term><varname>$MANAGERPID
</varname></term>
1474 <listitem><para>The PID of the user
<command>systemd
</command>
1475 instance, set for processes spawned by it.
</para></listitem>
1479 <term><varname>$LISTEN_FDS
</varname></term>
1480 <term><varname>$LISTEN_PID
</varname></term>
1481 <term><varname>$LISTEN_FDNAMES
</varname></term>
1483 <listitem><para>Information about file descriptors passed to a
1484 service for socket activation. See
1485 <citerefentry><refentrytitle>sd_listen_fds
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1490 <term><varname>$NOTIFY_SOCKET
</varname></term>
1492 <listitem><para>The socket
1493 <function>sd_notify()
</function> talks to. See
1494 <citerefentry><refentrytitle>sd_notify
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1499 <term><varname>$WATCHDOG_PID
</varname></term>
1500 <term><varname>$WATCHDOG_USEC
</varname></term>
1502 <listitem><para>Information about watchdog keep-alive notifications. See
1503 <citerefentry><refentrytitle>sd_watchdog_enabled
</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
1508 <term><varname>$TERM
</varname></term>
1510 <listitem><para>Terminal type, set only for units connected to
1511 a terminal (
<varname>StandardInput=tty
</varname>,
1512 <varname>StandardOutput=tty
</varname>, or
1513 <varname>StandardError=tty
</varname>). See
1514 <citerefentry project='man-pages'
><refentrytitle>termcap
</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
1519 <para>Additional variables may be configured by the following
1520 means: for processes spawned in specific units, use the
1521 <varname>Environment=
</varname>,
<varname>EnvironmentFile=
</varname>
1522 and
<varname>PassEnvironment=
</varname> options above; to specify
1523 variables globally, use
<varname>DefaultEnvironment=
</varname>
1525 <citerefentry><refentrytitle>systemd-system.conf
</refentrytitle><manvolnum>5</manvolnum></citerefentry>)
1526 or the kernel option
<varname>systemd.setenv=
</varname> (see
1527 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>).
1528 Additional variables may also be set through PAM,
1529 cf.
<citerefentry project='man-pages'
><refentrytitle>pam_env
</refentrytitle><manvolnum>8</manvolnum></citerefentry>.
</para>
1533 <title>See Also
</title>
1535 <citerefentry><refentrytitle>systemd
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1536 <citerefentry><refentrytitle>systemctl
</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
1537 <citerefentry><refentrytitle>journalctl
</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
1538 <citerefentry><refentrytitle>systemd.unit
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1539 <citerefentry><refentrytitle>systemd.service
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1540 <citerefentry><refentrytitle>systemd.socket
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1541 <citerefentry><refentrytitle>systemd.swap
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1542 <citerefentry><refentrytitle>systemd.mount
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1543 <citerefentry><refentrytitle>systemd.kill
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1544 <citerefentry><refentrytitle>systemd.resource-control
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1545 <citerefentry><refentrytitle>systemd.time
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1546 <citerefentry><refentrytitle>systemd.directives
</refentrytitle><manvolnum>7</manvolnum></citerefentry>,
1547 <citerefentry><refentrytitle>tmpfiles.d
</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
1548 <citerefentry project='man-pages'
><refentrytitle>exec
</refentrytitle><manvolnum>3</manvolnum></citerefentry>