1SYSTEMD.EXEC(5) systemd.exec SYSTEMD.EXEC(5)
2
3
4
6 systemd.exec - Execution environment configuration
7
9 service.service, socket.socket, mount.mount, swap.swap
10
12 Unit configuration files for services, sockets, mount points, and swap
13 devices share a subset of configuration options which define the
14 execution environment of spawned processes.
15
16 This man page lists the configuration options shared by these four unit
17 types. See systemd.unit(5) for the common options of all unit
18 configuration files, and systemd.service(5), systemd.socket(5),
19 systemd.swap(5), and systemd.mount(5) for more information on the
20 specific unit configuration files. The execution specific configuration
21 options are configured in the [Service], [Socket], [Mount], or [Swap]
22 sections, depending on the unit type.
23
24 In addition, options which control resources through Linux Control
25 Groups (cgroups) are listed in systemd.resource-control(5). Those
26 options complement options listed here.
27
29 A few execution parameters result in additional, automatic dependencies
30 to be added:
31
32 · Units with WorkingDirectory=, RootDirectory=, RootImage=,
33 RuntimeDirectory=, StateDirectory=, CacheDirectory=, LogsDirectory=
34 or ConfigurationDirectory= set automatically gain dependencies of
35 type Requires= and After= on all mount units required to access the
36 specified paths. This is equivalent to having them listed
37 explicitly in RequiresMountsFor=.
38
39 · Similar, units with PrivateTmp= enabled automatically get mount
40 unit dependencies for all mounts required to access /tmp and
41 /var/tmp. They will also gain an automatic After= dependency on
42 systemd-tmpfiles-setup.service(8).
43
44 · Units whose standard output or error output is connected to
45 journal, syslog or kmsg (or their combinations with console output,
46 see below) automatically acquire dependencies of type After= on
47 systemd-journald.socket.
48
50 The following settings may be used to change a service's view of the
51 filesystem. Please note that the paths must be absolute and must not
52 contain a ".." path component.
53
54 WorkingDirectory=
55 Takes a directory path relative to the service's root directory
56 specified by RootDirectory=, or the special value "~". Sets the
57 working directory for executed processes. If set to "~", the home
58 directory of the user specified in User= is used. If not set,
59 defaults to the root directory when systemd is running as a system
60 instance and the respective user's home directory if run as user.
61 If the setting is prefixed with the "-" character, a missing
62 working directory is not considered fatal. If
63 RootDirectory=/RootImage= is not set, then WorkingDirectory= is
64 relative to the root of the system running the service manager.
65 Note that setting this parameter might result in additional
66 dependencies to be added to the unit (see above).
67
68 RootDirectory=
69 Takes a directory path relative to the host's root directory (i.e.
70 the root of the system running the service manager). Sets the root
71 directory for executed processes, with the chroot(2) system call.
72 If this is used, it must be ensured that the process binary and all
73 its auxiliary files are available in the chroot() jail. Note that
74 setting this parameter might result in additional dependencies to
75 be added to the unit (see above).
76
77 The MountAPIVFS= and PrivateUsers= settings are particularly useful
78 in conjunction with RootDirectory=. For details, see below.
79
80 This option is only available for system services and is not
81 supported for services running in per-user instances of the service
82 manager.
83
84 RootImage=
85 Takes a path to a block device node or regular file as argument.
86 This call is similar to RootDirectory= however mounts a file system
87 hierarchy from a block device node or loopback file instead of a
88 directory. The device node or file system image file needs to
89 contain a file system without a partition table, or a file system
90 within an MBR/MS-DOS or GPT partition table with only a single
91 Linux-compatible partition, or a set of file systems within a GPT
92 partition table that follows the Discoverable Partitions
93 Specification[1].
94
95 When DevicePolicy= is set to "closed" or "strict", or set to "auto"
96 and DeviceAllow= is set, then this setting adds /dev/loop-control
97 with rw mode, "block-loop" and "block-blkext" with rwm mode to
98 DeviceAllow=. See systemd.resource-control(5) for the details about
99 DevicePolicy= or DeviceAllow=. Also, see PrivateDevices= below, as
100 it may change the setting of DevicePolicy=.
101
102 This option is only available for system services and is not
103 supported for services running in per-user instances of the service
104 manager.
105
106 MountAPIVFS=
107 Takes a boolean argument. If on, a private mount namespace for the
108 unit's processes is created and the API file systems /proc, /sys,
109 and /dev are mounted inside of it, unless they are already mounted.
110 Note that this option has no effect unless used in conjunction with
111 RootDirectory=/RootImage= as these three mounts are generally
112 mounted in the host anyway, and unless the root directory is
113 changed, the private mount namespace will be a 1:1 copy of the
114 host's, and include these three mounts. Note that the /dev file
115 system of the host is bind mounted if this option is used without
116 PrivateDevices=. To run the service with a private, minimal version
117 of /dev/, combine this option with PrivateDevices=.
118
119 This option is only available for system services and is not
120 supported for services running in per-user instances of the service
121 manager.
122
123 BindPaths=, BindReadOnlyPaths=
124 Configures unit-specific bind mounts. A bind mount makes a
125 particular file or directory available at an additional place in
126 the unit's view of the file system. Any bind mounts created with
127 this option are specific to the unit, and are not visible in the
128 host's mount table. This option expects a whitespace separated list
129 of bind mount definitions. Each definition consists of a
130 colon-separated triple of source path, destination path and option
131 string, where the latter two are optional. If only a source path is
132 specified the source and destination is taken to be the same. The
133 option string may be either "rbind" or "norbind" for configuring a
134 recursive or non-recursive bind mount. If the destination path is
135 omitted, the option string must be omitted too. Each bind mount
136 definition may be prefixed with "-", in which case it will be
137 ignored when its source path does not exist.
138
139 BindPaths= creates regular writable bind mounts (unless the source
140 file system mount is already marked read-only), while
141 BindReadOnlyPaths= creates read-only bind mounts. These settings
142 may be used more than once, each usage appends to the unit's list
143 of bind mounts. If the empty string is assigned to either of these
144 two options the entire list of bind mounts defined prior to this is
145 reset. Note that in this case both read-only and regular bind
146 mounts are reset, regardless which of the two settings is used.
147
148 This option is particularly useful when RootDirectory=/RootImage=
149 is used. In this case the source path refers to a path on the host
150 file system, while the destination path refers to a path below the
151 root directory of the unit.
152
153 Note that the destination directory must exist or systemd must be
154 able to create it. Thus, it is not possible to use those options
155 for mount points nested underneath paths specified in
156 InaccessiblePaths=, or under /home/ and other protected directories
157 if ProtectHome=yes is specified. TemporaryFileSystem= with ":ro"
158 or ProtectHome=tmpfs should be used instead.
159
160 This option is only available for system services and is not
161 supported for services running in per-user instances of the service
162 manager.
163
165 These options are only available for system services and are not
166 supported for services running in per-user instances of the service
167 manager.
168
169 User=, Group=
170 Set the UNIX user or group that the processes are executed as,
171 respectively. Takes a single user or group name, or a numeric ID as
172 argument. For system services (services run by the system service
173 manager, i.e. managed by PID 1) and for user services of the root
174 user (services managed by root's instance of systemd --user), the
175 default is "root", but User= may be used to specify a different
176 user. For user services of any other user, switching user identity
177 is not permitted, hence the only valid setting is the same user the
178 user's service manager is running as. If no group is set, the
179 default group of the user is used. This setting does not affect
180 commands whose command line is prefixed with "+".
181
182 Note that restrictions on the user/group name syntax are enforced:
183 the specified name must consist only of the characters a-z, A-Z,
184 0-9, "_" and "-", except for the first character which must be one
185 of a-z, A-Z or "_" (i.e. numbers and "-" are not permitted as first
186 character). The user/group name must have at least one character,
187 and at most 31. These restrictions are enforced in order to avoid
188 ambiguities and to ensure user/group names and unit files remain
189 portable among Linux systems.
190
191 When used in conjunction with DynamicUser= the user/group name
192 specified is dynamically allocated at the time the service is
193 started, and released at the time the service is stopped — unless
194 it is already allocated statically (see below). If DynamicUser= is
195 not used the specified user and group must have been created
196 statically in the user database no later than the moment the
197 service is started, for example using the sysusers.d(5) facility,
198 which is applied at boot or package install time.
199
200 If the User= setting is used the supplementary group list is
201 initialized from the specified user's default group list, as
202 defined in the system's user and group database. Additional groups
203 may be configured through the SupplementaryGroups= setting (see
204 below).
205
206 DynamicUser=
207 Takes a boolean parameter. If set, a UNIX user and group pair is
208 allocated dynamically when the unit is started, and released as
209 soon as it is stopped. The user and group will not be added to
210 /etc/passwd or /etc/group, but are managed transiently during
211 runtime. The nss-systemd(8) glibc NSS module provides integration
212 of these dynamic users/groups into the system's user and group
213 databases. The user and group name to use may be configured via
214 User= and Group= (see above). If these options are not used and
215 dynamic user/group allocation is enabled for a unit, the name of
216 the dynamic user/group is implicitly derived from the unit name. If
217 the unit name without the type suffix qualifies as valid user name
218 it is used directly, otherwise a name incorporating a hash of it is
219 used. If a statically allocated user or group of the configured
220 name already exists, it is used and no dynamic user/group is
221 allocated. Note that if User= is specified and the static group
222 with the name exists, then it is required that the static user with
223 the name already exists. Similarly, if Group= is specified and the
224 static user with the name exists, then it is required that the
225 static group with the name already exists. Dynamic users/groups are
226 allocated from the UID/GID range 61184...65519. It is recommended
227 to avoid this range for regular system or login users. At any point
228 in time each UID/GID from this range is only assigned to zero or
229 one dynamically allocated users/groups in use. However, UID/GIDs
230 are recycled after a unit is terminated. Care should be taken that
231 any processes running as part of a unit for which dynamic
232 users/groups are enabled do not leave files or directories owned by
233 these users/groups around, as a different unit might get the same
234 UID/GID assigned later on, and thus gain access to these files or
235 directories. If DynamicUser= is enabled, RemoveIPC= and PrivateTmp=
236 are implied (and cannot be turned off). This ensures that the
237 lifetime of IPC objects and temporary files created by the executed
238 processes is bound to the runtime of the service, and hence the
239 lifetime of the dynamic user/group. Since /tmp/ and /var/tmp/ are
240 usually the only world-writable directories on a system this
241 ensures that a unit making use of dynamic user/group allocation
242 cannot leave files around after unit termination. Furthermore
243 NoNewPrivileges= and RestrictSUIDSGID= are implicitly enabled (and
244 cannot be disabled), to ensure that processes invoked cannot take
245 benefit or create SUID/SGID files or directories. Moreover
246 ProtectSystem=strict and ProtectHome=read-only are implied, thus
247 prohibiting the service to write to arbitrary file system
248 locations. In order to allow the service to write to certain
249 directories, they have to be whitelisted using ReadWritePaths=, but
250 care must be taken so that UID/GID recycling doesn't create
251 security issues involving files created by the service. Use
252 RuntimeDirectory= (see below) in order to assign a writable runtime
253 directory to a service, owned by the dynamic user/group and removed
254 automatically when the unit is terminated. Use StateDirectory=,
255 CacheDirectory= and LogsDirectory= in order to assign a set of
256 writable directories for specific purposes to the service in a way
257 that they are protected from vulnerabilities due to UID reuse (see
258 below). If this option is enabled, care should be taken that the
259 unit's processes do not get access to directories outside of these
260 explicitly configured and managed ones. Specifically, do not use
261 BindPaths= and be careful with AF_UNIX file descriptor passing for
262 directory file descriptors, as this would permit processes to
263 create files or directories owned by the dynamic user/group that
264 are not subject to the lifecycle and access guarantees of the
265 service. Defaults to off.
266
267 SupplementaryGroups=
268 Sets the supplementary Unix groups the processes are executed as.
269 This takes a space-separated list of group names or IDs. This
270 option may be specified more than once, in which case all listed
271 groups are set as supplementary groups. When the empty string is
272 assigned, the list of supplementary groups is reset, and all
273 assignments prior to this one will have no effect. In any way, this
274 option does not override, but extends the list of supplementary
275 groups configured in the system group database for the user. This
276 does not affect commands prefixed with "+".
277
278 PAMName=
279 Sets the PAM service name to set up a session as. If set, the
280 executed process will be registered as a PAM session under the
281 specified service name. This is only useful in conjunction with the
282 User= setting, and is otherwise ignored. If not set, no PAM session
283 will be opened for the executed processes. See pam(8) for details.
284
285 Note that for each unit making use of this option a PAM session
286 handler process will be maintained as part of the unit and stays
287 around as long as the unit is active, to ensure that appropriate
288 actions can be taken when the unit and hence the PAM session
289 terminates. This process is named "(sd-pam)" and is an immediate
290 child process of the unit's main process.
291
292 Note that when this option is used for a unit it is very likely
293 (depending on PAM configuration) that the main unit process will be
294 migrated to its own session scope unit when it is activated. This
295 process will hence be associated with two units: the unit it was
296 originally started from (and for which PAMName= was configured),
297 and the session scope unit. Any child processes of that process
298 will however be associated with the session scope unit only. This
299 has implications when used in combination with NotifyAccess=all, as
300 these child processes will not be able to affect changes in the
301 original unit through notification messages. These messages will be
302 considered belonging to the session scope unit and not the original
303 unit. It is hence not recommended to use PAMName= in combination
304 with NotifyAccess=all.
305
307 These options are only available for system services and are not
308 supported for services running in per-user instances of the service
309 manager.
310
311 CapabilityBoundingSet=
312 Controls which capabilities to include in the capability bounding
313 set for the executed process. See capabilities(7) for details.
314 Takes a whitespace-separated list of capability names, e.g.
315 CAP_SYS_ADMIN, CAP_DAC_OVERRIDE, CAP_SYS_PTRACE. Capabilities
316 listed will be included in the bounding set, all others are
317 removed. If the list of capabilities is prefixed with "~", all but
318 the listed capabilities will be included, the effect of the
319 assignment inverted. Note that this option also affects the
320 respective capabilities in the effective, permitted and inheritable
321 capability sets. If this option is not used, the capability
322 bounding set is not modified on process execution, hence no limits
323 on the capabilities of the process are enforced. This option may
324 appear more than once, in which case the bounding sets are merged
325 by OR, or by AND if the lines are prefixed with "~" (see below). If
326 the empty string is assigned to this option, the bounding set is
327 reset to the empty capability set, and all prior settings have no
328 effect. If set to "~" (without any further argument), the bounding
329 set is reset to the full set of available capabilities, also
330 undoing any previous settings. This does not affect commands
331 prefixed with "+".
332
333 Example: if a unit has the following,
334
335 CapabilityBoundingSet=CAP_A CAP_B
336 CapabilityBoundingSet=CAP_B CAP_C
337
338 then CAP_A, CAP_B, and CAP_C are set. If the second line is
339 prefixed with "~", e.g.,
340
341 CapabilityBoundingSet=CAP_A CAP_B
342 CapabilityBoundingSet=~CAP_B CAP_C
343
344 then, only CAP_A is set.
345
346 AmbientCapabilities=
347 Controls which capabilities to include in the ambient capability
348 set for the executed process. Takes a whitespace-separated list of
349 capability names, e.g. CAP_SYS_ADMIN, CAP_DAC_OVERRIDE,
350 CAP_SYS_PTRACE. This option may appear more than once in which case
351 the ambient capability sets are merged (see the above examples in
352 CapabilityBoundingSet=). If the list of capabilities is prefixed
353 with "~", all but the listed capabilities will be included, the
354 effect of the assignment inverted. If the empty string is assigned
355 to this option, the ambient capability set is reset to the empty
356 capability set, and all prior settings have no effect. If set to
357 "~" (without any further argument), the ambient capability set is
358 reset to the full set of available capabilities, also undoing any
359 previous settings. Note that adding capabilities to ambient
360 capability set adds them to the process's inherited capability set.
361
362 Ambient capability sets are useful if you want to execute a process
363 as a non-privileged user but still want to give it some
364 capabilities. Note that in this case option keep-caps is
365 automatically added to SecureBits= to retain the capabilities over
366 the user change. AmbientCapabilities= does not affect commands
367 prefixed with "+".
368
370 NoNewPrivileges=
371 Takes a boolean argument. If true, ensures that the service process
372 and all its children can never gain new privileges through execve()
373 (e.g. via setuid or setgid bits, or filesystem capabilities). This
374 is the simplest and most effective way to ensure that a process and
375 its children can never elevate privileges again. Defaults to false,
376 but certain settings override this and ignore the value of this
377 setting. This is the case when SystemCallFilter=,
378 SystemCallArchitectures=, RestrictAddressFamilies=,
379 RestrictNamespaces=, PrivateDevices=, ProtectKernelTunables=,
380 ProtectKernelModules=, MemoryDenyWriteExecute=, RestrictRealtime=,
381 RestrictSUIDSGID=, DynamicUser= or LockPersonality= are specified.
382 Note that even if this setting is overridden by them, systemctl
383 show shows the original value of this setting. Also see No New
384 Privileges Flag[2].
385
386 SecureBits=
387 Controls the secure bits set for the executed process. Takes a
388 space-separated combination of options from the following list:
389 keep-caps, keep-caps-locked, no-setuid-fixup,
390 no-setuid-fixup-locked, noroot, and noroot-locked. This option may
391 appear more than once, in which case the secure bits are ORed. If
392 the empty string is assigned to this option, the bits are reset to
393 0. This does not affect commands prefixed with "+". See
394 capabilities(7) for details.
395
397 These options are only available for system services and are not
398 supported for services running in per-user instances of the service
399 manager.
400
401 SELinuxContext=
402 Set the SELinux security context of the executed process. If set,
403 this will override the automated domain transition. However, the
404 policy still needs to authorize the transition. This directive is
405 ignored if SELinux is disabled. If prefixed by "-", all errors will
406 be ignored. This does not affect commands prefixed with "+". See
407 setexeccon(3) for details.
408
409 AppArmorProfile=
410 Takes a profile name as argument. The process executed by the unit
411 will switch to this profile when started. Profiles must already be
412 loaded in the kernel, or the unit will fail. This result in a non
413 operation if AppArmor is not enabled. If prefixed by "-", all
414 errors will be ignored. This does not affect commands prefixed with
415 "+".
416
417 SmackProcessLabel=
418 Takes a SMACK64 security label as argument. The process executed by
419 the unit will be started under this label and SMACK will decide
420 whether the process is allowed to run or not, based on it. The
421 process will continue to run under the label specified here unless
422 the executable has its own SMACK64EXEC label, in which case the
423 process will transition to run under that label. When not
424 specified, the label that systemd is running under is used. This
425 directive is ignored if SMACK is disabled.
426
427 The value may be prefixed by "-", in which case all errors will be
428 ignored. An empty value may be specified to unset previous
429 assignments. This does not affect commands prefixed with "+".
430
432 LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=,
433 LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=,
434 LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=,
435 LimitRTTIME=
436 Set soft and hard limits on various resources for executed
437 processes. See setrlimit(2) for details on the resource limit
438 concept. Resource limits may be specified in two formats: either as
439 single value to set a specific soft and hard limit to the same
440 value, or as colon-separated pair soft:hard to set both limits
441 individually (e.g. "LimitAS=4G:16G"). Use the string infinity to
442 configure no limit on a specific resource. The multiplicative
443 suffixes K, M, G, T, P and E (to the base 1024) may be used for
444 resource limits measured in bytes (e.g. LimitAS=16G). For the
445 limits referring to time values, the usual time units ms, s, min, h
446 and so on may be used (see systemd.time(7) for details). Note that
447 if no time unit is specified for LimitCPU= the default unit of
448 seconds is implied, while for LimitRTTIME= the default unit of
449 microseconds is implied. Also, note that the effective granularity
450 of the limits might influence their enforcement. For example, time
451 limits specified for LimitCPU= will be rounded up implicitly to
452 multiples of 1s. For LimitNICE= the value may be specified in two
453 syntaxes: if prefixed with "+" or "-", the value is understood as
454 regular Linux nice value in the range -20..19. If not prefixed like
455 this the value is understood as raw resource limit parameter in the
456 range 0..40 (with 0 being equivalent to 1).
457
458 Note that most process resource limits configured with these
459 options are per-process, and processes may fork in order to acquire
460 a new set of resources that are accounted independently of the
461 original process, and may thus escape limits set. Also note that
462 LimitRSS= is not implemented on Linux, and setting it has no
463 effect. Often it is advisable to prefer the resource controls
464 listed in systemd.resource-control(5) over these per-process
465 limits, as they apply to services as a whole, may be altered
466 dynamically at runtime, and are generally more expressive. For
467 example, MemoryLimit= is a more powerful (and working) replacement
468 for LimitRSS=.
469
470 For system units these resource limits may be chosen freely. For
471 user units however (i.e. units run by a per-user instance of
472 systemd(1)), these limits are bound by (possibly more restrictive)
473 per-user limits enforced by the OS.
474
475 Resource limits not configured explicitly for a unit default to the
476 value configured in the various DefaultLimitCPU=,
477 DefaultLimitFSIZE=, ... options available in systemd-
478 system.conf(5), and – if not configured there – the kernel or
479 per-user defaults, as defined by the OS (the latter only for user
480 services, see above).
481
482 Table 1. Resource limit directives, their equivalent ulimit shell
483 commands and the unit used
484 ┌─────────────────┬───────────────────┬─────────────────────┐
485 │Directive │ ulimit equivalent │ Unit │
486 ├─────────────────┼───────────────────┼─────────────────────┤
487 │LimitCPU= │ ulimit -t │ Seconds │
488 ├─────────────────┼───────────────────┼─────────────────────┤
489 │LimitFSIZE= │ ulimit -f │ Bytes │
490 ├─────────────────┼───────────────────┼─────────────────────┤
491 │LimitDATA= │ ulimit -d │ Bytes │
492 ├─────────────────┼───────────────────┼─────────────────────┤
493 │LimitSTACK= │ ulimit -s │ Bytes │
494 ├─────────────────┼───────────────────┼─────────────────────┤
495 │LimitCORE= │ ulimit -c │ Bytes │
496 ├─────────────────┼───────────────────┼─────────────────────┤
497 │LimitRSS= │ ulimit -m │ Bytes │
498 ├─────────────────┼───────────────────┼─────────────────────┤
499 │LimitNOFILE= │ ulimit -n │ Number of File │
500 │ │ │ Descriptors │
501 ├─────────────────┼───────────────────┼─────────────────────┤
502 │LimitAS= │ ulimit -v │ Bytes │
503 ├─────────────────┼───────────────────┼─────────────────────┤
504 │LimitNPROC= │ ulimit -u │ Number of Processes │
505 ├─────────────────┼───────────────────┼─────────────────────┤
506 │LimitMEMLOCK= │ ulimit -l │ Bytes │
507 ├─────────────────┼───────────────────┼─────────────────────┤
508 │LimitLOCKS= │ ulimit -x │ Number of Locks │
509 ├─────────────────┼───────────────────┼─────────────────────┤
510 │LimitSIGPENDING= │ ulimit -i │ Number of Queued │
511 │ │ │ Signals │
512 ├─────────────────┼───────────────────┼─────────────────────┤
513 │LimitMSGQUEUE= │ ulimit -q │ Bytes │
514 ├─────────────────┼───────────────────┼─────────────────────┤
515 │LimitNICE= │ ulimit -e │ Nice Level │
516 ├─────────────────┼───────────────────┼─────────────────────┤
517 │LimitRTPRIO= │ ulimit -r │ Realtime Priority │
518 ├─────────────────┼───────────────────┼─────────────────────┤
519 │LimitRTTIME= │ No equivalent │ Microseconds │
520 └─────────────────┴───────────────────┴─────────────────────┘
521
522 UMask=
523 Controls the file mode creation mask. Takes an access mode in octal
524 notation. See umask(2) for details. Defaults to 0022.
525
526 KeyringMode=
527 Controls how the kernel session keyring is set up for the service
528 (see session-keyring(7) for details on the session keyring). Takes
529 one of inherit, private, shared. If set to inherit no special
530 keyring setup is done, and the kernel's default behaviour is
531 applied. If private is used a new session keyring is allocated when
532 a service process is invoked, and it is not linked up with any user
533 keyring. This is the recommended setting for system services, as
534 this ensures that multiple services running under the same system
535 user ID (in particular the root user) do not share their key
536 material among each other. If shared is used a new session keyring
537 is allocated as for private, but the user keyring of the user
538 configured with User= is linked into it, so that keys assigned to
539 the user may be requested by the unit's processes. In this modes
540 multiple units running processes under the same user ID may share
541 key material. Unless inherit is selected the unique invocation ID
542 for the unit (see below) is added as a protected key by the name
543 "invocation_id" to the newly created session keyring. Defaults to
544 private for services of the system service manager and to inherit
545 for non-service units and for services of the user service manager.
546
547 OOMScoreAdjust=
548 Sets the adjustment value for the Linux kernel's Out-Of-Memory
549 (OOM) killer score for executed processes. Takes an integer between
550 -1000 (to disable OOM killing of processes of this unit) and 1000
551 (to make killing of processes of this unit under memory pressure
552 very likely). See proc.txt[3] for details. If not specified
553 defaults to the OOM score adjustment level of the service manager
554 itself, which is normally at 0.
555
556 Use the OOMPolicy= setting of service units to configure how the
557 service manager shall react to the kernel OOM killer terminating a
558 process of the service. See systemd.service(5) for details.
559
560 TimerSlackNSec=
561 Sets the timer slack in nanoseconds for the executed processes. The
562 timer slack controls the accuracy of wake-ups triggered by timers.
563 See prctl(2) for more information. Note that in contrast to most
564 other time span definitions this parameter takes an integer value
565 in nano-seconds if no unit is specified. The usual time units are
566 understood too.
567
568 Personality=
569 Controls which kernel architecture uname(2) shall report, when
570 invoked by unit processes. Takes one of the architecture
571 identifiers x86, x86-64, ppc, ppc-le, ppc64, ppc64-le, s390 or
572 s390x. Which personality architectures are supported depends on the
573 system architecture. Usually the 64bit versions of the various
574 system architectures support their immediate 32bit personality
575 architecture counterpart, but no others. For example, x86-64
576 systems support the x86-64 and x86 personalities but no others. The
577 personality feature is useful when running 32-bit services on a
578 64-bit host system. If not specified, the personality is left
579 unmodified and thus reflects the personality of the host system's
580 kernel.
581
582 IgnoreSIGPIPE=
583 Takes a boolean argument. If true, causes SIGPIPE to be ignored in
584 the executed process. Defaults to true because SIGPIPE generally is
585 useful only in shell pipelines.
586
588 Nice=
589 Sets the default nice level (scheduling priority) for executed
590 processes. Takes an integer between -20 (highest priority) and 19
591 (lowest priority). See setpriority(2) for details.
592
593 CPUSchedulingPolicy=
594 Sets the CPU scheduling policy for executed processes. Takes one of
595 other, batch, idle, fifo or rr. See sched_setscheduler(2) for
596 details.
597
598 CPUSchedulingPriority=
599 Sets the CPU scheduling priority for executed processes. The
600 available priority range depends on the selected CPU scheduling
601 policy (see above). For real-time scheduling policies an integer
602 between 1 (lowest priority) and 99 (highest priority) can be used.
603 See sched_setscheduler(2) for details.
604
605 CPUSchedulingResetOnFork=
606 Takes a boolean argument. If true, elevated CPU scheduling
607 priorities and policies will be reset when the executed processes
608 fork, and can hence not leak into child processes. See
609 sched_setscheduler(2) for details. Defaults to false.
610
611 CPUAffinity=
612 Controls the CPU affinity of the executed processes. Takes a list
613 of CPU indices or ranges separated by either whitespace or commas.
614 CPU ranges are specified by the lower and upper CPU indices
615 separated by a dash. This option may be specified more than once,
616 in which case the specified CPU affinity masks are merged. If the
617 empty string is assigned, the mask is reset, all assignments prior
618 to this will have no effect. See sched_setaffinity(2) for details.
619
620 NUMAPolicy=
621 Controls the NUMA memory policy of the executed processes. Takes a
622 policy type, one of: default, preferred, bind, interleave and
623 local. A list of NUMA nodes that should be associated with the
624 policy must be specified in NUMAMask=. For more details on each
625 policy please see, set_mempolicy(2). For overall overview of NUMA
626 support in Linux see, numa(7)
627
628 NUMAMask=
629 Controls the NUMA node list which will be applied alongside with
630 selected NUMA policy. Takes a list of NUMA nodes and has the same
631 syntax as a list of CPUs for CPUAffinity= option. Note that the
632 list of NUMA nodes is not required for default and local policies
633 and for preferred policy we expect a single NUMA node.
634
635 IOSchedulingClass=
636 Sets the I/O scheduling class for executed processes. Takes an
637 integer between 0 and 3 or one of the strings none, realtime,
638 best-effort or idle. If the empty string is assigned to this
639 option, all prior assignments to both IOSchedulingClass= and
640 IOSchedulingPriority= have no effect. See ioprio_set(2) for
641 details.
642
643 IOSchedulingPriority=
644 Sets the I/O scheduling priority for executed processes. Takes an
645 integer between 0 (highest priority) and 7 (lowest priority). The
646 available priorities depend on the selected I/O scheduling class
647 (see above). If the empty string is assigned to this option, all
648 prior assignments to both IOSchedulingClass= and
649 IOSchedulingPriority= have no effect. See ioprio_set(2) for
650 details.
651
653 The following sandboxing options are an effective way to limit the
654 exposure of the system towards the unit's processes. It is recommended
655 to turn on as many of these options for each unit as is possible
656 without negatively affecting the process' ability to operate. Note that
657 many of these sandboxing features are gracefully turned off on systems
658 where the underlying security mechanism is not available. For example,
659 ProtectSystem= has no effect if the kernel is built without file system
660 namespacing or if the service manager runs in a container manager that
661 makes file system namespacing unavailable to its payload. Similar,
662 RestrictRealtime= has no effect on systems that lack support for
663 SECCOMP system call filtering, or in containers where support for this
664 is turned off.
665
666 Also note that some sandboxing functionality is generally not available
667 in user services (i.e. services run by the per-user service manager).
668 Specifically, the various settings requiring file system namespacing
669 support (such as ProtectSystem=) are not available, as the underlying
670 kernel functionality is only accessible to privileged processes.
671
672 ProtectSystem=
673 Takes a boolean argument or the special values "full" or "strict".
674 If true, mounts the /usr and /boot directories read-only for
675 processes invoked by this unit. If set to "full", the /etc
676 directory is mounted read-only, too. If set to "strict" the entire
677 file system hierarchy is mounted read-only, except for the API file
678 system subtrees /dev, /proc and /sys (protect these directories
679 using PrivateDevices=, ProtectKernelTunables=,
680 ProtectControlGroups=). This setting ensures that any modification
681 of the vendor-supplied operating system (and optionally its
682 configuration, and local mounts) is prohibited for the service. It
683 is recommended to enable this setting for all long-running
684 services, unless they are involved with system updates or need to
685 modify the operating system in other ways. If this option is used,
686 ReadWritePaths= may be used to exclude specific directories from
687 being made read-only. This setting is implied if DynamicUser= is
688 set. This setting cannot ensure protection in all cases. In general
689 it has the same limitations as ReadOnlyPaths=, see below. Defaults
690 to off.
691
692 ProtectHome=
693 Takes a boolean argument or the special values "read-only" or
694 "tmpfs". If true, the directories /home, /root, and /run/user are
695 made inaccessible and empty for processes invoked by this unit. If
696 set to "read-only", the three directories are made read-only
697 instead. If set to "tmpfs", temporary file systems are mounted on
698 the three directories in read-only mode. The value "tmpfs" is
699 useful to hide home directories not relevant to the processes
700 invoked by the unit, while still allowing necessary directories to
701 be made visible when listed in BindPaths= or BindReadOnlyPaths=.
702
703 Setting this to "yes" is mostly equivalent to set the three
704 directories in InaccessiblePaths=. Similarly, "read-only" is mostly
705 equivalent to ReadOnlyPaths=, and "tmpfs" is mostly equivalent to
706 TemporaryFileSystem= with ":ro".
707
708 It is recommended to enable this setting for all long-running
709 services (in particular network-facing ones), to ensure they cannot
710 get access to private user data, unless the services actually
711 require access to the user's private data. This setting is implied
712 if DynamicUser= is set. This setting cannot ensure protection in
713 all cases. In general it has the same limitations as
714 ReadOnlyPaths=, see below.
715
716 This option is only available for system services and is not
717 supported for services running in per-user instances of the service
718 manager.
719
720 RuntimeDirectory=, StateDirectory=, CacheDirectory=, LogsDirectory=,
721 ConfigurationDirectory=
722 These options take a whitespace-separated list of directory names.
723 The specified directory names must be relative, and may not include
724 "..". If set, one or more directories by the specified names will
725 be created (including their parents) below the locations defined in
726 the following table, when the unit is started. Also, the
727 corresponding environment variable is defined with the full path of
728 directories. If multiple directories are set, then in the
729 environment variable the paths are concatenated with colon (":").
730
731 Table 2. Automatic directory creation and environment variables
732 ┌────────────────────────┬────────────────┬───────────────────────┬──────────────────────────┐
733 │Directory │ Below path for │ Below path for │ Environment │
734 │ │ system units │ user units │ variable set │
735 ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
736 │RuntimeDirectory= │ /run/ │ $XDG_RUNTIME_DIR │ $RUNTIME_DIRECTORY │
737 ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
738 │StateDirectory= │ /var/lib/ │ $XDG_CONFIG_HOME │ $STATE_DIRECTORY │
739 ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
740 │CacheDirectory= │ /var/cache/ │ $XDG_CACHE_HOME │ $CACHE_DIRECTORY │
741 ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
742 │LogsDirectory= │ /var/log/ │ $XDG_CONFIG_HOME/log/ │ $LOGS_DIRECTORY │
743 ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
744 │ConfigurationDirectory= │ /etc/ │ $XDG_CONFIG_HOME │ $CONFIGURATION_DIRECTORY │
745 └────────────────────────┴────────────────┴───────────────────────┴──────────────────────────┘
746 In case of RuntimeDirectory= the innermost subdirectories are
747 removed when the unit is stopped. It is possible to preserve the
748 specified directories in this case if RuntimeDirectoryPreserve= is
749 configured to restart or yes (see below). The directories specified
750 with StateDirectory=, CacheDirectory=, LogsDirectory=,
751 ConfigurationDirectory= are not removed when the unit is stopped.
752
753 Except in case of ConfigurationDirectory=, the innermost specified
754 directories will be owned by the user and group specified in User=
755 and Group=. If the specified directories already exist and their
756 owning user or group do not match the configured ones, all files
757 and directories below the specified directories as well as the
758 directories themselves will have their file ownership recursively
759 changed to match what is configured. As an optimization, if the
760 specified directories are already owned by the right user and
761 group, files and directories below of them are left as-is, even if
762 they do not match what is requested. The innermost specified
763 directories will have their access mode adjusted to the what is
764 specified in RuntimeDirectoryMode=, StateDirectoryMode=,
765 CacheDirectoryMode=, LogsDirectoryMode= and
766 ConfigurationDirectoryMode=.
767
768 These options imply BindPaths= for the specified paths. When
769 combined with RootDirectory= or RootImage= these paths always
770 reside on the host and are mounted from there into the unit's file
771 system namespace.
772
773 If DynamicUser= is used in conjunction with StateDirectory=,
774 CacheDirectory= and LogsDirectory= is slightly altered: the
775 directories are created below /var/lib/private, /var/cache/private
776 and /var/log/private, respectively, which are host directories made
777 inaccessible to unprivileged users, which ensures that access to
778 these directories cannot be gained through dynamic user ID
779 recycling. Symbolic links are created to hide this difference in
780 behaviour. Both from perspective of the host and from inside the
781 unit, the relevant directories hence always appear directly below
782 /var/lib, /var/cache and /var/log.
783
784 Use RuntimeDirectory= to manage one or more runtime directories for
785 the unit and bind their lifetime to the daemon runtime. This is
786 particularly useful for unprivileged daemons that cannot create
787 runtime directories in /run due to lack of privileges, and to make
788 sure the runtime directory is cleaned up automatically after use.
789 For runtime directories that require more complex or different
790 configuration or lifetime guarantees, please consider using
791 tmpfiles.d(5).
792
793 The directories defined by these options are always created under
794 the standard paths used by systemd (/var, /run, /etc, ...). If the
795 service needs directories in a different location, a different
796 mechanism has to be used to create them.
797
798 tmpfiles.d(5) provides functionality that overlaps with these
799 options. Using these options is recommended, because the lifetime
800 of the directories is tied directly to the lifetime of the unit,
801 and it is not necessary to ensure that the tmpfiles.d configuration
802 is executed before the unit is started.
803
804 To remove any of the directories created by these settings, use the
805 systemctl clean ... command on the relevant units, see
806 systemctl(1) for details.
807
808 Example: if a system service unit has the following,
809
810 RuntimeDirectory=foo/bar baz
811
812 the service manager creates /run/foo (if it does not exist),
813 /run/foo/bar, and /run/baz. The directories /run/foo/bar and
814 /run/baz except /run/foo are owned by the user and group specified
815 in User= and Group=, and removed when the service is stopped.
816
817 Example: if a system service unit has the following,
818
819 RuntimeDirectory=foo/bar
820 StateDirectory=aaa/bbb ccc
821
822 then the environment variable "RUNTIME_DIRECTORY" is set with
823 "/run/foo/bar", and "STATE_DIRECTORY" is set with
824 "/var/lib/aaa/bbb:/var/lib/ccc".
825
826 RuntimeDirectoryMode=, StateDirectoryMode=, CacheDirectoryMode=,
827 LogsDirectoryMode=, ConfigurationDirectoryMode=
828 Specifies the access mode of the directories specified in
829 RuntimeDirectory=, StateDirectory=, CacheDirectory=,
830 LogsDirectory=, or ConfigurationDirectory=, respectively, as an
831 octal number. Defaults to 0755. See "Permissions" in
832 path_resolution(7) for a discussion of the meaning of permission
833 bits.
834
835 RuntimeDirectoryPreserve=
836 Takes a boolean argument or restart. If set to no (the default),
837 the directories specified in RuntimeDirectory= are always removed
838 when the service stops. If set to restart the directories are
839 preserved when the service is both automatically and manually
840 restarted. Here, the automatic restart means the operation
841 specified in Restart=, and manual restart means the one triggered
842 by systemctl restart foo.service. If set to yes, then the
843 directories are not removed when the service is stopped. Note that
844 since the runtime directory /run is a mount point of "tmpfs", then
845 for system services the directories specified in RuntimeDirectory=
846 are removed when the system is rebooted.
847
848 TimeoutCleanSec=
849 Configures a timeout on the clean-up operation requested through
850 systemctl clean ..., see systemctl(1) for details. Takes the usual
851 time values and defaults to infinity, i.e. by default no time-out
852 is applied. If a time-out is configured the clean operation will be
853 aborted forcibly when the time-out is reached, potentially leaving
854 resources on disk.
855
856 ReadWritePaths=, ReadOnlyPaths=, InaccessiblePaths=
857 Sets up a new file system namespace for executed processes. These
858 options may be used to limit access a process might have to the
859 file system hierarchy. Each setting takes a space-separated list of
860 paths relative to the host's root directory (i.e. the system
861 running the service manager). Note that if paths contain symlinks,
862 they are resolved relative to the root directory set with
863 RootDirectory=/RootImage=.
864
865 Paths listed in ReadWritePaths= are accessible from within the
866 namespace with the same access modes as from outside of it. Paths
867 listed in ReadOnlyPaths= are accessible for reading only, writing
868 will be refused even if the usual file access controls would permit
869 this. Nest ReadWritePaths= inside of ReadOnlyPaths= in order to
870 provide writable subdirectories within read-only directories. Use
871 ReadWritePaths= in order to whitelist specific paths for write
872 access if ProtectSystem=strict is used.
873
874 Paths listed in InaccessiblePaths= will be made inaccessible for
875 processes inside the namespace along with everything below them in
876 the file system hierarchy. This may be more restrictive than
877 desired, because it is not possible to nest ReadWritePaths=,
878 ReadOnlyPaths=, BindPaths=, or BindReadOnlyPaths= inside it. For a
879 more flexible option, see TemporaryFileSystem=.
880
881 Non-directory paths may be specified as well. These options may be
882 specified more than once, in which case all paths listed will have
883 limited access from within the namespace. If the empty string is
884 assigned to this option, the specific list is reset, and all prior
885 assignments have no effect.
886
887 Paths in ReadWritePaths=, ReadOnlyPaths= and InaccessiblePaths= may
888 be prefixed with "-", in which case they will be ignored when they
889 do not exist. If prefixed with "+" the paths are taken relative to
890 the root directory of the unit, as configured with
891 RootDirectory=/RootImage=, instead of relative to the root
892 directory of the host (see above). When combining "-" and "+" on
893 the same path make sure to specify "-" first, and "+" second.
894
895 Note that these settings will disconnect propagation of mounts from
896 the unit's processes to the host. This means that this setting may
897 not be used for services which shall be able to install mount
898 points in the main mount namespace. For ReadWritePaths= and
899 ReadOnlyPaths= propagation in the other direction is not affected,
900 i.e. mounts created on the host generally appear in the unit
901 processes' namespace, and mounts removed on the host also disappear
902 there too. In particular, note that mount propagation from host to
903 unit will result in unmodified mounts to be created in the unit's
904 namespace, i.e. writable mounts appearing on the host will be
905 writable in the unit's namespace too, even when propagated below a
906 path marked with ReadOnlyPaths=! Restricting access with these
907 options hence does not extend to submounts of a directory that are
908 created later on. This means the lock-down offered by that setting
909 is not complete, and does not offer full protection.
910
911 Note that the effect of these settings may be undone by privileged
912 processes. In order to set up an effective sandboxed environment
913 for a unit it is thus recommended to combine these settings with
914 either CapabilityBoundingSet=~CAP_SYS_ADMIN or
915 SystemCallFilter=~@mount.
916
917 These options are only available for system services and are not
918 supported for services running in per-user instances of the service
919 manager.
920
921 TemporaryFileSystem=
922 Takes a space-separated list of mount points for temporary file
923 systems (tmpfs). If set, a new file system namespace is set up for
924 executed processes, and a temporary file system is mounted on each
925 mount point. This option may be specified more than once, in which
926 case temporary file systems are mounted on all listed mount points.
927 If the empty string is assigned to this option, the list is reset,
928 and all prior assignments have no effect. Each mount point may
929 optionally be suffixed with a colon (":") and mount options such as
930 "size=10%" or "ro". By default, each temporary file system is
931 mounted with "nodev,strictatime,mode=0755". These can be disabled
932 by explicitly specifying the corresponding mount options, e.g.,
933 "dev" or "nostrictatime".
934
935 This is useful to hide files or directories not relevant to the
936 processes invoked by the unit, while necessary files or directories
937 can be still accessed by combining with BindPaths= or
938 BindReadOnlyPaths=:
939
940 Example: if a unit has the following,
941
942 TemporaryFileSystem=/var:ro
943 BindReadOnlyPaths=/var/lib/systemd
944
945 then the invoked processes by the unit cannot see any files or
946 directories under /var except for /var/lib/systemd or its contents.
947
948 This option is only available for system services and is not
949 supported for services running in per-user instances of the service
950 manager.
951
952 PrivateTmp=
953 Takes a boolean argument. If true, sets up a new file system
954 namespace for the executed processes and mounts private /tmp and
955 /var/tmp directories inside it that is not shared by processes
956 outside of the namespace. This is useful to secure access to
957 temporary files of the process, but makes sharing between processes
958 via /tmp or /var/tmp impossible. If this is enabled, all temporary
959 files created by a service in these directories will be removed
960 after the service is stopped. Defaults to false. It is possible to
961 run two or more units within the same private /tmp and /var/tmp
962 namespace by using the JoinsNamespaceOf= directive, see
963 systemd.unit(5) for details. This setting is implied if
964 DynamicUser= is set. For this setting the same restrictions
965 regarding mount propagation and privileges apply as for
966 ReadOnlyPaths= and related calls, see above. Enabling this setting
967 has the side effect of adding Requires= and After= dependencies on
968 all mount units necessary to access /tmp and /var/tmp. Moreover an
969 implicitly After= ordering on systemd-tmpfiles-setup.service(8) is
970 added.
971
972 Note that the implementation of this setting might be impossible
973 (for example if mount namespaces are not available), and the unit
974 should be written in a way that does not solely rely on this
975 setting for security.
976
977 This option is only available for system services and is not
978 supported for services running in per-user instances of the service
979 manager.
980
981 PrivateDevices=
982 Takes a boolean argument. If true, sets up a new /dev mount for the
983 executed processes and only adds API pseudo devices such as
984 /dev/null, /dev/zero or /dev/random (as well as the pseudo TTY
985 subsystem) to it, but no physical devices such as /dev/sda, system
986 memory /dev/mem, system ports /dev/port and others. This is useful
987 to securely turn off physical device access by the executed
988 process. Defaults to false. Enabling this option will install a
989 system call filter to block low-level I/O system calls that are
990 grouped in the @raw-io set, will also remove CAP_MKNOD and
991 CAP_SYS_RAWIO from the capability bounding set for the unit (see
992 above), and set DevicePolicy=closed (see systemd.resource-
993 control(5) for details). Note that using this setting will
994 disconnect propagation of mounts from the service to the host
995 (propagation in the opposite direction continues to work). This
996 means that this setting may not be used for services which shall be
997 able to install mount points in the main mount namespace. The new
998 /dev will be mounted read-only and 'noexec'. The latter may break
999 old programs which try to set up executable memory by using mmap(2)
1000 of /dev/zero instead of using MAP_ANON. For this setting the same
1001 restrictions regarding mount propagation and privileges apply as
1002 for ReadOnlyPaths= and related calls, see above. If turned on and
1003 if running in user mode, or in system mode, but without the
1004 CAP_SYS_ADMIN capability (e.g. setting User=), NoNewPrivileges=yes
1005 is implied.
1006
1007 Note that the implementation of this setting might be impossible
1008 (for example if mount namespaces are not available), and the unit
1009 should be written in a way that does not solely rely on this
1010 setting for security.
1011
1012 This option is only available for system services and is not
1013 supported for services running in per-user instances of the service
1014 manager.
1015
1016 PrivateNetwork=
1017 Takes a boolean argument. If true, sets up a new network namespace
1018 for the executed processes and configures only the loopback network
1019 device "lo" inside it. No other network devices will be available
1020 to the executed process. This is useful to turn off network access
1021 by the executed process. Defaults to false. It is possible to run
1022 two or more units within the same private network namespace by
1023 using the JoinsNamespaceOf= directive, see systemd.unit(5) for
1024 details. Note that this option will disconnect all socket families
1025 from the host, including AF_NETLINK and AF_UNIX. Effectively, for
1026 AF_NETLINK this means that device configuration events received
1027 from systemd-udevd.service(8) are not delivered to the unit's
1028 processes. And for AF_UNIX this has the effect that AF_UNIX sockets
1029 in the abstract socket namespace of the host will become
1030 unavailable to the unit's processes (however, those located in the
1031 file system will continue to be accessible).
1032
1033 Note that the implementation of this setting might be impossible
1034 (for example if network namespaces are not available), and the unit
1035 should be written in a way that does not solely rely on this
1036 setting for security.
1037
1038 When this option is used on a socket unit any sockets bound on
1039 behalf of this unit will be bound within a private network
1040 namespace. This may be combined with JoinsNamespaceOf= to listen on
1041 sockets inside of network namespaces of other services.
1042
1043 This option is only available for system services and is not
1044 supported for services running in per-user instances of the service
1045 manager.
1046
1047 NetworkNamespacePath=
1048 Takes an absolute file system path refererring to a Linux network
1049 namespace pseudo-file (i.e. a file like /proc/$PID/ns/net or a bind
1050 mount or symlink to one). When set the invoked processes are added
1051 to the network namespace referenced by that path. The path has to
1052 point to a valid namespace file at the moment the processes are
1053 forked off. If this option is used PrivateNetwork= has no effect.
1054 If this option is used together with JoinsNamespaceOf= then it only
1055 has an effect if this unit is started before any of the listed
1056 units that have PrivateNetwork= or NetworkNamespacePath=
1057 configured, as otherwise the network namespace of those units is
1058 reused.
1059
1060 When this option is used on a socket unit any sockets bound on
1061 behalf of this unit will be bound within the specified network
1062 namespace.
1063
1064 This option is only available for system services and is not
1065 supported for services running in per-user instances of the service
1066 manager.
1067
1068 PrivateUsers=
1069 Takes a boolean argument. If true, sets up a new user namespace for
1070 the executed processes and configures a minimal user and group
1071 mapping, that maps the "root" user and group as well as the unit's
1072 own user and group to themselves and everything else to the
1073 "nobody" user and group. This is useful to securely detach the user
1074 and group databases used by the unit from the rest of the system,
1075 and thus to create an effective sandbox environment. All files,
1076 directories, processes, IPC objects and other resources owned by
1077 users/groups not equaling "root" or the unit's own will stay
1078 visible from within the unit but appear owned by the "nobody" user
1079 and group. If this mode is enabled, all unit processes are run
1080 without privileges in the host user namespace (regardless if the
1081 unit's own user/group is "root" or not). Specifically this means
1082 that the process will have zero process capabilities on the host's
1083 user namespace, but full capabilities within the service's user
1084 namespace. Settings such as CapabilityBoundingSet= will affect only
1085 the latter, and there's no way to acquire additional capabilities
1086 in the host's user namespace. Defaults to off.
1087
1088 This setting is particularly useful in conjunction with
1089 RootDirectory=/RootImage=, as the need to synchronize the user and
1090 group databases in the root directory and on the host is reduced,
1091 as the only users and groups who need to be matched are "root",
1092 "nobody" and the unit's own user and group.
1093
1094 Note that the implementation of this setting might be impossible
1095 (for example if user namespaces are not available), and the unit
1096 should be written in a way that does not solely rely on this
1097 setting for security.
1098
1099 This option is only available for system services and is not
1100 supported for services running in per-user instances of the service
1101 manager.
1102
1103 ProtectHostname=
1104 Takes a boolean argument. When set, sets up a new UTS namespace for
1105 the executed processes. In addition, changing hostname or
1106 domainname is prevented. Defaults to off.
1107
1108 Note that the implementation of this setting might be impossible
1109 (for example if UTS namespaces are not available), and the unit
1110 should be written in a way that does not solely rely on this
1111 setting for security.
1112
1113 Note that when this option is enabled for a service hostname
1114 changes no longer propagate from the system into the service, it is
1115 hence not suitable for services that need to take notice of system
1116 hostname changes dynamically.
1117
1118 This option is only available for system services and is not
1119 supported for services running in per-user instances of the service
1120 manager.
1121
1122 ProtectKernelTunables=
1123 Takes a boolean argument. If true, kernel variables accessible
1124 through /proc/sys, /sys, /proc/sysrq-trigger, /proc/latency_stats,
1125 /proc/acpi, /proc/timer_stats, /proc/fs and /proc/irq will be made
1126 read-only to all processes of the unit. Usually, tunable kernel
1127 variables should be initialized only at boot-time, for example with
1128 the sysctl.d(5) mechanism. Few services need to write to these at
1129 runtime; it is hence recommended to turn this on for most services.
1130 For this setting the same restrictions regarding mount propagation
1131 and privileges apply as for ReadOnlyPaths= and related calls, see
1132 above. Defaults to off. If turned on and if running in user mode,
1133 or in system mode, but without the CAP_SYS_ADMIN capability (e.g.
1134 services for which User= is set), NoNewPrivileges=yes is implied.
1135 Note that this option does not prevent indirect changes to kernel
1136 tunables effected by IPC calls to other processes. However,
1137 InaccessiblePaths= may be used to make relevant IPC file system
1138 objects inaccessible. If ProtectKernelTunables= is set,
1139 MountAPIVFS=yes is implied.
1140
1141 This option is only available for system services and is not
1142 supported for services running in per-user instances of the service
1143 manager.
1144
1145 ProtectKernelModules=
1146 Takes a boolean argument. If true, explicit module loading will be
1147 denied. This allows module load and unload operations to be turned
1148 off on modular kernels. It is recommended to turn this on for most
1149 services that do not need special file systems or extra kernel
1150 modules to work. Defaults to off. Enabling this option removes
1151 CAP_SYS_MODULE from the capability bounding set for the unit, and
1152 installs a system call filter to block module system calls, also
1153 /usr/lib/modules is made inaccessible. For this setting the same
1154 restrictions regarding mount propagation and privileges apply as
1155 for ReadOnlyPaths= and related calls, see above. Note that limited
1156 automatic module loading due to user configuration or kernel
1157 mapping tables might still happen as side effect of requested user
1158 operations, both privileged and unprivileged. To disable module
1159 auto-load feature please see sysctl.d(5) kernel.modules_disabled
1160 mechanism and /proc/sys/kernel/modules_disabled documentation. If
1161 turned on and if running in user mode, or in system mode, but
1162 without the CAP_SYS_ADMIN capability (e.g. setting User=),
1163 NoNewPrivileges=yes is implied.
1164
1165 This option is only available for system services and is not
1166 supported for services running in per-user instances of the service
1167 manager.
1168
1169 ProtectControlGroups=
1170 Takes a boolean argument. If true, the Linux Control Groups
1171 (cgroups(7)) hierarchies accessible through /sys/fs/cgroup will be
1172 made read-only to all processes of the unit. Except for container
1173 managers no services should require write access to the control
1174 groups hierarchies; it is hence recommended to turn this on for
1175 most services. For this setting the same restrictions regarding
1176 mount propagation and privileges apply as for ReadOnlyPaths= and
1177 related calls, see above. Defaults to off. If ProtectControlGroups=
1178 is set, MountAPIVFS=yes is implied.
1179
1180 This option is only available for system services and is not
1181 supported for services running in per-user instances of the service
1182 manager.
1183
1184 RestrictAddressFamilies=
1185 Restricts the set of socket address families accessible to the
1186 processes of this unit. Takes a space-separated list of address
1187 family names to whitelist, such as AF_UNIX, AF_INET or AF_INET6.
1188 When prefixed with ~ the listed address families will be applied as
1189 blacklist, otherwise as whitelist. Note that this restricts access
1190 to the socket(2) system call only. Sockets passed into the process
1191 by other means (for example, by using socket activation with socket
1192 units, see systemd.socket(5)) are unaffected. Also, sockets created
1193 with socketpair() (which creates connected AF_UNIX sockets only)
1194 are unaffected. Note that this option has no effect on 32-bit x86,
1195 s390, s390x, mips, mips-le, ppc, ppc-le, pcc64, ppc64-le and is
1196 ignored (but works correctly on other ABIs, including x86-64). Note
1197 that on systems supporting multiple ABIs (such as x86/x86-64) it is
1198 recommended to turn off alternative ABIs for services, so that they
1199 cannot be used to circumvent the restrictions of this option.
1200 Specifically, it is recommended to combine this option with
1201 SystemCallArchitectures=native or similar. If running in user mode,
1202 or in system mode, but without the CAP_SYS_ADMIN capability (e.g.
1203 setting User=nobody), NoNewPrivileges=yes is implied. By default,
1204 no restrictions apply, all address families are accessible to
1205 processes. If assigned the empty string, any previous address
1206 family restriction changes are undone. This setting does not affect
1207 commands prefixed with "+".
1208
1209 Use this option to limit exposure of processes to remote access, in
1210 particular via exotic and sensitive network protocols, such as
1211 AF_PACKET. Note that in most cases, the local AF_UNIX address
1212 family should be included in the configured whitelist as it is
1213 frequently used for local communication, including for syslog(2)
1214 logging.
1215
1216 RestrictNamespaces=
1217 Restricts access to Linux namespace functionality for the processes
1218 of this unit. For details about Linux namespaces, see
1219 namespaces(7). Either takes a boolean argument, or a
1220 space-separated list of namespace type identifiers. If false (the
1221 default), no restrictions on namespace creation and switching are
1222 made. If true, access to any kind of namespacing is prohibited.
1223 Otherwise, a space-separated list of namespace type identifiers
1224 must be specified, consisting of any combination of: cgroup, ipc,
1225 net, mnt, pid, user and uts. Any namespace type listed is made
1226 accessible to the unit's processes, access to namespace types not
1227 listed is prohibited (whitelisting). By prepending the list with a
1228 single tilde character ("~") the effect may be inverted: only the
1229 listed namespace types will be made inaccessible, all unlisted ones
1230 are permitted (blacklisting). If the empty string is assigned, the
1231 default namespace restrictions are applied, which is equivalent to
1232 false. This option may appear more than once, in which case the
1233 namespace types are merged by OR, or by AND if the lines are
1234 prefixed with "~" (see examples below). Internally, this setting
1235 limits access to the unshare(2), clone(2) and setns(2) system
1236 calls, taking the specified flags parameters into account. Note
1237 that — if this option is used — in addition to restricting creation
1238 and switching of the specified types of namespaces (or all of them,
1239 if true) access to the setns() system call with a zero flags
1240 parameter is prohibited. This setting is only supported on x86,
1241 x86-64, mips, mips-le, mips64, mips64-le, mips64-n32,
1242 mips64-le-n32, ppc64, ppc64-le, s390 and s390x, and enforces no
1243 restrictions on other architectures. If running in user mode, or in
1244 system mode, but without the CAP_SYS_ADMIN capability (e.g. setting
1245 User=), NoNewPrivileges=yes is implied.
1246
1247 Example: if a unit has the following,
1248
1249 RestrictNamespaces=cgroup ipc
1250 RestrictNamespaces=cgroup net
1251
1252 then cgroup, ipc, and net are set. If the second line is prefixed
1253 with "~", e.g.,
1254
1255 RestrictNamespaces=cgroup ipc
1256 RestrictNamespaces=~cgroup net
1257
1258 then, only ipc is set.
1259
1260 LockPersonality=
1261 Takes a boolean argument. If set, locks down the personality(2)
1262 system call so that the kernel execution domain may not be changed
1263 from the default or the personality selected with Personality=
1264 directive. This may be useful to improve security, because odd
1265 personality emulations may be poorly tested and source of
1266 vulnerabilities. If running in user mode, or in system mode, but
1267 without the CAP_SYS_ADMIN capability (e.g. setting User=),
1268 NoNewPrivileges=yes is implied.
1269
1270 MemoryDenyWriteExecute=
1271 Takes a boolean argument. If set, attempts to create memory
1272 mappings that are writable and executable at the same time, or to
1273 change existing memory mappings to become executable, or mapping
1274 shared memory segments as executable are prohibited. Specifically,
1275 a system call filter is added that rejects mmap(2) system calls
1276 with both PROT_EXEC and PROT_WRITE set, mprotect(2) or
1277 pkey_mprotect(2) system calls with PROT_EXEC set and shmat(2)
1278 system calls with SHM_EXEC set. Note that this option is
1279 incompatible with programs and libraries that generate program code
1280 dynamically at runtime, including JIT execution engines, executable
1281 stacks, and code "trampoline" feature of various C compilers. This
1282 option improves service security, as it makes harder for software
1283 exploits to change running code dynamically. However, the
1284 protection can be circumvented, if the service can write to a
1285 filesystem, which is not mounted with noexec (such as /dev/shm), or
1286 it can use memfd_create(). This can be prevented by making such
1287 file systems inaccessible to the service (e.g.
1288 InaccessiblePaths=/dev/shm) and installing further system call
1289 filters (SystemCallFilter=~memfd_create). Note that this feature is
1290 fully available on x86-64, and partially on x86. Specifically, the
1291 shmat() protection is not available on x86. Note that on systems
1292 supporting multiple ABIs (such as x86/x86-64) it is recommended to
1293 turn off alternative ABIs for services, so that they cannot be used
1294 to circumvent the restrictions of this option. Specifically, it is
1295 recommended to combine this option with
1296 SystemCallArchitectures=native or similar. If running in user mode,
1297 or in system mode, but without the CAP_SYS_ADMIN capability (e.g.
1298 setting User=), NoNewPrivileges=yes is implied.
1299
1300 RestrictRealtime=
1301 Takes a boolean argument. If set, any attempts to enable realtime
1302 scheduling in a process of the unit are refused. This restricts
1303 access to realtime task scheduling policies such as SCHED_FIFO,
1304 SCHED_RR or SCHED_DEADLINE. See sched(7) for details about these
1305 scheduling policies. If running in user mode, or in system mode,
1306 but without the CAP_SYS_ADMIN capability (e.g. setting User=),
1307 NoNewPrivileges=yes is implied. Realtime scheduling policies may be
1308 used to monopolize CPU time for longer periods of time, and may
1309 hence be used to lock up or otherwise trigger Denial-of-Service
1310 situations on the system. It is hence recommended to restrict
1311 access to realtime scheduling to the few programs that actually
1312 require them. Defaults to off.
1313
1314 RestrictSUIDSGID=
1315 Takes a boolean argument. If set, any attempts to set the
1316 set-user-ID (SUID) or set-group-ID (SGID) bits on files or
1317 directories will be denied (for details on these bits see
1318 inode(7)). If running in user mode, or in system mode, but without
1319 the CAP_SYS_ADMIN capability (e.g. setting User=),
1320 NoNewPrivileges=yes is implied. As the SUID/SGID bits are
1321 mechanisms to elevate privileges, and allows users to acquire the
1322 identity of other users, it is recommended to restrict creation of
1323 SUID/SGID files to the few programs that actually require them.
1324 Note that this restricts marking of any type of file system object
1325 with these bits, including both regular files and directories
1326 (where the SGID is a different meaning than for files, see
1327 documentation). This option is implied if DynamicUser= is enabled.
1328 Defaults to off.
1329
1330 RemoveIPC=
1331 Takes a boolean parameter. If set, all System V and POSIX IPC
1332 objects owned by the user and group the processes of this unit are
1333 run as are removed when the unit is stopped. This setting only has
1334 an effect if at least one of User=, Group= and DynamicUser= are
1335 used. It has no effect on IPC objects owned by the root user.
1336 Specifically, this removes System V semaphores, as well as System V
1337 and POSIX shared memory segments and message queues. If multiple
1338 units use the same user or group the IPC objects are removed when
1339 the last of these units is stopped. This setting is implied if
1340 DynamicUser= is set.
1341
1342 This option is only available for system services and is not
1343 supported for services running in per-user instances of the service
1344 manager.
1345
1346 PrivateMounts=
1347 Takes a boolean parameter. If set, the processes of this unit will
1348 be run in their own private file system (mount) namespace with all
1349 mount propagation from the processes towards the host's main file
1350 system namespace turned off. This means any file system mount
1351 points established or removed by the unit's processes will be
1352 private to them and not be visible to the host. However, file
1353 system mount points established or removed on the host will be
1354 propagated to the unit's processes. See mount_namespaces(7) for
1355 details on file system namespaces. Defaults to off.
1356
1357 When turned on, this executes three operations for each invoked
1358 process: a new CLONE_NEWNS namespace is created, after which all
1359 existing mounts are remounted to MS_SLAVE to disable propagation
1360 from the unit's processes to the host (but leaving propagation in
1361 the opposite direction in effect). Finally, the mounts are
1362 remounted again to the propagation mode configured with
1363 MountFlags=, see below.
1364
1365 File system namespaces are set up individually for each process
1366 forked off by the service manager. Mounts established in the
1367 namespace of the process created by ExecStartPre= will hence be
1368 cleaned up automatically as soon as that process exits and will not
1369 be available to subsequent processes forked off for ExecStart= (and
1370 similar applies to the various other commands configured for
1371 units). Similarly, JoinsNamespaceOf= does not permit sharing kernel
1372 mount namespaces between units, it only enables sharing of the
1373 /tmp/ and /var/tmp/ directories.
1374
1375 Other file system namespace unit settings — PrivateMounts=,
1376 PrivateTmp=, PrivateDevices=, ProtectSystem=, ProtectHome=,
1377 ReadOnlyPaths=, InaccessiblePaths=, ReadWritePaths=, ... — also
1378 enable file system namespacing in a fashion equivalent to this
1379 option. Hence it is primarily useful to explicitly request this
1380 behaviour if none of the other settings are used.
1381
1382 This option is only available for system services and is not
1383 supported for services running in per-user instances of the service
1384 manager.
1385
1386 MountFlags=
1387 Takes a mount propagation setting: shared, slave or private, which
1388 controls whether file system mount points in the file system
1389 namespaces set up for this unit's processes will receive or
1390 propagate mounts and unmounts from other file system namespaces.
1391 See mount(2) for details on mount propagation, and the three
1392 propagation flags in particular.
1393
1394 This setting only controls the final propagation setting in effect
1395 on all mount points of the file system namespace created for each
1396 process of this unit. Other file system namespacing unit settings
1397 (see the discussion in PrivateMounts= above) will implicitly
1398 disable mount and unmount propagation from the unit's processes
1399 towards the host by changing the propagation setting of all mount
1400 points in the unit's file system namepace to slave first. Setting
1401 this option to shared does not reestablish propagation in that
1402 case.
1403
1404 If not set – but file system namespaces are enabled through another
1405 file system namespace unit setting – shared mount propagation is
1406 used, but — as mentioned — as slave is applied first, propagation
1407 from the unit's processes to the host is still turned off.
1408
1409 It is not recommended to to use private mount propagation for
1410 units, as this means temporary mounts (such as removable media) of
1411 the host will stay mounted and thus indefinitely busy in forked off
1412 processes, as unmount propagation events won't be received by the
1413 file system namespace of the unit.
1414
1415 Usually, it is best to leave this setting unmodified, and use
1416 higher level file system namespacing options instead, in particular
1417 PrivateMounts=, see above.
1418
1419 This option is only available for system services and is not
1420 supported for services running in per-user instances of the service
1421 manager.
1422
1424 SystemCallFilter=
1425 Takes a space-separated list of system call names. If this setting
1426 is used, all system calls executed by the unit processes except for
1427 the listed ones will result in immediate process termination with
1428 the SIGSYS signal (whitelisting). (See SystemCallErrorNumber= below
1429 for changing the default action). If the first character of the
1430 list is "~", the effect is inverted: only the listed system calls
1431 will result in immediate process termination (blacklisting).
1432 Blacklisted system calls and system call groups may optionally be
1433 suffixed with a colon (":") and "errno" error number (between 0 and
1434 4095) or errno name such as EPERM, EACCES or EUCLEAN (see errno(3)
1435 for a full list). This value will be returned when a blacklisted
1436 system call is triggered, instead of terminating the processes
1437 immediately. This value takes precedence over the one given in
1438 SystemCallErrorNumber=, see below. If running in user mode, or in
1439 system mode, but without the CAP_SYS_ADMIN capability (e.g. setting
1440 User=nobody), NoNewPrivileges=yes is implied. This feature makes
1441 use of the Secure Computing Mode 2 interfaces of the kernel
1442 ('seccomp filtering') and is useful for enforcing a minimal
1443 sandboxing environment. Note that the execve, exit, exit_group,
1444 getrlimit, rt_sigreturn, sigreturn system calls and the system
1445 calls for querying time and sleeping are implicitly whitelisted and
1446 do not need to be listed explicitly. This option may be specified
1447 more than once, in which case the filter masks are merged. If the
1448 empty string is assigned, the filter is reset, all prior
1449 assignments will have no effect. This does not affect commands
1450 prefixed with "+".
1451
1452 Note that on systems supporting multiple ABIs (such as x86/x86-64)
1453 it is recommended to turn off alternative ABIs for services, so
1454 that they cannot be used to circumvent the restrictions of this
1455 option. Specifically, it is recommended to combine this option with
1456 SystemCallArchitectures=native or similar.
1457
1458 Note that strict system call filters may impact execution and error
1459 handling code paths of the service invocation. Specifically, access
1460 to the execve system call is required for the execution of the
1461 service binary — if it is blocked service invocation will
1462 necessarily fail. Also, if execution of the service binary fails
1463 for some reason (for example: missing service executable), the
1464 error handling logic might require access to an additional set of
1465 system calls in order to process and log this failure correctly. It
1466 might be necessary to temporarily disable system call filters in
1467 order to simplify debugging of such failures.
1468
1469 If you specify both types of this option (i.e. whitelisting and
1470 blacklisting), the first encountered will take precedence and will
1471 dictate the default action (termination or approval of a system
1472 call). Then the next occurrences of this option will add or delete
1473 the listed system calls from the set of the filtered system calls,
1474 depending of its type and the default action. (For example, if you
1475 have started with a whitelisting of read and write, and right after
1476 it add a blacklisting of write, then write will be removed from the
1477 set.)
1478
1479 As the number of possible system calls is large, predefined sets of
1480 system calls are provided. A set starts with "@" character,
1481 followed by name of the set.
1482
1483 Table 3. Currently predefined system call sets
1484 ┌────────────────┬────────────────────────────┐
1485 │Set │ Description │
1486 ├────────────────┼────────────────────────────┤
1487 │@aio │ Asynchronous I/O │
1488 │ │ (io_setup(2), │
1489 │ │ io_submit(2), and related │
1490 │ │ calls) │
1491 ├────────────────┼────────────────────────────┤
1492 │@basic-io │ System calls for basic │
1493 │ │ I/O: reading, writing, │
1494 │ │ seeking, file descriptor │
1495 │ │ duplication and closing │
1496 │ │ (read(2), write(2), and │
1497 │ │ related calls) │
1498 ├────────────────┼────────────────────────────┤
1499 │@chown │ Changing file ownership │
1500 │ │ (chown(2), fchownat(2), │
1501 │ │ and related calls) │
1502 ├────────────────┼────────────────────────────┤
1503 │@clock │ System calls for changing │
1504 │ │ the system clock │
1505 │ │ (adjtimex(2), │
1506 │ │ settimeofday(2), and │
1507 │ │ related calls) │
1508 ├────────────────┼────────────────────────────┤
1509 │@cpu-emulation │ System calls for CPU │
1510 │ │ emulation functionality │
1511 │ │ (vm86(2) and related │
1512 │ │ calls) │
1513 ├────────────────┼────────────────────────────┤
1514 │@debug │ Debugging, performance │
1515 │ │ monitoring and tracing │
1516 │ │ functionality (ptrace(2), │
1517 │ │ perf_event_open(2) and │
1518 │ │ related calls) │
1519 ├────────────────┼────────────────────────────┤
1520 │@file-system │ File system operations: │
1521 │ │ opening, creating files │
1522 │ │ and directories for read │
1523 │ │ and write, renaming and │
1524 │ │ removing them, reading │
1525 │ │ file properties, or │
1526 │ │ creating hard and symbolic │
1527 │ │ links. │
1528 ├────────────────┼────────────────────────────┤
1529 │@io-event │ Event loop system calls │
1530 │ │ (poll(2), select(2), │
1531 │ │ epoll(7), eventfd(2) and │
1532 │ │ related calls) │
1533 ├────────────────┼────────────────────────────┤
1534 │@ipc │ Pipes, SysV IPC, POSIX │
1535 │ │ Message Queues and other │
1536 │ │ IPC (mq_overview(7), │
1537 │ │ svipc(7)) │
1538 ├────────────────┼────────────────────────────┤
1539 │@keyring │ Kernel keyring access │
1540 │ │ (keyctl(2) and related │
1541 │ │ calls) │
1542 ├────────────────┼────────────────────────────┤
1543 │@memlock │ Locking of memory into RAM │
1544 │ │ (mlock(2), mlockall(2) and │
1545 │ │ related calls) │
1546 ├────────────────┼────────────────────────────┤
1547 │@module │ Loading and unloading of │
1548 │ │ kernel modules │
1549 │ │ (init_module(2), │
1550 │ │ delete_module(2) and │
1551 │ │ related calls) │
1552 ├────────────────┼────────────────────────────┤
1553 │@mount │ Mounting and unmounting of │
1554 │ │ file systems (mount(2), │
1555 │ │ chroot(2), and related │
1556 │ │ calls) │
1557 ├────────────────┼────────────────────────────┤
1558 │@network-io │ Socket I/O (including │
1559 │ │ local AF_UNIX): socket(7), │
1560 │ │ unix(7) │
1561 ├────────────────┼────────────────────────────┤
1562 │@obsolete │ Unusual, obsolete or │
1563 │ │ unimplemented │
1564 │ │ (create_module(2), │
1565 │ │ gtty(2), ...) │
1566 ├────────────────┼────────────────────────────┤
1567 │@privileged │ All system calls which │
1568 │ │ need super-user │
1569 │ │ capabilities │
1570 │ │ (capabilities(7)) │
1571 ├────────────────┼────────────────────────────┤
1572 │@process │ Process control, │
1573 │ │ execution, namespaceing │
1574 │ │ operations (clone(2), │
1575 │ │ kill(2), namespaces(7), │
1576 │ │ ... │
1577 ├────────────────┼────────────────────────────┤
1578 │@raw-io │ Raw I/O port access │
1579 │ │ (ioperm(2), iopl(2), │
1580 │ │ pciconfig_read(), ...) │
1581 ├────────────────┼────────────────────────────┤
1582 │@reboot │ System calls for rebooting │
1583 │ │ and reboot preparation │
1584 │ │ (reboot(2), kexec(), ...) │
1585 ├────────────────┼────────────────────────────┤
1586 │@resources │ System calls for changing │
1587 │ │ resource limits, memory │
1588 │ │ and scheduling parameters │
1589 │ │ (setrlimit(2), │
1590 │ │ setpriority(2), ...) │
1591 ├────────────────┼────────────────────────────┤
1592 │@setuid │ System calls for changing │
1593 │ │ user ID and group ID │
1594 │ │ credentials, (setuid(2), │
1595 │ │ setgid(2), setresuid(2), │
1596 │ │ ...) │
1597 ├────────────────┼────────────────────────────┤
1598 │@signal │ System calls for │
1599 │ │ manipulating and handling │
1600 │ │ process signals │
1601 │ │ (signal(2), │
1602 │ │ sigprocmask(2), ...) │
1603 ├────────────────┼────────────────────────────┤
1604 │@swap │ System calls for │
1605 │ │ enabling/disabling swap │
1606 │ │ devices (swapon(2), │
1607 │ │ swapoff(2)) │
1608 ├────────────────┼────────────────────────────┤
1609 │@sync │ Synchronizing files and │
1610 │ │ memory to disk: (fsync(2), │
1611 │ │ msync(2), and related │
1612 │ │ calls) │
1613 ├────────────────┼────────────────────────────┤
1614 │@system-service │ A reasonable set of system │
1615 │ │ calls used by common │
1616 │ │ system services, excluding │
1617 │ │ any special purpose calls. │
1618 │ │ This is the recommended │
1619 │ │ starting point for │
1620 │ │ whitelisting system calls │
1621 │ │ for system services, as it │
1622 │ │ contains what is typically │
1623 │ │ needed by system services, │
1624 │ │ but excludes overly │
1625 │ │ specific interfaces. For │
1626 │ │ example, the following │
1627 │ │ APIs are excluded: │
1628 │ │ "@clock", "@mount", │
1629 │ │ "@swap", "@reboot". │
1630 ├────────────────┼────────────────────────────┤
1631 │@timer │ System calls for │
1632 │ │ scheduling operations by │
1633 │ │ time (alarm(2), │
1634 │ │ timer_create(2), ...) │
1635 └────────────────┴────────────────────────────┘
1636 Note, that as new system calls are added to the kernel, additional
1637 system calls might be added to the groups above. Contents of the
1638 sets may also change between systemd versions. In addition, the
1639 list of system calls depends on the kernel version and architecture
1640 for which systemd was compiled. Use systemd-analyze syscall-filter
1641 to list the actual list of system calls in each filter.
1642
1643 Generally, whitelisting system calls (rather than blacklisting) is
1644 the safer mode of operation. It is recommended to enforce system
1645 call whitelists for all long-running system services. Specifically,
1646 the following lines are a relatively safe basic choice for the
1647 majority of system services:
1648
1649 [Service]
1650 SystemCallFilter=@system-service
1651 SystemCallErrorNumber=EPERM
1652
1653 Note that various kernel system calls are defined redundantly:
1654 there are multiple system calls for executing the same operation.
1655 For example, the pidfd_send_signal() system call may be used to
1656 execute operations similar to what can be done with the older
1657 kill() system call, hence blocking the latter without the former
1658 only provides weak protection. Since new system calls are added
1659 regularly to the kernel as development progresses, keeping system
1660 call blacklists comprehensive requires constant work. It is thus
1661 recommended to use whitelisting instead, which offers the benefit
1662 that new system calls are by default implicitly blocked until the
1663 whitelist is updated.
1664
1665 Also note that a number of system calls are required to be
1666 accessible for the dynamic linker to work. The dynamic linker is
1667 required for running most regular programs (specifically: all
1668 dynamic ELF binaries, which is how most distributions build
1669 packaged programs). This means that blocking these system calls
1670 (which include open(), openat() or mmap()) will make most programs
1671 typically shipped with generic distributions unusable.
1672
1673 It is recommended to combine the file system namespacing related
1674 options with SystemCallFilter=~@mount, in order to prohibit the
1675 unit's processes to undo the mappings. Specifically these are the
1676 options PrivateTmp=, PrivateDevices=, ProtectSystem=, ProtectHome=,
1677 ProtectKernelTunables=, ProtectControlGroups=, ReadOnlyPaths=,
1678 InaccessiblePaths= and ReadWritePaths=.
1679
1680 SystemCallErrorNumber=
1681 Takes an "errno" error number (between 1 and 4095) or errno name
1682 such as EPERM, EACCES or EUCLEAN, to return when the system call
1683 filter configured with SystemCallFilter= is triggered, instead of
1684 terminating the process immediately. See errno(3) for a full list
1685 of error codes. When this setting is not used, or when the empty
1686 string is assigned, the process will be terminated immediately when
1687 the filter is triggered.
1688
1689 SystemCallArchitectures=
1690 Takes a space-separated list of architecture identifiers to include
1691 in the system call filter. The known architecture identifiers are
1692 the same as for ConditionArchitecture= described in
1693 systemd.unit(5), as well as x32, mips64-n32, mips64-le-n32, and the
1694 special identifier native. The special identifier native implicitly
1695 maps to the native architecture of the system (or more precisely:
1696 to the architecture the system manager is compiled for). If running
1697 in user mode, or in system mode, but without the CAP_SYS_ADMIN
1698 capability (e.g. setting User=nobody), NoNewPrivileges=yes is
1699 implied. By default, this option is set to the empty list, i.e. no
1700 system call architecture filtering is applied.
1701
1702 If this setting is used, processes of this unit will only be
1703 permitted to call native system calls, and system calls of the
1704 specified architectures. For the purposes of this option, the x32
1705 architecture is treated as including x86-64 system calls. However,
1706 this setting still fulfills its purpose, as explained below, on
1707 x32.
1708
1709 System call filtering is not equally effective on all
1710 architectures. For example, on x86 filtering of network
1711 socket-related calls is not possible, due to ABI limitations — a
1712 limitation that x86-64 does not have, however. On systems
1713 supporting multiple ABIs at the same time — such as x86/x86-64 — it
1714 is hence recommended to limit the set of permitted system call
1715 architectures so that secondary ABIs may not be used to circumvent
1716 the restrictions applied to the native ABI of the system. In
1717 particular, setting SystemCallArchitectures=native is a good choice
1718 for disabling non-native ABIs.
1719
1720 System call architectures may also be restricted system-wide via
1721 the SystemCallArchitectures= option in the global configuration.
1722 See systemd-system.conf(5) for details.
1723
1725 Environment=
1726 Sets environment variables for executed processes. Takes a
1727 space-separated list of variable assignments. This option may be
1728 specified more than once, in which case all listed variables will
1729 be set. If the same variable is set twice, the later setting will
1730 override the earlier setting. If the empty string is assigned to
1731 this option, the list of environment variables is reset, all prior
1732 assignments have no effect. Variable expansion is not performed
1733 inside the strings, however, specifier expansion is possible. The $
1734 character has no special meaning. If you need to assign a value
1735 containing spaces or the equals sign to a variable, use double
1736 quotes (") for the assignment.
1737
1738 Example:
1739
1740 Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
1741
1742 gives three variables "VAR1", "VAR2", "VAR3" with the values "word1
1743 word2", "word3", "$word 5 6".
1744
1745 See environ(7) for details about environment variables.
1746
1747 Note that environment variables are not suitable for passing
1748 secrets (such as passwords, key material, ...) to service
1749 processes. Environment variables set for a unit are exposed to
1750 unprivileged clients via D-Bus IPC, and generally not understood as
1751 being data that requires protection. Moreover, environment
1752 variables are propagated down the process tree, including across
1753 security boundaries (such as setuid/setgid executables), and hence
1754 might leak to processes that should not have access to the secret
1755 data.
1756
1757 EnvironmentFile=
1758 Similar to Environment= but reads the environment variables from a
1759 text file. The text file should contain new-line-separated variable
1760 assignments. Empty lines, lines without an "=" separator, or lines
1761 starting with ; or # will be ignored, which may be used for
1762 commenting. A line ending with a backslash will be concatenated
1763 with the following one, allowing multiline variable definitions.
1764 The parser strips leading and trailing whitespace from the values
1765 of assignments, unless you use double quotes (").
1766
1767 The argument passed should be an absolute filename or wildcard
1768 expression, optionally prefixed with "-", which indicates that if
1769 the file does not exist, it will not be read and no error or
1770 warning message is logged. This option may be specified more than
1771 once in which case all specified files are read. If the empty
1772 string is assigned to this option, the list of file to read is
1773 reset, all prior assignments have no effect.
1774
1775 The files listed with this directive will be read shortly before
1776 the process is executed (more specifically, after all processes
1777 from a previous unit state terminated. This means you can generate
1778 these files in one unit state, and read it with this option in the
1779 next).
1780
1781 Settings from these files override settings made with Environment=.
1782 If the same variable is set twice from these files, the files will
1783 be read in the order they are specified and the later setting will
1784 override the earlier setting.
1785
1786 PassEnvironment=
1787 Pass environment variables set for the system service manager to
1788 executed processes. Takes a space-separated list of variable names.
1789 This option may be specified more than once, in which case all
1790 listed variables will be passed. If the empty string is assigned to
1791 this option, the list of environment variables to pass is reset,
1792 all prior assignments have no effect. Variables specified that are
1793 not set for the system manager will not be passed and will be
1794 silently ignored. Note that this option is only relevant for the
1795 system service manager, as system services by default do not
1796 automatically inherit any environment variables set for the service
1797 manager itself. However, in case of the user service manager all
1798 environment variables are passed to the executed processes anyway,
1799 hence this option is without effect for the user service manager.
1800
1801 Variables set for invoked processes due to this setting are subject
1802 to being overridden by those configured with Environment= or
1803 EnvironmentFile=.
1804
1805 Example:
1806
1807 PassEnvironment=VAR1 VAR2 VAR3
1808
1809 passes three variables "VAR1", "VAR2", "VAR3" with the values set
1810 for those variables in PID1.
1811
1812 See environ(7) for details about environment variables.
1813
1814 UnsetEnvironment=
1815 Explicitly unset environment variable assignments that would
1816 normally be passed from the service manager to invoked processes of
1817 this unit. Takes a space-separated list of variable names or
1818 variable assignments. This option may be specified more than once,
1819 in which case all listed variables/assignments will be unset. If
1820 the empty string is assigned to this option, the list of
1821 environment variables/assignments to unset is reset. If a variable
1822 assignment is specified (that is: a variable name, followed by "=",
1823 followed by its value), then any environment variable matching this
1824 precise assignment is removed. If a variable name is specified
1825 (that is a variable name without any following "=" or value), then
1826 any assignment matching the variable name, regardless of its value
1827 is removed. Note that the effect of UnsetEnvironment= is applied as
1828 final step when the environment list passed to executed processes
1829 is compiled. That means it may undo assignments from any
1830 configuration source, including assignments made through
1831 Environment= or EnvironmentFile=, inherited from the system
1832 manager's global set of environment variables, inherited via
1833 PassEnvironment=, set by the service manager itself (such as
1834 $NOTIFY_SOCKET and such), or set by a PAM module (in case PAMName=
1835 is used).
1836
1837 See environ(7) for details about environment variables.
1838
1840 StandardInput=
1841 Controls where file descriptor 0 (STDIN) of the executed processes
1842 is connected to. Takes one of null, tty, tty-force, tty-fail, data,
1843 file:path, socket or fd:name.
1844
1845 If null is selected, standard input will be connected to /dev/null,
1846 i.e. all read attempts by the process will result in immediate EOF.
1847
1848 If tty is selected, standard input is connected to a TTY (as
1849 configured by TTYPath=, see below) and the executed process becomes
1850 the controlling process of the terminal. If the terminal is already
1851 being controlled by another process, the executed process waits
1852 until the current controlling process releases the terminal.
1853
1854 tty-force is similar to tty, but the executed process is forcefully
1855 and immediately made the controlling process of the terminal,
1856 potentially removing previous controlling processes from the
1857 terminal.
1858
1859 tty-fail is similar to tty, but if the terminal already has a
1860 controlling process start-up of the executed process fails.
1861
1862 The data option may be used to configure arbitrary textual or
1863 binary data to pass via standard input to the executed process. The
1864 data to pass is configured via
1865 StandardInputText=/StandardInputData= (see below). Note that the
1866 actual file descriptor type passed (memory file, regular file, UNIX
1867 pipe, ...) might depend on the kernel and available privileges. In
1868 any case, the file descriptor is read-only, and when read returns
1869 the specified data followed by EOF.
1870
1871 The file:path option may be used to connect a specific file system
1872 object to standard input. An absolute path following the ":"
1873 character is expected, which may refer to a regular file, a FIFO or
1874 special file. If an AF_UNIX socket in the file system is specified,
1875 a stream socket is connected to it. The latter is useful for
1876 connecting standard input of processes to arbitrary system
1877 services.
1878
1879 The socket option is valid in socket-activated services only, and
1880 requires the relevant socket unit file (see systemd.socket(5) for
1881 details) to have Accept=yes set, or to specify a single socket
1882 only. If this option is set, standard input will be connected to
1883 the socket the service was activated from, which is primarily
1884 useful for compatibility with daemons designed for use with the
1885 traditional inetd(8) socket activation daemon.
1886
1887 The fd:name option connects standard input to a specific, named
1888 file descriptor provided by a socket unit. The name may be
1889 specified as part of this option, following a ":" character (e.g.
1890 "fd:foobar"). If no name is specified, the name "stdin" is implied
1891 (i.e. "fd" is equivalent to "fd:stdin"). At least one socket unit
1892 defining the specified name must be provided via the Sockets=
1893 option, and the file descriptor name may differ from the name of
1894 its containing socket unit. If multiple matches are found, the
1895 first one will be used. See FileDescriptorName= in
1896 systemd.socket(5) for more details about named file descriptors and
1897 their ordering.
1898
1899 This setting defaults to null.
1900
1901 Note that services which specify DefaultDependencies=no and use
1902 StandardInput= or StandardOutput= with tty/tty-force/tty-fail,
1903 should specify After=systemd-vconsole-setup.service, to make sure
1904 that the tty initialization is finished before they start.
1905
1906 StandardOutput=
1907 Controls where file descriptor 1 (STDOUT) of the executed processes
1908 is connected to. Takes one of inherit, null, tty, journal, kmsg,
1909 journal+console, kmsg+console, file:path, append:path, socket or
1910 fd:name.
1911
1912 inherit duplicates the file descriptor of standard input for
1913 standard output.
1914
1915 null connects standard output to /dev/null, i.e. everything written
1916 to it will be lost.
1917
1918 tty connects standard output to a tty (as configured via TTYPath=,
1919 see below). If the TTY is used for output only, the executed
1920 process will not become the controlling process of the terminal,
1921 and will not fail or wait for other processes to release the
1922 terminal.
1923
1924 journal connects standard output with the journal, which is
1925 accessible via journalctl(1). Note that everything that is written
1926 to kmsg (see below) is implicitly stored in the journal as well,
1927 the specific option listed below is hence a superset of this one.
1928 (Also note that any external, additional syslog daemons receive
1929 their log data from the journal, too, hence this is the option to
1930 use when logging shall be processed with such a daemon.)
1931
1932 kmsg connects standard output with the kernel log buffer which is
1933 accessible via dmesg(1), in addition to the journal. The journal
1934 daemon might be configured to send all logs to kmsg anyway, in
1935 which case this option is no different from journal.
1936
1937 journal+console and kmsg+console work in a similar way as the two
1938 options above but copy the output to the system console as well.
1939
1940 The file:path option may be used to connect a specific file system
1941 object to standard output. The semantics are similar to the same
1942 option of StandardInput=, see above. If path refers to a regular
1943 file on the filesystem, it is opened (created if it doesn't exist
1944 yet) for writing at the beginning of the file, but without
1945 truncating it. If standard input and output are directed to the
1946 same file path, it is opened only once, for reading as well as
1947 writing and duplicated. This is particularly useful when the
1948 specified path refers to an AF_UNIX socket in the file system, as
1949 in that case only a single stream connection is created for both
1950 input and output.
1951
1952 append:path is similar to file:path above, but it opens the file in
1953 append mode.
1954
1955 socket connects standard output to a socket acquired via socket
1956 activation. The semantics are similar to the same option of
1957 StandardInput=, see above.
1958
1959 The fd:name option connects standard output to a specific, named
1960 file descriptor provided by a socket unit. A name may be specified
1961 as part of this option, following a ":" character (e.g.
1962 "fd:foobar"). If no name is specified, the name "stdout" is implied
1963 (i.e. "fd" is equivalent to "fd:stdout"). At least one socket unit
1964 defining the specified name must be provided via the Sockets=
1965 option, and the file descriptor name may differ from the name of
1966 its containing socket unit. If multiple matches are found, the
1967 first one will be used. See FileDescriptorName= in
1968 systemd.socket(5) for more details about named descriptors and
1969 their ordering.
1970
1971 If the standard output (or error output, see below) of a unit is
1972 connected to the journal or the kernel log buffer, the unit will
1973 implicitly gain a dependency of type After= on
1974 systemd-journald.socket (also see the "Implicit Dependencies"
1975 section above). Also note that in this case stdout (or stderr, see
1976 below) will be an AF_UNIX stream socket, and not a pipe or FIFO
1977 that can be re-opened. This means when executing shell scripts the
1978 construct echo "hello" > /dev/stderr for writing text to stderr
1979 will not work. To mitigate this use the construct echo "hello" >&2
1980 instead, which is mostly equivalent and avoids this pitfall.
1981
1982 This setting defaults to the value set with DefaultStandardOutput=
1983 in systemd-system.conf(5), which defaults to journal. Note that
1984 setting this parameter might result in additional dependencies to
1985 be added to the unit (see above).
1986
1987 StandardError=
1988 Controls where file descriptor 2 (STDERR) of the executed processes
1989 is connected to. The available options are identical to those of
1990 StandardOutput=, with some exceptions: if set to inherit the file
1991 descriptor used for standard output is duplicated for standard
1992 error, while fd:name will use a default file descriptor name of
1993 "stderr".
1994
1995 This setting defaults to the value set with DefaultStandardError=
1996 in systemd-system.conf(5), which defaults to inherit. Note that
1997 setting this parameter might result in additional dependencies to
1998 be added to the unit (see above).
1999
2000 StandardInputText=, StandardInputData=
2001 Configures arbitrary textual or binary data to pass via file
2002 descriptor 0 (STDIN) to the executed processes. These settings have
2003 no effect unless StandardInput= is set to data. Use this option to
2004 embed process input data directly in the unit file.
2005
2006 StandardInputText= accepts arbitrary textual data. C-style escapes
2007 for special characters as well as the usual "%"-specifiers are
2008 resolved. Each time this setting is used the specified text is
2009 appended to the per-unit data buffer, followed by a newline
2010 character (thus every use appends a new line to the end of the
2011 buffer). Note that leading and trailing whitespace of lines
2012 configured with this option is removed. If an empty line is
2013 specified the buffer is cleared (hence, in order to insert an empty
2014 line, add an additional "\n" to the end or beginning of a line).
2015
2016 StandardInputData= accepts arbitrary binary data, encoded in
2017 Base64[4]. No escape sequences or specifiers are resolved. Any
2018 whitespace in the encoded version is ignored during decoding.
2019
2020 Note that StandardInputText= and StandardInputData= operate on the
2021 same data buffer, and may be mixed in order to configure both
2022 binary and textual data for the same input stream. The textual or
2023 binary data is joined strictly in the order the settings appear in
2024 the unit file. Assigning an empty string to either will reset the
2025 data buffer.
2026
2027 Please keep in mind that in order to maintain readability long unit
2028 file settings may be split into multiple lines, by suffixing each
2029 line (except for the last) with a "\" character (see
2030 systemd.unit(5) for details). This is particularly useful for large
2031 data configured with these two options. Example:
2032
2033 ...
2034 StandardInput=data
2035 StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy4KSWNrIGtpZWtl \
2036 LCBzdGF1bmUsIHd1bmRyZSBtaXIsCnVmZiBlZW1hbCBqZWh0IHNlIHVmZiBkaWUgVMO8ci4KTmFu \
2037 dSwgZGVuayBpY2ssIGljayBkZW5rIG5hbnUhCkpldHogaXNzZSB1ZmYsIGVyc2NodCB3YXIgc2Ug \
2038 enUhCkljayBqZWhlIHJhdXMgdW5kIGJsaWNrZSDigJQKdW5kIHdlciBzdGVodCBkcmF1w59lbj8g \
2039 SWNrZSEK
2040 ...
2041
2042 LogLevelMax=
2043 Configures filtering by log level of log messages generated by this
2044 unit. Takes a syslog log level, one of emerg (lowest log level,
2045 only highest priority messages), alert, crit, err, warning, notice,
2046 info, debug (highest log level, also lowest priority messages). See
2047 syslog(3) for details. By default no filtering is applied (i.e. the
2048 default maximum log level is debug). Use this option to configure
2049 the logging system to drop log messages of a specific service above
2050 the specified level. For example, set LogLevelMax=info in order to
2051 turn off debug logging of a particularly chatty unit. Note that the
2052 configured level is applied to any log messages written by any of
2053 the processes belonging to this unit, sent via any supported
2054 logging protocol. The filtering is applied early in the logging
2055 pipeline, before any kind of further processing is done. Moreover,
2056 messages which pass through this filter successfully might still be
2057 dropped by filters applied at a later stage in the logging
2058 subsystem. For example, MaxLevelStore= configured in
2059 journald.conf(5) might prohibit messages of higher log levels to be
2060 stored on disk, even though the per-unit LogLevelMax= permitted it
2061 to be processed.
2062
2063 LogExtraFields=
2064 Configures additional log metadata fields to include in all log
2065 records generated by processes associated with this unit. This
2066 setting takes one or more journal field assignments in the format
2067 "FIELD=VALUE" separated by whitespace. See systemd.journal-
2068 fields(7) for details on the journal field concept. Even though the
2069 underlying journal implementation permits binary field values, this
2070 setting accepts only valid UTF-8 values. To include space
2071 characters in a journal field value, enclose the assignment in
2072 double quotes ("). The usual specifiers are expanded in all
2073 assignments (see below). Note that this setting is not only useful
2074 for attaching additional metadata to log records of a unit, but
2075 given that all fields and values are indexed may also be used to
2076 implement cross-unit log record matching. Assign an empty string to
2077 reset the list.
2078
2079 LogRateLimitIntervalSec=, LogRateLimitBurst=
2080 Configures the rate limiting that is applied to messages generated
2081 by this unit. If, in the time interval defined by
2082 LogRateLimitIntervalSec=, more messages than specified in
2083 LogRateLimitBurst= are logged by a service, all further messages
2084 within the interval are dropped until the interval is over. A
2085 message about the number of dropped messages is generated. The time
2086 specification for LogRateLimitIntervalSec= may be specified in the
2087 following units: "s", "min", "h", "ms", "us" (see systemd.time(7)
2088 for details). The default settings are set by RateLimitIntervalSec=
2089 and RateLimitBurst= configured in journald.conf(5).
2090
2091 SyslogIdentifier=
2092 Sets the process name ("syslog tag") to prefix log lines sent to
2093 the logging system or the kernel log buffer with. If not set,
2094 defaults to the process name of the executed process. This option
2095 is only useful when StandardOutput= or StandardError= are set to
2096 journal or kmsg (or to the same settings in combination with
2097 +console) and only applies to log messages written to stdout or
2098 stderr.
2099
2100 SyslogFacility=
2101 Sets the syslog facility identifier to use when logging. One of
2102 kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron,
2103 authpriv, ftp, local0, local1, local2, local3, local4, local5,
2104 local6 or local7. See syslog(3) for details. This option is only
2105 useful when StandardOutput= or StandardError= are set to journal or
2106 kmsg (or to the same settings in combination with +console), and
2107 only applies to log messages written to stdout or stderr. Defaults
2108 to daemon.
2109
2110 SyslogLevel=
2111 The default syslog log level to use when logging to the logging
2112 system or the kernel log buffer. One of emerg, alert, crit, err,
2113 warning, notice, info, debug. See syslog(3) for details. This
2114 option is only useful when StandardOutput= or StandardError= are
2115 set to journal or kmsg (or to the same settings in combination with
2116 +console), and only applies to log messages written to stdout or
2117 stderr. Note that individual lines output by executed processes may
2118 be prefixed with a different log level which can be used to
2119 override the default log level specified here. The interpretation
2120 of these prefixes may be disabled with SyslogLevelPrefix=, see
2121 below. For details, see sd-daemon(3). Defaults to info.
2122
2123 SyslogLevelPrefix=
2124 Takes a boolean argument. If true and StandardOutput= or
2125 StandardError= are set to journal or kmsg (or to the same settings
2126 in combination with +console), log lines written by the executed
2127 process that are prefixed with a log level will be processed with
2128 this log level set but the prefix removed. If set to false, the
2129 interpretation of these prefixes is disabled and the logged lines
2130 are passed on as-is. This only applies to log messages written to
2131 stdout or stderr. For details about this prefixing see sd-
2132 daemon(3). Defaults to true.
2133
2134 TTYPath=
2135 Sets the terminal device node to use if standard input, output, or
2136 error are connected to a TTY (see above). Defaults to /dev/console.
2137
2138 TTYReset=
2139 Reset the terminal device specified with TTYPath= before and after
2140 execution. Defaults to "no".
2141
2142 TTYVHangup=
2143 Disconnect all clients which have opened the terminal device
2144 specified with TTYPath= before and after execution. Defaults to
2145 "no".
2146
2147 TTYVTDisallocate=
2148 If the terminal device specified with TTYPath= is a virtual console
2149 terminal, try to deallocate the TTY before and after execution.
2150 This ensures that the screen and scrollback buffer is cleared.
2151 Defaults to "no".
2152
2154 UtmpIdentifier=
2155 Takes a four character identifier string for an utmp(5) and wtmp
2156 entry for this service. This should only be set for services such
2157 as getty implementations (such as agetty(8)) where utmp/wtmp
2158 entries must be created and cleared before and after execution, or
2159 for services that shall be executed as if they were run by a getty
2160 process (see below). If the configured string is longer than four
2161 characters, it is truncated and the terminal four characters are
2162 used. This setting interprets %I style string replacements. This
2163 setting is unset by default, i.e. no utmp/wtmp entries are created
2164 or cleaned up for this service.
2165
2166 UtmpMode=
2167 Takes one of "init", "login" or "user". If UtmpIdentifier= is set,
2168 controls which type of utmp(5)/wtmp entries for this service are
2169 generated. This setting has no effect unless UtmpIdentifier= is set
2170 too. If "init" is set, only an INIT_PROCESS entry is generated and
2171 the invoked process must implement a getty-compatible utmp/wtmp
2172 logic. If "login" is set, first an INIT_PROCESS entry, followed by
2173 a LOGIN_PROCESS entry is generated. In this case, the invoked
2174 process must implement a login(1)-compatible utmp/wtmp logic. If
2175 "user" is set, first an INIT_PROCESS entry, then a LOGIN_PROCESS
2176 entry and finally a USER_PROCESS entry is generated. In this case,
2177 the invoked process may be any process that is suitable to be run
2178 as session leader. Defaults to "init".
2179
2181 Processes started by the service manager are executed with an
2182 environment variable block assembled from multiple sources. Processes
2183 started by the system service manager generally do not inherit
2184 environment variables set for the service manager itself (but this may
2185 be altered via PassEnvironment=), but processes started by the user
2186 service manager instances generally do inherit all environment
2187 variables set for the service manager itself.
2188
2189 For each invoked process the list of environment variables set is
2190 compiled from the following sources:
2191
2192 · Variables globally configured for the service manager, using the
2193 DefaultEnvironment= setting in systemd-system.conf(5), the kernel
2194 command line option systemd.setenv= (see systemd(1)) or via
2195 systemctl set-environment (see systemctl(1)).
2196
2197 · Variables defined by the service manager itself (see the list
2198 below)
2199
2200 · Variables set in the service manager's own environment variable
2201 block (subject to PassEnvironment= for the system service manager)
2202
2203 · Variables set via Environment= in the unit file
2204
2205 · Variables read from files specified via EnvironmentFile= in the
2206 unit file
2207
2208 · Variables set by any PAM modules in case PAMName= is in effect,
2209 cf. pam_env(8)
2210
2211 If the same environment variables are set by multiple of these sources,
2212 the later source — according to the order of the list above — wins.
2213 Note that as final step all variables listed in UnsetEnvironment= are
2214 removed again from the compiled environment variable list, immediately
2215 before it is passed to the executed process.
2216
2217 The following select environment variables are set or propagated by the
2218 service manager for each invoked process:
2219
2220 $PATH
2221 Colon-separated list of directories to use when launching
2222 executables. systemd uses a fixed value of
2223 "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" in the system
2224 manager. When compiled for systems with "unmerged /usr" (/bin is
2225 not a symlink to /usr/bin), ":/sbin:/bin" is appended. In case of
2226 the the user manager, each bin/ and sbin/ pair is switched, so that
2227 programs from /usr/bin have higher priority than programs from
2228 /usr/sbin, etc. It is recommended to not rely on this in any way,
2229 and have only one program with a given name in $PATH.
2230
2231 $LANG
2232 Locale. Can be set in locale.conf(5) or on the kernel command line
2233 (see systemd(1) and kernel-command-line(7)).
2234
2235 $USER, $LOGNAME, $HOME, $SHELL
2236 User name (twice), home directory, and the login shell. The
2237 variables are set for the units that have User= set, which includes
2238 user systemd instances. See passwd(5).
2239
2240 $INVOCATION_ID
2241 Contains a randomized, unique 128bit ID identifying each runtime
2242 cycle of the unit, formatted as 32 character hexadecimal string. A
2243 new ID is assigned each time the unit changes from an inactive
2244 state into an activating or active state, and may be used to
2245 identify this specific runtime cycle, in particular in data stored
2246 offline, such as the journal. The same ID is passed to all
2247 processes run as part of the unit.
2248
2249 $XDG_RUNTIME_DIR
2250 The directory to use for runtime objects (such as IPC objects) and
2251 volatile state. Set for all services run by the user systemd
2252 instance, as well as any system services that use PAMName= with a
2253 PAM stack that includes pam_systemd. See below and pam_systemd(8)
2254 for more information.
2255
2256 $RUNTIME_DIRECTORY, $STATE_DIRECTORY, $CACHE_DIRECTORY,
2257 $LOGS_DIRECTORY, $CONFIGURATION_DIRECTORY
2258 Contains and absolute paths to the directories defined with
2259 RuntimeDirectory=, StateDirectory=, CacheDirectory=,
2260 LogsDirectory=, and ConfigurationDirectory= when those settings are
2261 used.
2262
2263 $MAINPID
2264 The PID of the unit's main process if it is known. This is only set
2265 for control processes as invoked by ExecReload= and similar.
2266
2267 $MANAGERPID
2268 The PID of the user systemd instance, set for processes spawned by
2269 it.
2270
2271 $LISTEN_FDS, $LISTEN_PID, $LISTEN_FDNAMES
2272 Information about file descriptors passed to a service for socket
2273 activation. See sd_listen_fds(3).
2274
2275 $NOTIFY_SOCKET
2276 The socket sd_notify() talks to. See sd_notify(3).
2277
2278 $WATCHDOG_PID, $WATCHDOG_USEC
2279 Information about watchdog keep-alive notifications. See
2280 sd_watchdog_enabled(3).
2281
2282 $TERM
2283 Terminal type, set only for units connected to a terminal
2284 (StandardInput=tty, StandardOutput=tty, or StandardError=tty). See
2285 termcap(5).
2286
2287 $JOURNAL_STREAM
2288 If the standard output or standard error output of the executed
2289 processes are connected to the journal (for example, by setting
2290 StandardError=journal) $JOURNAL_STREAM contains the device and
2291 inode numbers of the connection file descriptor, formatted in
2292 decimal, separated by a colon (":"). This permits invoked processes
2293 to safely detect whether their standard output or standard error
2294 output are connected to the journal. The device and inode numbers
2295 of the file descriptors should be compared with the values set in
2296 the environment variable to determine whether the process output is
2297 still connected to the journal. Note that it is generally not
2298 sufficient to only check whether $JOURNAL_STREAM is set at all as
2299 services might invoke external processes replacing their standard
2300 output or standard error output, without unsetting the environment
2301 variable.
2302
2303 If both standard output and standard error of the executed
2304 processes are connected to the journal via a stream socket, this
2305 environment variable will contain information about the standard
2306 error stream, as that's usually the preferred destination for log
2307 data. (Note that typically the same stream is used for both
2308 standard output and standard error, hence very likely the
2309 environment variable contains device and inode information matching
2310 both stream file descriptors.)
2311
2312 This environment variable is primarily useful to allow services to
2313 optionally upgrade their used log protocol to the native journal
2314 protocol (using sd_journal_print(3) and other functions) if their
2315 standard output or standard error output is connected to the
2316 journal anyway, thus enabling delivery of structured metadata along
2317 with logged messages.
2318
2319 $SERVICE_RESULT
2320 Only defined for the service unit type, this environment variable
2321 is passed to all ExecStop= and ExecStopPost= processes, and encodes
2322 the service "result". Currently, the following values are defined:
2323
2324 Table 4. Defined $SERVICE_RESULT values
2325 ┌──────────────────┬────────────────────────────┐
2326 │Value │ Meaning │
2327 ├──────────────────┼────────────────────────────┤
2328 │"success" │ The service ran │
2329 │ │ successfully and exited │
2330 │ │ cleanly. │
2331 ├──────────────────┼────────────────────────────┤
2332 │"protocol" │ A protocol violation │
2333 │ │ occurred: the service did │
2334 │ │ not take the steps │
2335 │ │ required by its unit │
2336 │ │ configuration │
2337 │ │ (specifically what is │
2338 │ │ configured in its Type= │
2339 │ │ setting). │
2340 ├──────────────────┼────────────────────────────┤
2341 │"timeout" │ One of the steps timed │
2342 │ │ out. │
2343 ├──────────────────┼────────────────────────────┤
2344 │"exit-code" │ Service process exited │
2345 │ │ with a non-zero exit code; │
2346 │ │ see $EXIT_CODE below for │
2347 │ │ the actual exit code │
2348 │ │ returned. │
2349 ├──────────────────┼────────────────────────────┤
2350 │"signal" │ A service process was │
2351 │ │ terminated abnormally by a │
2352 │ │ signal, without dumping │
2353 │ │ core. See $EXIT_CODE below │
2354 │ │ for the actual signal │
2355 │ │ causing the termination. │
2356 ├──────────────────┼────────────────────────────┤
2357 │"core-dump" │ A service process │
2358 │ │ terminated abnormally with │
2359 │ │ a signal and dumped core. │
2360 │ │ See $EXIT_CODE below for │
2361 │ │ the signal causing the │
2362 │ │ termination. │
2363 ├──────────────────┼────────────────────────────┤
2364 │"watchdog" │ Watchdog keep-alive ping │
2365 │ │ was enabled for the │
2366 │ │ service, but the deadline │
2367 │ │ was missed. │
2368 ├──────────────────┼────────────────────────────┤
2369 │"start-limit-hit" │ A start limit was defined │
2370 │ │ for the unit and it was │
2371 │ │ hit, causing the unit to │
2372 │ │ fail to start. See │
2373 │ │ systemd.unit(5)'s │
2374 │ │ StartLimitIntervalSec= and │
2375 │ │ StartLimitBurst= for │
2376 │ │ details. │
2377 ├──────────────────┼────────────────────────────┤
2378 │"resources" │ A catch-all condition in │
2379 │ │ case a system operation │
2380 │ │ failed. │
2381 └──────────────────┴────────────────────────────┘
2382 This environment variable is useful to monitor failure or
2383 successful termination of a service. Even though this variable is
2384 available in both ExecStop= and ExecStopPost=, it is usually a
2385 better choice to place monitoring tools in the latter, as the
2386 former is only invoked for services that managed to start up
2387 correctly, and the latter covers both services that failed during
2388 their start-up and those which failed during their runtime.
2389
2390 $EXIT_CODE, $EXIT_STATUS
2391 Only defined for the service unit type, these environment variables
2392 are passed to all ExecStop=, ExecStopPost= processes and contain
2393 exit status/code information of the main process of the service.
2394 For the precise definition of the exit code and status, see
2395 wait(2). $EXIT_CODE is one of "exited", "killed", "dumped".
2396 $EXIT_STATUS contains the numeric exit code formatted as string if
2397 $EXIT_CODE is "exited", and the signal name in all other cases.
2398 Note that these environment variables are only set if the service
2399 manager succeeded to start and identify the main process of the
2400 service.
2401
2402 Table 5. Summary of possible service result variable values
2403 ┌──────────────────┬──────────────────┬─────────────────────┐
2404 │$SERVICE_RESULT │ $EXIT_CODE │ $EXIT_STATUS │
2405 ├──────────────────┼──────────────────┼─────────────────────┤
2406 │"success" │ "exited" │ "0" │
2407 ├──────────────────┼──────────────────┼─────────────────────┤
2408 │"protocol" │ not set │ not set │
2409 │ ├──────────────────┼─────────────────────┤
2410 │ │ "exited" │ "0" │
2411 ├──────────────────┼──────────────────┼─────────────────────┤
2412 │"timeout" │ "killed" │ "TERM", "KILL" │
2413 │ ├──────────────────┼─────────────────────┤
2414 │ │ "exited" │ "0", "1", "2", "3", │
2415 │ │ │ ..., "255" │
2416 ├──────────────────┼──────────────────┼─────────────────────┤
2417 │"exit-code" │ "exited" │ "1", "2", "3", ..., │
2418 │ │ │ "255" │
2419 ├──────────────────┼──────────────────┼─────────────────────┤
2420 │"signal" │ "killed" │ "HUP", "INT", │
2421 │ │ │ "KILL", ... │
2422 ├──────────────────┼──────────────────┼─────────────────────┤
2423 │"core-dump" │ "dumped" │ "ABRT", "SEGV", │
2424 │ │ │ "QUIT", ... │
2425 ├──────────────────┼──────────────────┼─────────────────────┤
2426 │"watchdog" │ "dumped" │ "ABRT" │
2427 │ ├──────────────────┼─────────────────────┤
2428 │ │ "killed" │ "TERM", "KILL" │
2429 │ ├──────────────────┼─────────────────────┤
2430 │ │ "exited" │ "0", "1", "2", "3", │
2431 │ │ │ ..., "255" │
2432 ├──────────────────┼──────────────────┼─────────────────────┤
2433 │"start-limit-hit" │ not set │ not set │
2434 ├──────────────────┼──────────────────┼─────────────────────┤
2435 │"resources" │ any of the above │ any of the above │
2436 ├──────────────────┴──────────────────┴─────────────────────┤
2437 │Note: the process may be also terminated by a signal not │
2438 │sent by systemd. In particular the process may send an │
2439 │arbitrary signal to itself in a handler for any of the │
2440 │non-maskable signals. Nevertheless, in the "timeout" and │
2441 │"watchdog" rows above only the signals that systemd sends │
2442 │have been included. Moreover, using SuccessExitStatus= │
2443 │additional exit statuses may be declared to indicate clean │
2444 │termination, which is not reflected by this table. │
2445 └───────────────────────────────────────────────────────────┘
2446
2447 $PIDFILE
2448 The path to the configured PID file, in case the process is forked
2449 off on behalf of a service that uses the PIDFile= setting, see
2450 systemd.service(5) for details. Service code may use this
2451 environment variable to automatically generate a PID file at the
2452 location configured in the unit file. This field is set to an
2453 absolute path in the file system.
2454
2455 For system services, when PAMName= is enabled and pam_systemd is part
2456 of the selected PAM stack, additional environment variables defined by
2457 systemd may be set for services. Specifically, these are $XDG_SEAT,
2458 $XDG_VTNR, see pam_systemd(8) for details.
2459
2461 When invoking a unit process the service manager possibly fails to
2462 apply the execution parameters configured with the settings above. In
2463 that case the already created service process will exit with a non-zero
2464 exit code before the configured command line is executed. (Or in other
2465 words, the child process possibly exits with these error codes, after
2466 having been created by the fork(2) system call, but before the matching
2467 execve(2) system call is called.) Specifically, exit codes defined by
2468 the C library, by the LSB specification and by the systemd service
2469 manager itself are used.
2470
2471 The following basic service exit codes are defined by the C library.
2472
2473 Table 6. Basic C library exit codes
2474 ┌──────────┬───────────────┬────────────────────┐
2475 │Exit Code │ Symbolic Name │ Description │
2476 ├──────────┼───────────────┼────────────────────┤
2477 │0 │ EXIT_SUCCESS │ Generic success │
2478 │ │ │ code. │
2479 ├──────────┼───────────────┼────────────────────┤
2480 │1 │ EXIT_FAILURE │ Generic failure or │
2481 │ │ │ unspecified error. │
2482 └──────────┴───────────────┴────────────────────┘
2483
2484 The following service exit codes are defined by the LSB
2485 specification[5].
2486
2487 Table 7. LSB service exit codes
2488 ┌──────────┬──────────────────────┬────────────────────┐
2489 │Exit Code │ Symbolic Name │ Description │
2490 ├──────────┼──────────────────────┼────────────────────┤
2491 │2 │ EXIT_INVALIDARGUMENT │ Invalid or excess │
2492 │ │ │ arguments. │
2493 ├──────────┼──────────────────────┼────────────────────┤
2494 │3 │ EXIT_NOTIMPLEMENTED │ Unimplemented │
2495 │ │ │ feature. │
2496 ├──────────┼──────────────────────┼────────────────────┤
2497 │4 │ EXIT_NOPERMISSION │ The user has │
2498 │ │ │ insufficient │
2499 │ │ │ privileges. │
2500 ├──────────┼──────────────────────┼────────────────────┤
2501 │5 │ EXIT_NOTINSTALLED │ The program is not │
2502 │ │ │ installed. │
2503 ├──────────┼──────────────────────┼────────────────────┤
2504 │6 │ EXIT_NOTCONFIGURED │ The program is not │
2505 │ │ │ configured. │
2506 ├──────────┼──────────────────────┼────────────────────┤
2507 │7 │ EXIT_NOTRUNNING │ The program is not │
2508 │ │ │ running. │
2509 └──────────┴──────────────────────┴────────────────────┘
2510
2511 The LSB specification suggests that error codes 200 and above are
2512 reserved for implementations. Some of them are used by the service
2513 manager to indicate problems during process invocation:
2514
2515 Table 8. systemd-specific exit codes
2516 ┌──────────┬──────────────────────────────┬─────────────────────────────────────────────┐
2517 │Exit Code │ Symbolic Name │ Description │
2518 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2519 │200 │ EXIT_CHDIR │ Changing to the │
2520 │ │ │ requested working │
2521 │ │ │ directory failed. │
2522 │ │ │ See │
2523 │ │ │ WorkingDirectory= │
2524 │ │ │ above. │
2525 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2526 │201 │ EXIT_NICE │ Failed to set up │
2527 │ │ │ process scheduling │
2528 │ │ │ priority (nice │
2529 │ │ │ level). See Nice= │
2530 │ │ │ above. │
2531 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2532 │202 │ EXIT_FDS │ Failed to close │
2533 │ │ │ unwanted file │
2534 │ │ │ descriptors, or to │
2535 │ │ │ adjust passed file │
2536 │ │ │ descriptors. │
2537 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2538 │203 │ EXIT_EXEC │ The actual process │
2539 │ │ │ execution failed │
2540 │ │ │ (specifically, the │
2541 │ │ │ execve(2) system │
2542 │ │ │ call). Most likely │
2543 │ │ │ this is caused by a │
2544 │ │ │ missing or │
2545 │ │ │ non-accessible │
2546 │ │ │ executable file. │
2547 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2548 │204 │ EXIT_MEMORY │ Failed to perform │
2549 │ │ │ an action due to │
2550 │ │ │ memory shortage. │
2551 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2552 │205 │ EXIT_LIMITS │ Failed to adjust │
2553 │ │ │ resource limits. │
2554 │ │ │ See LimitCPU= and │
2555 │ │ │ related settings │
2556 │ │ │ above. │
2557 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2558 │206 │ EXIT_OOM_ADJUST │ Failed to adjust │
2559 │ │ │ the OOM setting. │
2560 │ │ │ See OOMScoreAdjust= │
2561 │ │ │ above. │
2562 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2563 │207 │ EXIT_SIGNAL_MASK │ Failed to set │
2564 │ │ │ process signal │
2565 │ │ │ mask. │
2566 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2567 │208 │ EXIT_STDIN │ Failed to set up │
2568 │ │ │ standard input. See │
2569 │ │ │ StandardInput= │
2570 │ │ │ above. │
2571 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2572 │209 │ EXIT_STDOUT │ Failed to set up │
2573 │ │ │ standard output. │
2574 │ │ │ See StandardOutput= │
2575 │ │ │ above. │
2576 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2577 │210 │ EXIT_CHROOT │ Failed to change │
2578 │ │ │ root directory │
2579 │ │ │ (chroot(2)). See │
2580 │ │ │ RootDirectory=/RootImage= │
2581 │ │ │ above. │
2582 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2583 │211 │ EXIT_IOPRIO │ Failed to set up IO │
2584 │ │ │ scheduling priority. See │
2585 │ │ │ IOSchedulingClass=/IOSchedulingPriority= │
2586 │ │ │ above. │
2587 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2588 │212 │ EXIT_TIMERSLACK │ Failed to set up timer slack. See │
2589 │ │ │ TimerSlackNSec= above. │
2590 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2591 │213 │ EXIT_SECUREBITS │ Failed to set process secure bits. See │
2592 │ │ │ SecureBits= above. │
2593 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2594 │214 │ EXIT_SETSCHEDULER │ Failed to set up CPU scheduling. See │
2595 │ │ │ CPUSchedulingPolicy=/CPUSchedulingPriority= │
2596 │ │ │ above. │
2597 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2598 │215 │ EXIT_CPUAFFINITY │ Failed to set up CPU affinity. See │
2599 │ │ │ CPUAffinity= above. │
2600 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2601 │216 │ EXIT_GROUP │ Failed to determine or change group │
2602 │ │ │ credentials. See │
2603 │ │ │ Group=/SupplementaryGroups= above. │
2604 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2605 │217 │ EXIT_USER │ Failed to determine or change user │
2606 │ │ │ credentials, or to set up user namespacing. │
2607 │ │ │ See User=/PrivateUsers= above. │
2608 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2609 │218 │ EXIT_CAPABILITIES │ Failed to drop capabilities, or apply │
2610 │ │ │ ambient capabilities. See │
2611 │ │ │ CapabilityBoundingSet=/AmbientCapabilities= │
2612 │ │ │ above. │
2613 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2614 │219 │ EXIT_CGROUP │ Setting up the service control group │
2615 │ │ │ failed. │
2616 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2617 │220 │ EXIT_SETSID │ Failed to create new process session. │
2618 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2619 │221 │ EXIT_CONFIRM │ Execution has been cancelled by the user. │
2620 │ │ │ See the systemd.confirm_spawn= kernel │
2621 │ │ │ command line setting on kernel-command- │
2622 │ │ │ line(7) for details. │
2623 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2624 │222 │ EXIT_STDERR │ Failed to set up standard error output. See │
2625 │ │ │ StandardError= above. │
2626 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2627 │224 │ EXIT_PAM │ Failed to set up PAM session. See PAMName= │
2628 │ │ │ above. │
2629 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2630 │225 │ EXIT_NETWORK │ Failed to set up network namespacing. See │
2631 │ │ │ PrivateNetwork= above. │
2632 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2633 │226 │ EXIT_NAMESPACE │ Failed to set up mount namespacing. See │
2634 │ │ │ ReadOnlyPaths= and related settings above. │
2635 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2636 │227 │ EXIT_NO_NEW_PRIVILEGES │ Failed to disable new privileges. See │
2637 │ │ │ NoNewPrivileges=yes above. │
2638 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2639 │228 │ EXIT_SECCOMP │ Failed to apply system call filters. See │
2640 │ │ │ SystemCallFilter= and related settings │
2641 │ │ │ above. │
2642 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2643 │229 │ EXIT_SELINUX_CONTEXT │ Determining or changing SELinux context │
2644 │ │ │ failed. See SELinuxContext= above. │
2645 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2646 │230 │ EXIT_PERSONALITY │ Failed to set up an execution domain │
2647 │ │ │ (personality). See Personality= above. │
2648 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2649 │231 │ EXIT_APPARMOR_PROFILE │ Failed to prepare changing AppArmor │
2650 │ │ │ profile. See AppArmorProfile= above. │
2651 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2652 │232 │ EXIT_ADDRESS_FAMILIES │ Failed to restrict address families. See │
2653 │ │ │ RestrictAddressFamilies= above. │
2654 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2655 │233 │ EXIT_RUNTIME_DIRECTORY │ Setting up runtime directory failed. See │
2656 │ │ │ RuntimeDirectory= and related settings │
2657 │ │ │ above. │
2658 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2659 │235 │ EXIT_CHOWN │ Failed to adjust socket ownership. Used for │
2660 │ │ │ socket units only. │
2661 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2662 │236 │ EXIT_SMACK_PROCESS_LABEL │ Failed to set SMACK label. See │
2663 │ │ │ SmackProcessLabel= above. │
2664 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2665 │237 │ EXIT_KEYRING │ Failed to set up kernel keyring. │
2666 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2667 │238 │ EXIT_STATE_DIRECTORY │ Failed to set up unit's state directory. │
2668 │ │ │ See StateDirectory= above. │
2669 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2670 │239 │ EXIT_CACHE_DIRECTORY │ Failed to set up unit's cache directory. │
2671 │ │ │ See CacheDirectory= above. │
2672 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2673 │240 │ EXIT_LOGS_DIRECTORY │ Failed to set up unit's logging directory. │
2674 │ │ │ See LogsDirectory= above. │
2675 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2676 │241 │ EXIT_CONFIGURATION_DIRECTORY │ Failed to set up unit's configuration │
2677 │ │ │ directory. See ConfigurationDirectory= │
2678 │ │ │ above. │
2679 ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
2680 │242 │ EXIT_NUMA_POLICY │ Failed to set up unit's NUMA memory policy. │
2681 │ │ │ See NUMAPolicy= and NUMAMask=above. │
2682 └──────────┴──────────────────────────────┴─────────────────────────────────────────────┘
2683
2684 Finally, the BSD operating systems define a set of exit codes,
2685 typically defined on Linux systems too:
2686
2687 Table 9. BSD exit codes
2688 ┌──────────┬────────────────┬─────────────────────┐
2689 │Exit Code │ Symbolic Name │ Description │
2690 ├──────────┼────────────────┼─────────────────────┤
2691 │64 │ EX_USAGE │ Command line usage │
2692 │ │ │ error │
2693 ├──────────┼────────────────┼─────────────────────┤
2694 │65 │ EX_DATAERR │ Data format error │
2695 ├──────────┼────────────────┼─────────────────────┤
2696 │66 │ EX_NOINPUT │ Cannot open input │
2697 ├──────────┼────────────────┼─────────────────────┤
2698 │67 │ EX_NOUSER │ Addressee unknown │
2699 ├──────────┼────────────────┼─────────────────────┤
2700 │68 │ EX_NOHOST │ Host name unknown │
2701 ├──────────┼────────────────┼─────────────────────┤
2702 │69 │ EX_UNAVAILABLE │ Service unavailable │
2703 ├──────────┼────────────────┼─────────────────────┤
2704 │70 │ EX_SOFTWARE │ internal software │
2705 │ │ │ error │
2706 ├──────────┼────────────────┼─────────────────────┤
2707 │71 │ EX_OSERR │ System error (e.g., │
2708 │ │ │ can't fork) │
2709 ├──────────┼────────────────┼─────────────────────┤
2710 │72 │ EX_OSFILE │ Critical OS file │
2711 │ │ │ missing │
2712 ├──────────┼────────────────┼─────────────────────┤
2713 │73 │ EX_CANTCREAT │ Can't create (user) │
2714 │ │ │ output file │
2715 ├──────────┼────────────────┼─────────────────────┤
2716 │74 │ EX_IOERR │ Input/output error │
2717 ├──────────┼────────────────┼─────────────────────┤
2718 │75 │ EX_TEMPFAIL │ Temporary failure; │
2719 │ │ │ user is invited to │
2720 │ │ │ retry │
2721 ├──────────┼────────────────┼─────────────────────┤
2722 │76 │ EX_PROTOCOL │ Remote error in │
2723 │ │ │ protocol │
2724 ├──────────┼────────────────┼─────────────────────┤
2725 │77 │ EX_NOPERM │ Permission denied │
2726 ├──────────┼────────────────┼─────────────────────┤
2727 │78 │ EX_CONFIG │ Configuration error │
2728 └──────────┴────────────────┴─────────────────────┘
2729
2731 systemd(1), systemctl(1), systemd-analyze(1), journalctl(1), systemd-
2732 system.conf(5), systemd.unit(5), systemd.service(5), systemd.socket(5),
2733 systemd.swap(5), systemd.mount(5), systemd.kill(5), systemd.resource-
2734 control(5), systemd.time(7), systemd.directives(7), tmpfiles.d(5),
2735 exec(3)
2736
2738 1. Discoverable Partitions Specification
2739 https://www.freedesktop.org/wiki/Specifications/DiscoverablePartitionsSpec/
2740
2741 2. No New Privileges Flag
2742 https://www.kernel.org/doc/html/latest/userspace-api/no_new_privs.html
2743
2744 3. proc.txt
2745 https://www.kernel.org/doc/Documentation/filesystems/proc.txt
2746
2747 4. Base64
2748 https://tools.ietf.org/html/rfc2045#section-6.8
2749
2750 5. LSB specification
2751 https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
2752
2753
2754
2755systemd 243 SYSTEMD.EXEC(5)