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