1SYSTEMD.EXEC(5)                  systemd.exec                  SYSTEMD.EXEC(5)
2
3
4

NAME

6       systemd.exec - Execution environment configuration
7

SYNOPSIS

9       service.service, socket.socket, mount.mount, swap.swap
10

DESCRIPTION

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

IMPLICIT DEPENDENCIES

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       •   Similarly, 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 journal
45           or kmsg (or their combinations with console output, see below)
46           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

PATHS

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       ExecSearchPath=
59           Takes a colon separated list of absolute paths relative to which
60           the executable used by the Exec*= (e.g.  ExecStart=, ExecStop=,
61           etc.) properties can be found.  ExecSearchPath= overrides $PATH if
62           $PATH is not supplied by the user through Environment=,
63           EnvironmentFile= or PassEnvironment=. Assigning an empty string
64           removes previous assignments and setting ExecSearchPath= to a value
65           multiple times will append to the previous setting.
66
67       WorkingDirectory=
68           Takes a directory path relative to the service's root directory
69           specified by RootDirectory=, or the special value "~". Sets the
70           working directory for executed processes. If set to "~", the home
71           directory of the user specified in User= is used. If not set,
72           defaults to the root directory when systemd is running as a system
73           instance and the respective user's home directory if run as user.
74           If the setting is prefixed with the "-" character, a missing
75           working directory is not considered fatal. If
76           RootDirectory=/RootImage= is not set, then WorkingDirectory= is
77           relative to the root of the system running the service manager.
78           Note that setting this parameter might result in additional
79           dependencies to be added to the unit (see above).
80
81       RootDirectory=
82           Takes a directory path relative to the host's root directory (i.e.
83           the root of the system running the service manager). Sets the root
84           directory for executed processes, with the chroot(2) system call.
85           If this is used, it must be ensured that the process binary and all
86           its auxiliary files are available in the chroot() jail. Note that
87           setting this parameter might result in additional dependencies to
88           be added to the unit (see above).
89
90           The MountAPIVFS= and PrivateUsers= settings are particularly useful
91           in conjunction with RootDirectory=. For details, see below.
92
93           If RootDirectory=/RootImage= are used together with NotifyAccess=
94           the notification socket is automatically mounted from the host into
95           the root environment, to ensure the notification interface can work
96           correctly.
97
98           Note that services using RootDirectory=/RootImage= will not be able
99           to log via the syslog or journal protocols to the host logging
100           infrastructure, unless the relevant sockets are mounted from the
101           host, specifically:
102
103           Example 1. Mounting logging sockets into root environment
104
105               BindReadOnlyPaths=/dev/log /run/systemd/journal/socket /run/systemd/journal/stdout
106
107           This option is only available for system services and is not
108           supported for services running in per-user instances of the service
109           manager.
110
111       RootImage=
112           Takes a path to a block device node or regular file as argument.
113           This call is similar to RootDirectory= however mounts a file system
114           hierarchy from a block device node or loopback file instead of a
115           directory. The device node or file system image file needs to
116           contain a file system without a partition table, or a file system
117           within an MBR/MS-DOS or GPT partition table with only a single
118           Linux-compatible partition, or a set of file systems within a GPT
119           partition table that follows the Discoverable Partitions
120           Specification[1].
121
122           When DevicePolicy= is set to "closed" or "strict", or set to "auto"
123           and DeviceAllow= is set, then this setting adds /dev/loop-control
124           with rw mode, "block-loop" and "block-blkext" with rwm mode to
125           DeviceAllow=. See systemd.resource-control(5) for the details about
126           DevicePolicy= or DeviceAllow=. Also, see PrivateDevices= below, as
127           it may change the setting of DevicePolicy=.
128
129           Units making use of RootImage= automatically gain an After=
130           dependency on systemd-udevd.service.
131
132           This option is only available for system services and is not
133           supported for services running in per-user instances of the service
134           manager.
135
136       RootImageOptions=
137           Takes a comma-separated list of mount options that will be used on
138           disk images specified by RootImage=. Optionally a partition name
139           can be prefixed, followed by colon, in case the image has multiple
140           partitions, otherwise partition name "root" is implied. Options for
141           multiple partitions can be specified in a single line with space
142           separators. Assigning an empty string removes previous assignments.
143           Duplicated options are ignored. For a list of valid mount options,
144           please refer to mount(8).
145
146           Valid partition names follow the Discoverable Partitions
147           Specification[1]: root, usr, home, srv, esp, xbootldr, tmp, var.
148
149           This option is only available for system services and is not
150           supported for services running in per-user instances of the service
151           manager.
152
153       RootHash=
154           Takes a data integrity (dm-verity) root hash specified in
155           hexadecimal, or the path to a file containing a root hash in ASCII
156           hexadecimal format. This option enables data integrity checks using
157           dm-verity, if the used image contains the appropriate integrity
158           data (see above) or if RootVerity= is used. The specified hash must
159           match the root hash of integrity data, and is usually at least 256
160           bits (and hence 64 formatted hexadecimal characters) long (in case
161           of SHA256 for example). If this option is not specified, but the
162           image file carries the "user.verity.roothash" extended file
163           attribute (see xattr(7)), then the root hash is read from it, also
164           as formatted hexadecimal characters. If the extended file attribute
165           is not found (or is not supported by the underlying file system),
166           but a file with the .roothash suffix is found next to the image
167           file, bearing otherwise the same name (except if the image has the
168           .raw suffix, in which case the root hash file must not have it in
169           its name), the root hash is read from it and automatically used,
170           also as formatted hexadecimal characters.
171
172           If the disk image contains a separate /usr/ partition it may also
173           be Verity protected, in which case the root hash may configured via
174           an extended attribute "user.verity.usrhash" or a .usrhash file
175           adjacent to the disk image. There's currently no option to
176           configure the root hash for the /usr/ file system via the unit file
177           directly.
178
179           This option is only available for system services and is not
180           supported for services running in per-user instances of the service
181           manager.
182
183       RootHashSignature=
184           Takes a PKCS7 signature of the RootHash= option as a path to a
185           DER-encoded signature file, or as an ASCII base64 string encoding
186           of a DER-encoded signature prefixed by "base64:". The dm-verity
187           volume will only be opened if the signature of the root hash is
188           valid and signed by a public key present in the kernel keyring. If
189           this option is not specified, but a file with the .roothash.p7s
190           suffix is found next to the image file, bearing otherwise the same
191           name (except if the image has the .raw suffix, in which case the
192           signature file must not have it in its name), the signature is read
193           from it and automatically used.
194
195           If the disk image contains a separate /usr/ partition it may also
196           be Verity protected, in which case the signature for the root hash
197           may configured via a .usrhash.p7s file adjacent to the disk image.
198           There's currently no option to configure the root hash signature
199           for the /usr/ via the unit file directly.
200
201           This option is only available for system services and is not
202           supported for services running in per-user instances of the service
203           manager.
204
205       RootVerity=
206           Takes the path to a data integrity (dm-verity) file. This option
207           enables data integrity checks using dm-verity, if RootImage= is
208           used and a root-hash is passed and if the used image itself does
209           not contains the integrity data. The integrity data must be matched
210           by the root hash. If this option is not specified, but a file with
211           the .verity suffix is found next to the image file, bearing
212           otherwise the same name (except if the image has the .raw suffix,
213           in which case the verity data file must not have it in its name),
214           the verity data is read from it and automatically used.
215
216           This option is supported only for disk images that contain a single
217           file system, without an enveloping partition table. Images that
218           contain a GPT partition table should instead include both root file
219           system and matching Verity data in the same image, implementing the
220           Discoverable Partitions Specification[1].
221
222           This option is only available for system services and is not
223           supported for services running in per-user instances of the service
224           manager.
225
226       MountAPIVFS=
227           Takes a boolean argument. If on, a private mount namespace for the
228           unit's processes is created and the API file systems /proc/, /sys/,
229           /dev/ and /run/ (as an empty "tmpfs") are mounted inside of it,
230           unless they are already mounted. Note that this option has no
231           effect unless used in conjunction with RootDirectory=/RootImage= as
232           these four mounts are generally mounted in the host anyway, and
233           unless the root directory is changed, the private mount namespace
234           will be a 1:1 copy of the host's, and include these four mounts.
235           Note that the /dev/ file system of the host is bind mounted if this
236           option is used without PrivateDevices=. To run the service with a
237           private, minimal version of /dev/, combine this option with
238           PrivateDevices=.
239
240           In order to allow propagating mounts at runtime in a safe manner,
241           /run/systemd/propagate on the host will be used to set up new
242           mounts, and /run/host/incoming/ in the private namespace will be
243           used as an intermediate step to store them before being moved to
244           the final mount point.
245
246           This option is only available for system services and is not
247           supported for services running in per-user instances of the service
248           manager.
249
250       ProtectProc=
251           Takes one of "noaccess", "invisible", "ptraceable" or "default"
252           (which it defaults to). When set, this controls the "hidepid="
253           mount option of the "procfs" instance for the unit that controls
254           which directories with process metainformation (/proc/PID) are
255           visible and accessible: when set to "noaccess" the ability to
256           access most of other users' process metadata in /proc/ is taken
257           away for processes of the service. When set to "invisible"
258           processes owned by other users are hidden from /proc/. If
259           "ptraceable" all processes that cannot be ptrace()'ed by a process
260           are hidden to it. If "default" no restrictions on /proc/ access or
261           visibility are made. For further details see The /proc
262           Filesystem[2]. It is generally recommended to run most system
263           services with this option set to "invisible". This option is
264           implemented via file system namespacing, and thus cannot be used
265           with services that shall be able to install mount points in the
266           host file system hierarchy. Note that the root user is unaffected
267           by this option, so to be effective it has to be used together with
268           User= or DynamicUser=yes, and also without the "CAP_SYS_PTRACE"
269           capability, which also allows a process to bypass this feature. It
270           cannot be used for services that need to access metainformation
271           about other users' processes. This option implies MountAPIVFS=.
272
273           If the kernel doesn't support per-mount point hidepid= mount
274           options this setting remains without effect, and the unit's
275           processes will be able to access and see other process as if the
276           option was not used.
277
278           This option is only available for system services and is not
279           supported for services running in per-user instances of the service
280           manager.
281
282       ProcSubset=
283           Takes one of "all" (the default) and "pid". If "pid", all files and
284           directories not directly associated with process management and
285           introspection are made invisible in the /proc/ file system
286           configured for the unit's processes. This controls the "subset="
287           mount option of the "procfs" instance for the unit. For further
288           details see The /proc Filesystem[2]. Note that Linux exposes
289           various kernel APIs via /proc/, which are made unavailable with
290           this setting. Since these APIs are used frequently this option is
291           useful only in a few, specific cases, and is not suitable for most
292           non-trivial programs.
293
294           Much like ProtectProc= above, this is implemented via file system
295           mount namespacing, and hence the same restrictions apply: it is
296           only available to system services, it disables mount propagation to
297           the host mount table, and it implies MountAPIVFS=. Also, like
298           ProtectProc= this setting is gracefully disabled if the used kernel
299           does not support the "subset=" mount option of "procfs".
300
301       BindPaths=, BindReadOnlyPaths=
302           Configures unit-specific bind mounts. A bind mount makes a
303           particular file or directory available at an additional place in
304           the unit's view of the file system. Any bind mounts created with
305           this option are specific to the unit, and are not visible in the
306           host's mount table. This option expects a whitespace separated list
307           of bind mount definitions. Each definition consists of a
308           colon-separated triple of source path, destination path and option
309           string, where the latter two are optional. If only a source path is
310           specified the source and destination is taken to be the same. The
311           option string may be either "rbind" or "norbind" for configuring a
312           recursive or non-recursive bind mount. If the destination path is
313           omitted, the option string must be omitted too. Each bind mount
314           definition may be prefixed with "-", in which case it will be
315           ignored when its source path does not exist.
316
317           BindPaths= creates regular writable bind mounts (unless the source
318           file system mount is already marked read-only), while
319           BindReadOnlyPaths= creates read-only bind mounts. These settings
320           may be used more than once, each usage appends to the unit's list
321           of bind mounts. If the empty string is assigned to either of these
322           two options the entire list of bind mounts defined prior to this is
323           reset. Note that in this case both read-only and regular bind
324           mounts are reset, regardless which of the two settings is used.
325
326           This option is particularly useful when RootDirectory=/RootImage=
327           is used. In this case the source path refers to a path on the host
328           file system, while the destination path refers to a path below the
329           root directory of the unit.
330
331           Note that the destination directory must exist or systemd must be
332           able to create it. Thus, it is not possible to use those options
333           for mount points nested underneath paths specified in
334           InaccessiblePaths=, or under /home/ and other protected directories
335           if ProtectHome=yes is specified.  TemporaryFileSystem= with ":ro"
336           or ProtectHome=tmpfs should be used instead.
337
338           This option is only available for system services and is not
339           supported for services running in per-user instances of the service
340           manager.
341
342       MountImages=
343           This setting is similar to RootImage= in that it mounts a file
344           system hierarchy from a block device node or loopback file, but the
345           destination directory can be specified as well as mount options.
346           This option expects a whitespace separated list of mount
347           definitions. Each definition consists of a colon-separated tuple of
348           source path and destination definitions, optionally followed by
349           another colon and a list of mount options.
350
351           Mount options may be defined as a single comma-separated list of
352           options, in which case they will be implicitly applied to the root
353           partition on the image, or a series of colon-separated tuples of
354           partition name and mount options. Valid partition names and mount
355           options are the same as for RootImageOptions= setting described
356           above.
357
358           Each mount definition may be prefixed with "-", in which case it
359           will be ignored when its source path does not exist. The source
360           argument is a path to a block device node or regular file. If
361           source or destination contain a ":", it needs to be escaped as
362           "\:". The device node or file system image file needs to follow the
363           same rules as specified for RootImage=. Any mounts created with
364           this option are specific to the unit, and are not visible in the
365           host's mount table.
366
367           These settings may be used more than once, each usage appends to
368           the unit's list of mount paths. If the empty string is assigned,
369           the entire list of mount paths defined prior to this is reset.
370
371           Note that the destination directory must exist or systemd must be
372           able to create it. Thus, it is not possible to use those options
373           for mount points nested underneath paths specified in
374           InaccessiblePaths=, or under /home/ and other protected directories
375           if ProtectHome=yes is specified.
376
377           When DevicePolicy= is set to "closed" or "strict", or set to "auto"
378           and DeviceAllow= is set, then this setting adds /dev/loop-control
379           with rw mode, "block-loop" and "block-blkext" with rwm mode to
380           DeviceAllow=. See systemd.resource-control(5) for the details about
381           DevicePolicy= or DeviceAllow=. Also, see PrivateDevices= below, as
382           it may change the setting of DevicePolicy=.
383
384           This option is only available for system services and is not
385           supported for services running in per-user instances of the service
386           manager.
387
388       ExtensionImages=
389           This setting is similar to MountImages= in that it mounts a file
390           system hierarchy from a block device node or loopback file, but
391           instead of providing a destination path, an overlay will be set up.
392           This option expects a whitespace separated list of mount
393           definitions. Each definition consists of a source path, optionally
394           followed by a colon and a list of mount options.
395
396           A read-only OverlayFS will be set up on top of /usr/ and /opt/
397           hierarchies. The order in which the images are listed will
398           determine the order in which the overlay is laid down: images
399           specified first to last will result in overlayfs layers bottom to
400           top.
401
402           Mount options may be defined as a single comma-separated list of
403           options, in which case they will be implicitly applied to the root
404           partition on the image, or a series of colon-separated tuples of
405           partition name and mount options. Valid partition names and mount
406           options are the same as for RootImageOptions= setting described
407           above.
408
409           Each mount definition may be prefixed with "-", in which case it
410           will be ignored when its source path does not exist. The source
411           argument is a path to a block device node or regular file. If the
412           source path contains a ":", it needs to be escaped as "\:". The
413           device node or file system image file needs to follow the same
414           rules as specified for RootImage=. Any mounts created with this
415           option are specific to the unit, and are not visible in the host's
416           mount table.
417
418           These settings may be used more than once, each usage appends to
419           the unit's list of image paths. If the empty string is assigned,
420           the entire list of mount paths defined prior to this is reset.
421
422           Each image must carry a
423           /usr/lib/extension-release.d/extension-release.IMAGE file, with the
424           appropriate metadata which matches RootImage=/RootDirectory= or the
425           host. See: os-release(5).
426
427           When DevicePolicy= is set to "closed" or "strict", or set to "auto"
428           and DeviceAllow= is set, then this setting adds /dev/loop-control
429           with rw mode, "block-loop" and "block-blkext" with rwm mode to
430           DeviceAllow=. See systemd.resource-control(5) for the details about
431           DevicePolicy= or DeviceAllow=. Also, see PrivateDevices= below, as
432           it may change the setting of DevicePolicy=.
433
434           This option is only available for system services and is not
435           supported for services running in per-user instances of the service
436           manager.
437

USER/GROUP IDENTITY

439       These options are only available for system services and are not
440       supported for services running in per-user instances of the service
441       manager.
442
443       User=, Group=
444           Set the UNIX user or group that the processes are executed as,
445           respectively. Takes a single user or group name, or a numeric ID as
446           argument. For system services (services run by the system service
447           manager, i.e. managed by PID 1) and for user services of the root
448           user (services managed by root's instance of systemd --user), the
449           default is "root", but User= may be used to specify a different
450           user. For user services of any other user, switching user identity
451           is not permitted, hence the only valid setting is the same user the
452           user's service manager is running as. If no group is set, the
453           default group of the user is used. This setting does not affect
454           commands whose command line is prefixed with "+".
455
456           Note that this enforces only weak restrictions on the user/group
457           name syntax, but will generate warnings in many cases where
458           user/group names do not adhere to the following rules: the
459           specified name should consist only of the characters a-z, A-Z, 0-9,
460           "_" and "-", except for the first character which must be one of
461           a-z, A-Z and "_" (i.e. digits and "-" are not permitted as first
462           character). The user/group name must have at least one character,
463           and at most 31. These restrictions are made in order to avoid
464           ambiguities and to ensure user/group names and unit files remain
465           portable among Linux systems. For further details on the names
466           accepted and the names warned about see User/Group Name Syntax[3].
467
468           When used in conjunction with DynamicUser= the user/group name
469           specified is dynamically allocated at the time the service is
470           started, and released at the time the service is stopped — unless
471           it is already allocated statically (see below). If DynamicUser= is
472           not used the specified user and group must have been created
473           statically in the user database no later than the moment the
474           service is started, for example using the sysusers.d(5) facility,
475           which is applied at boot or package install time. If the user does
476           not exist by then program invocation will fail.
477
478           If the User= setting is used the supplementary group list is
479           initialized from the specified user's default group list, as
480           defined in the system's user and group database. Additional groups
481           may be configured through the SupplementaryGroups= setting (see
482           below).
483
484       DynamicUser=
485           Takes a boolean parameter. If set, a UNIX user and group pair is
486           allocated dynamically when the unit is started, and released as
487           soon as it is stopped. The user and group will not be added to
488           /etc/passwd or /etc/group, but are managed transiently during
489           runtime. The nss-systemd(8) glibc NSS module provides integration
490           of these dynamic users/groups into the system's user and group
491           databases. The user and group name to use may be configured via
492           User= and Group= (see above). If these options are not used and
493           dynamic user/group allocation is enabled for a unit, the name of
494           the dynamic user/group is implicitly derived from the unit name. If
495           the unit name without the type suffix qualifies as valid user name
496           it is used directly, otherwise a name incorporating a hash of it is
497           used. If a statically allocated user or group of the configured
498           name already exists, it is used and no dynamic user/group is
499           allocated. Note that if User= is specified and the static group
500           with the name exists, then it is required that the static user with
501           the name already exists. Similarly, if Group= is specified and the
502           static user with the name exists, then it is required that the
503           static group with the name already exists. Dynamic users/groups are
504           allocated from the UID/GID range 61184...65519. It is recommended
505           to avoid this range for regular system or login users. At any point
506           in time each UID/GID from this range is only assigned to zero or
507           one dynamically allocated users/groups in use. However, UID/GIDs
508           are recycled after a unit is terminated. Care should be taken that
509           any processes running as part of a unit for which dynamic
510           users/groups are enabled do not leave files or directories owned by
511           these users/groups around, as a different unit might get the same
512           UID/GID assigned later on, and thus gain access to these files or
513           directories. If DynamicUser= is enabled, RemoveIPC= and PrivateTmp=
514           are implied (and cannot be turned off). This ensures that the
515           lifetime of IPC objects and temporary files created by the executed
516           processes is bound to the runtime of the service, and hence the
517           lifetime of the dynamic user/group. Since /tmp/ and /var/tmp/ are
518           usually the only world-writable directories on a system this
519           ensures that a unit making use of dynamic user/group allocation
520           cannot leave files around after unit termination. Furthermore
521           NoNewPrivileges= and RestrictSUIDSGID= are implicitly enabled (and
522           cannot be disabled), to ensure that processes invoked cannot take
523           benefit or create SUID/SGID files or directories. Moreover
524           ProtectSystem=strict and ProtectHome=read-only are implied, thus
525           prohibiting the service to write to arbitrary file system
526           locations. In order to allow the service to write to certain
527           directories, they have to be allow-listed using ReadWritePaths=,
528           but care must be taken so that UID/GID recycling doesn't create
529           security issues involving files created by the service. Use
530           RuntimeDirectory= (see below) in order to assign a writable runtime
531           directory to a service, owned by the dynamic user/group and removed
532           automatically when the unit is terminated. Use StateDirectory=,
533           CacheDirectory= and LogsDirectory= in order to assign a set of
534           writable directories for specific purposes to the service in a way
535           that they are protected from vulnerabilities due to UID reuse (see
536           below). If this option is enabled, care should be taken that the
537           unit's processes do not get access to directories outside of these
538           explicitly configured and managed ones. Specifically, do not use
539           BindPaths= and be careful with AF_UNIX file descriptor passing for
540           directory file descriptors, as this would permit processes to
541           create files or directories owned by the dynamic user/group that
542           are not subject to the lifecycle and access guarantees of the
543           service. Defaults to off.
544
545       SupplementaryGroups=
546           Sets the supplementary Unix groups the processes are executed as.
547           This takes a space-separated list of group names or IDs. This
548           option may be specified more than once, in which case all listed
549           groups are set as supplementary groups. When the empty string is
550           assigned, the list of supplementary groups is reset, and all
551           assignments prior to this one will have no effect. In any way, this
552           option does not override, but extends the list of supplementary
553           groups configured in the system group database for the user. This
554           does not affect commands prefixed with "+".
555
556       PAMName=
557           Sets the PAM service name to set up a session as. If set, the
558           executed process will be registered as a PAM session under the
559           specified service name. This is only useful in conjunction with the
560           User= setting, and is otherwise ignored. If not set, no PAM session
561           will be opened for the executed processes. See pam(8) for details.
562
563           Note that for each unit making use of this option a PAM session
564           handler process will be maintained as part of the unit and stays
565           around as long as the unit is active, to ensure that appropriate
566           actions can be taken when the unit and hence the PAM session
567           terminates. This process is named "(sd-pam)" and is an immediate
568           child process of the unit's main process.
569
570           Note that when this option is used for a unit it is very likely
571           (depending on PAM configuration) that the main unit process will be
572           migrated to its own session scope unit when it is activated. This
573           process will hence be associated with two units: the unit it was
574           originally started from (and for which PAMName= was configured),
575           and the session scope unit. Any child processes of that process
576           will however be associated with the session scope unit only. This
577           has implications when used in combination with NotifyAccess=all, as
578           these child processes will not be able to affect changes in the
579           original unit through notification messages. These messages will be
580           considered belonging to the session scope unit and not the original
581           unit. It is hence not recommended to use PAMName= in combination
582           with NotifyAccess=all.
583

CAPABILITIES

585       These options are only available for system services and are not
586       supported for services running in per-user instances of the service
587       manager.
588
589       CapabilityBoundingSet=
590           Controls which capabilities to include in the capability bounding
591           set for the executed process. See capabilities(7) for details.
592           Takes a whitespace-separated list of capability names, e.g.
593           CAP_SYS_ADMIN, CAP_DAC_OVERRIDE, CAP_SYS_PTRACE. Capabilities
594           listed will be included in the bounding set, all others are
595           removed. If the list of capabilities is prefixed with "~", all but
596           the listed capabilities will be included, the effect of the
597           assignment inverted. Note that this option also affects the
598           respective capabilities in the effective, permitted and inheritable
599           capability sets. If this option is not used, the capability
600           bounding set is not modified on process execution, hence no limits
601           on the capabilities of the process are enforced. This option may
602           appear more than once, in which case the bounding sets are merged
603           by OR, or by AND if the lines are prefixed with "~" (see below). If
604           the empty string is assigned to this option, the bounding set is
605           reset to the empty capability set, and all prior settings have no
606           effect. If set to "~" (without any further argument), the bounding
607           set is reset to the full set of available capabilities, also
608           undoing any previous settings. This does not affect commands
609           prefixed with "+".
610
611           Use systemd-analyze(1)'s capability command to retrieve a list of
612           capabilities defined on the local system.
613
614           Example: if a unit has the following,
615
616               CapabilityBoundingSet=CAP_A CAP_B
617               CapabilityBoundingSet=CAP_B CAP_C
618
619           then CAP_A, CAP_B, and CAP_C are set. If the second line is
620           prefixed with "~", e.g.,
621
622               CapabilityBoundingSet=CAP_A CAP_B
623               CapabilityBoundingSet=~CAP_B CAP_C
624
625           then, only CAP_A is set.
626
627       AmbientCapabilities=
628           Controls which capabilities to include in the ambient capability
629           set for the executed process. Takes a whitespace-separated list of
630           capability names, e.g.  CAP_SYS_ADMIN, CAP_DAC_OVERRIDE,
631           CAP_SYS_PTRACE. This option may appear more than once in which case
632           the ambient capability sets are merged (see the above examples in
633           CapabilityBoundingSet=). If the list of capabilities is prefixed
634           with "~", all but the listed capabilities will be included, the
635           effect of the assignment inverted. If the empty string is assigned
636           to this option, the ambient capability set is reset to the empty
637           capability set, and all prior settings have no effect. If set to
638           "~" (without any further argument), the ambient capability set is
639           reset to the full set of available capabilities, also undoing any
640           previous settings. Note that adding capabilities to ambient
641           capability set adds them to the process's inherited capability set.
642
643           Ambient capability sets are useful if you want to execute a process
644           as a non-privileged user but still want to give it some
645           capabilities. Note that in this case option keep-caps is
646           automatically added to SecureBits= to retain the capabilities over
647           the user change.  AmbientCapabilities= does not affect commands
648           prefixed with "+".
649

SECURITY

651       NoNewPrivileges=
652           Takes a boolean argument. If true, ensures that the service process
653           and all its children can never gain new privileges through execve()
654           (e.g. via setuid or setgid bits, or filesystem capabilities). This
655           is the simplest and most effective way to ensure that a process and
656           its children can never elevate privileges again. Defaults to false,
657           but certain settings override this and ignore the value of this
658           setting. This is the case when DynamicUser=, LockPersonality=,
659           MemoryDenyWriteExecute=, PrivateDevices=, ProtectClock=,
660           ProtectHostname=, ProtectKernelLogs=, ProtectKernelModules=,
661           ProtectKernelTunables=, RestrictAddressFamilies=,
662           RestrictNamespaces=, RestrictRealtime=, RestrictSUIDSGID=,
663           SystemCallArchitectures=, SystemCallFilter=, or SystemCallLog= are
664           specified. Note that even if this setting is overridden by them,
665           systemctl show shows the original value of this setting. In case
666           the service will be run in a new mount namespace anyway and SELinux
667           is disabled, all file systems are mounted with MS_NOSUID flag. Also
668           see No New Privileges Flag[4].
669
670       SecureBits=
671           Controls the secure bits set for the executed process. Takes a
672           space-separated combination of options from the following list:
673           keep-caps, keep-caps-locked, no-setuid-fixup,
674           no-setuid-fixup-locked, noroot, and noroot-locked. This option may
675           appear more than once, in which case the secure bits are ORed. If
676           the empty string is assigned to this option, the bits are reset to
677           0. This does not affect commands prefixed with "+". See
678           capabilities(7) for details.
679

MANDATORY ACCESS CONTROL

681       These options are only available for system services and are not
682       supported for services running in per-user instances of the service
683       manager.
684
685       SELinuxContext=
686           Set the SELinux security context of the executed process. If set,
687           this will override the automated domain transition. However, the
688           policy still needs to authorize the transition. This directive is
689           ignored if SELinux is disabled. If prefixed by "-", failing to set
690           the SELinux security context will be ignored, but it's still
691           possible that the subsequent execve() may fail if the policy
692           doesn't allow the transition for the non-overridden context. This
693           does not affect commands prefixed with "+". See setexeccon(3) for
694           details.
695
696       AppArmorProfile=
697           Takes a profile name as argument. The process executed by the unit
698           will switch to this profile when started. Profiles must already be
699           loaded in the kernel, or the unit will fail. If prefixed by "-",
700           all errors will be ignored. This setting has no effect if AppArmor
701           is not enabled. This setting does not affect commands prefixed with
702           "+".
703
704       SmackProcessLabel=
705           Takes a SMACK64 security label as argument. The process executed by
706           the unit will be started under this label and SMACK will decide
707           whether the process is allowed to run or not, based on it. The
708           process will continue to run under the label specified here unless
709           the executable has its own SMACK64EXEC label, in which case the
710           process will transition to run under that label. When not
711           specified, the label that systemd is running under is used. This
712           directive is ignored if SMACK is disabled.
713
714           The value may be prefixed by "-", in which case all errors will be
715           ignored. An empty value may be specified to unset previous
716           assignments. This does not affect commands prefixed with "+".
717

PROCESS PROPERTIES

719       LimitCPU=, LimitFSIZE=, LimitDATA=, LimitSTACK=, LimitCORE=, LimitRSS=,
720       LimitNOFILE=, LimitAS=, LimitNPROC=, LimitMEMLOCK=, LimitLOCKS=,
721       LimitSIGPENDING=, LimitMSGQUEUE=, LimitNICE=, LimitRTPRIO=,
722       LimitRTTIME=
723           Set soft and hard limits on various resources for executed
724           processes. See setrlimit(2) for details on the resource limit
725           concept. Resource limits may be specified in two formats: either as
726           single value to set a specific soft and hard limit to the same
727           value, or as colon-separated pair soft:hard to set both limits
728           individually (e.g.  "LimitAS=4G:16G"). Use the string infinity to
729           configure no limit on a specific resource. The multiplicative
730           suffixes K, M, G, T, P and E (to the base 1024) may be used for
731           resource limits measured in bytes (e.g.  "LimitAS=16G"). For the
732           limits referring to time values, the usual time units ms, s, min, h
733           and so on may be used (see systemd.time(7) for details). Note that
734           if no time unit is specified for LimitCPU= the default unit of
735           seconds is implied, while for LimitRTTIME= the default unit of
736           microseconds is implied. Also, note that the effective granularity
737           of the limits might influence their enforcement. For example, time
738           limits specified for LimitCPU= will be rounded up implicitly to
739           multiples of 1s. For LimitNICE= the value may be specified in two
740           syntaxes: if prefixed with "+" or "-", the value is understood as
741           regular Linux nice value in the range -20...19. If not prefixed
742           like this the value is understood as raw resource limit parameter
743           in the range 0...40 (with 0 being equivalent to 1).
744
745           Note that most process resource limits configured with these
746           options are per-process, and processes may fork in order to acquire
747           a new set of resources that are accounted independently of the
748           original process, and may thus escape limits set. Also note that
749           LimitRSS= is not implemented on Linux, and setting it has no
750           effect. Often it is advisable to prefer the resource controls
751           listed in systemd.resource-control(5) over these per-process
752           limits, as they apply to services as a whole, may be altered
753           dynamically at runtime, and are generally more expressive. For
754           example, MemoryMax= is a more powerful (and working) replacement
755           for LimitRSS=.
756
757           Resource limits not configured explicitly for a unit default to the
758           value configured in the various DefaultLimitCPU=,
759           DefaultLimitFSIZE=, ... options available in systemd-
760           system.conf(5), and – if not configured there – the kernel or
761           per-user defaults, as defined by the OS (the latter only for user
762           services, see below).
763
764           For system units these resource limits may be chosen freely. When
765           these settings are configured in a user service (i.e. a service run
766           by the per-user instance of the service manager) they cannot be
767           used to raise the limits above those set for the user manager
768           itself when it was first invoked, as the user's service manager
769           generally lacks the privileges to do so. In user context these
770           configuration options are hence only useful to lower the limits
771           passed in or to raise the soft limit to the maximum of the hard
772           limit as configured for the user. To raise the user's limits
773           further, the available configuration mechanisms differ between
774           operating systems, but typically require privileges. In most cases
775           it is possible to configure higher per-user resource limits via PAM
776           or by setting limits on the system service encapsulating the user's
777           service manager, i.e. the user's instance of user@.service. After
778           making such changes, make sure to restart the user's service
779           manager.
780
781           Table 1. Resource limit directives, their equivalent ulimit shell
782           commands and the unit used
783           ┌─────────────────┬───────────────────┬─────────────────────┐
784Directive        ulimit equivalent │ Unit                
785           ├─────────────────┼───────────────────┼─────────────────────┤
786           │LimitCPU=        │ ulimit -t         │ Seconds             │
787           ├─────────────────┼───────────────────┼─────────────────────┤
788           │LimitFSIZE=      │ ulimit -f         │ Bytes               │
789           ├─────────────────┼───────────────────┼─────────────────────┤
790           │LimitDATA=       │ ulimit -d         │ Bytes               │
791           ├─────────────────┼───────────────────┼─────────────────────┤
792           │LimitSTACK=      │ ulimit -s         │ Bytes               │
793           ├─────────────────┼───────────────────┼─────────────────────┤
794           │LimitCORE=       │ ulimit -c         │ Bytes               │
795           ├─────────────────┼───────────────────┼─────────────────────┤
796           │LimitRSS=        │ ulimit -m         │ Bytes               │
797           ├─────────────────┼───────────────────┼─────────────────────┤
798           │LimitNOFILE=     │ ulimit -n         │ Number of File      │
799           │                 │                   │ Descriptors         │
800           ├─────────────────┼───────────────────┼─────────────────────┤
801           │LimitAS=         │ ulimit -v         │ Bytes               │
802           ├─────────────────┼───────────────────┼─────────────────────┤
803           │LimitNPROC=      │ ulimit -u         │ Number of Processes │
804           ├─────────────────┼───────────────────┼─────────────────────┤
805           │LimitMEMLOCK=    │ ulimit -l         │ Bytes               │
806           ├─────────────────┼───────────────────┼─────────────────────┤
807           │LimitLOCKS=      │ ulimit -x         │ Number of Locks     │
808           ├─────────────────┼───────────────────┼─────────────────────┤
809           │LimitSIGPENDING= │ ulimit -i         │ Number of Queued    │
810           │                 │                   │ Signals             │
811           ├─────────────────┼───────────────────┼─────────────────────┤
812           │LimitMSGQUEUE=   │ ulimit -q         │ Bytes               │
813           ├─────────────────┼───────────────────┼─────────────────────┤
814           │LimitNICE=       │ ulimit -e         │ Nice Level          │
815           ├─────────────────┼───────────────────┼─────────────────────┤
816           │LimitRTPRIO=     │ ulimit -r         │ Realtime Priority   │
817           ├─────────────────┼───────────────────┼─────────────────────┤
818           │LimitRTTIME=     │ No equivalent     │ Microseconds        │
819           └─────────────────┴───────────────────┴─────────────────────┘
820
821       UMask=
822           Controls the file mode creation mask. Takes an access mode in octal
823           notation. See umask(2) for details. Defaults to 0022 for system
824           units. For user units the default value is inherited from the
825           per-user service manager (whose default is in turn inherited from
826           the system service manager, and thus typically also is 0022 —
827           unless overridden by a PAM module). In order to change the per-user
828           mask for all user services, consider setting the UMask= setting of
829           the user's user@.service system service instance. The per-user
830           umask may also be set via the umask field of a user's JSON User
831           Record[5] (for users managed by systemd-homed.service(8) this field
832           may be controlled via homectl --umask=). It may also be set via a
833           PAM module, such as pam_umask(8).
834
835       CoredumpFilter=
836           Controls which types of memory mappings will be saved if the
837           process dumps core (using the /proc/pid/coredump_filter file).
838           Takes a whitespace-separated combination of mapping type names or
839           numbers (with the default base 16). Mapping type names are
840           private-anonymous, shared-anonymous, private-file-backed,
841           shared-file-backed, elf-headers, private-huge, shared-huge,
842           private-dax, shared-dax, and the special values all (all types) and
843           default (the kernel default of "private-anonymous shared-anonymous
844           elf-headers private-huge"). See core(5) for the meaning of the
845           mapping types. When specified multiple times, all specified masks
846           are ORed. When not set, or if the empty value is assigned, the
847           inherited value is not changed.
848
849           Example 2. Add DAX pages to the dump filter
850
851               CoredumpFilter=default private-dax shared-dax
852
853       KeyringMode=
854           Controls how the kernel session keyring is set up for the service
855           (see session-keyring(7) for details on the session keyring). Takes
856           one of inherit, private, shared. If set to inherit no special
857           keyring setup is done, and the kernel's default behaviour is
858           applied. If private is used a new session keyring is allocated when
859           a service process is invoked, and it is not linked up with any user
860           keyring. This is the recommended setting for system services, as
861           this ensures that multiple services running under the same system
862           user ID (in particular the root user) do not share their key
863           material among each other. If shared is used a new session keyring
864           is allocated as for private, but the user keyring of the user
865           configured with User= is linked into it, so that keys assigned to
866           the user may be requested by the unit's processes. In this modes
867           multiple units running processes under the same user ID may share
868           key material. Unless inherit is selected the unique invocation ID
869           for the unit (see below) is added as a protected key by the name
870           "invocation_id" to the newly created session keyring. Defaults to
871           private for services of the system service manager and to inherit
872           for non-service units and for services of the user service manager.
873
874       OOMScoreAdjust=
875           Sets the adjustment value for the Linux kernel's Out-Of-Memory
876           (OOM) killer score for executed processes. Takes an integer between
877           -1000 (to disable OOM killing of processes of this unit) and 1000
878           (to make killing of processes of this unit under memory pressure
879           very likely). See proc.txt[6] for details. If not specified
880           defaults to the OOM score adjustment level of the service manager
881           itself, which is normally at 0.
882
883           Use the OOMPolicy= setting of service units to configure how the
884           service manager shall react to the kernel OOM killer terminating a
885           process of the service. See systemd.service(5) for details.
886
887       TimerSlackNSec=
888           Sets the timer slack in nanoseconds for the executed processes. The
889           timer slack controls the accuracy of wake-ups triggered by timers.
890           See prctl(2) for more information. Note that in contrast to most
891           other time span definitions this parameter takes an integer value
892           in nano-seconds if no unit is specified. The usual time units are
893           understood too.
894
895       Personality=
896           Controls which kernel architecture uname(2) shall report, when
897           invoked by unit processes. Takes one of the architecture
898           identifiers x86, x86-64, ppc, ppc-le, ppc64, ppc64-le, s390 or
899           s390x. Which personality architectures are supported depends on the
900           system architecture. Usually the 64bit versions of the various
901           system architectures support their immediate 32bit personality
902           architecture counterpart, but no others. For example, x86-64
903           systems support the x86-64 and x86 personalities but no others. The
904           personality feature is useful when running 32-bit services on a
905           64-bit host system. If not specified, the personality is left
906           unmodified and thus reflects the personality of the host system's
907           kernel.
908
909       IgnoreSIGPIPE=
910           Takes a boolean argument. If true, causes SIGPIPE to be ignored in
911           the executed process. Defaults to true because SIGPIPE generally is
912           useful only in shell pipelines.
913

SCHEDULING

915       Nice=
916           Sets the default nice level (scheduling priority) for executed
917           processes. Takes an integer between -20 (highest priority) and 19
918           (lowest priority). In case of resource contention, smaller values
919           mean more resources will be made available to the unit's processes,
920           larger values mean less resources will be made available. See
921           setpriority(2) for details.
922
923       CPUSchedulingPolicy=
924           Sets the CPU scheduling policy for executed processes. Takes one of
925           other, batch, idle, fifo or rr. See sched_setscheduler(2) for
926           details.
927
928       CPUSchedulingPriority=
929           Sets the CPU scheduling priority for executed processes. The
930           available priority range depends on the selected CPU scheduling
931           policy (see above). For real-time scheduling policies an integer
932           between 1 (lowest priority) and 99 (highest priority) can be used.
933           In case of CPU resource contention, smaller values mean less CPU
934           time is made available to the service, larger values mean more. See
935           sched_setscheduler(2) for details.
936
937       CPUSchedulingResetOnFork=
938           Takes a boolean argument. If true, elevated CPU scheduling
939           priorities and policies will be reset when the executed processes
940           call fork(2), and can hence not leak into child processes. See
941           sched_setscheduler(2) for details. Defaults to false.
942
943       CPUAffinity=
944           Controls the CPU affinity of the executed processes. Takes a list
945           of CPU indices or ranges separated by either whitespace or commas.
946           Alternatively, takes a special "numa" value in which case systemd
947           automatically derives allowed CPU range based on the value of
948           NUMAMask= option. CPU ranges are specified by the lower and upper
949           CPU indices separated by a dash. This option may be specified more
950           than once, in which case the specified CPU affinity masks are
951           merged. If the empty string is assigned, the mask is reset, all
952           assignments prior to this will have no effect. See
953           sched_setaffinity(2) for details.
954
955       NUMAPolicy=
956           Controls the NUMA memory policy of the executed processes. Takes a
957           policy type, one of: default, preferred, bind, interleave and
958           local. A list of NUMA nodes that should be associated with the
959           policy must be specified in NUMAMask=. For more details on each
960           policy please see, set_mempolicy(2). For overall overview of NUMA
961           support in Linux see, numa(7).
962
963       NUMAMask=
964           Controls the NUMA node list which will be applied alongside with
965           selected NUMA policy. Takes a list of NUMA nodes and has the same
966           syntax as a list of CPUs for CPUAffinity= option or special "all"
967           value which will include all available NUMA nodes in the mask. Note
968           that the list of NUMA nodes is not required for default and local
969           policies and for preferred policy we expect a single NUMA node.
970
971       IOSchedulingClass=
972           Sets the I/O scheduling class for executed processes. Takes one of
973           the strings realtime, best-effort or idle. The kernel's default
974           scheduling class is best-effort at a priority of 4. If the empty
975           string is assigned to this option, all prior assignments to both
976           IOSchedulingClass= and IOSchedulingPriority= have no effect. See
977           ioprio_set(2) for details.
978
979       IOSchedulingPriority=
980           Sets the I/O scheduling priority for executed processes. Takes an
981           integer between 0 (highest priority) and 7 (lowest priority). In
982           case of I/O contention, smaller values mean more I/O bandwidth is
983           made available to the unit's processes, larger values mean less
984           bandwidth. The available priorities depend on the selected I/O
985           scheduling class (see above). If the empty string is assigned to
986           this option, all prior assignments to both IOSchedulingClass= and
987           IOSchedulingPriority= have no effect. For the kernel's default
988           scheduling class (best-effort) this defaults to 4. See
989           ioprio_set(2) for details.
990

SANDBOXING

992       The following sandboxing options are an effective way to limit the
993       exposure of the system towards the unit's processes. It is recommended
994       to turn on as many of these options for each unit as is possible
995       without negatively affecting the process' ability to operate. Note that
996       many of these sandboxing features are gracefully turned off on systems
997       where the underlying security mechanism is not available. For example,
998       ProtectSystem= has no effect if the kernel is built without file system
999       namespacing or if the service manager runs in a container manager that
1000       makes file system namespacing unavailable to its payload. Similar,
1001       RestrictRealtime= has no effect on systems that lack support for
1002       SECCOMP system call filtering, or in containers where support for this
1003       is turned off.
1004
1005       Also note that some sandboxing functionality is generally not available
1006       in user services (i.e. services run by the per-user service manager).
1007       Specifically, the various settings requiring file system namespacing
1008       support (such as ProtectSystem=) are not available, as the underlying
1009       kernel functionality is only accessible to privileged processes.
1010       However, most namespacing settings, that will not work on their own in
1011       user services, will work when used in conjunction with
1012       PrivateUsers=true.
1013
1014       ProtectSystem=
1015           Takes a boolean argument or the special values "full" or "strict".
1016           If true, mounts the /usr/ and the boot loader directories (/boot
1017           and /efi) read-only for processes invoked by this unit. If set to
1018           "full", the /etc/ directory is mounted read-only, too. If set to
1019           "strict" the entire file system hierarchy is mounted read-only,
1020           except for the API file system subtrees /dev/, /proc/ and /sys/
1021           (protect these directories using PrivateDevices=,
1022           ProtectKernelTunables=, ProtectControlGroups=). This setting
1023           ensures that any modification of the vendor-supplied operating
1024           system (and optionally its configuration, and local mounts) is
1025           prohibited for the service. It is recommended to enable this
1026           setting for all long-running services, unless they are involved
1027           with system updates or need to modify the operating system in other
1028           ways. If this option is used, ReadWritePaths= may be used to
1029           exclude specific directories from being made read-only. This
1030           setting is implied if DynamicUser= is set. This setting cannot
1031           ensure protection in all cases. In general it has the same
1032           limitations as ReadOnlyPaths=, see below. Defaults to off.
1033
1034       ProtectHome=
1035           Takes a boolean argument or the special values "read-only" or
1036           "tmpfs". If true, the directories /home/, /root, and /run/user are
1037           made inaccessible and empty for processes invoked by this unit. If
1038           set to "read-only", the three directories are made read-only
1039           instead. If set to "tmpfs", temporary file systems are mounted on
1040           the three directories in read-only mode. The value "tmpfs" is
1041           useful to hide home directories not relevant to the processes
1042           invoked by the unit, while still allowing necessary directories to
1043           be made visible when listed in BindPaths= or BindReadOnlyPaths=.
1044
1045           Setting this to "yes" is mostly equivalent to set the three
1046           directories in InaccessiblePaths=. Similarly, "read-only" is mostly
1047           equivalent to ReadOnlyPaths=, and "tmpfs" is mostly equivalent to
1048           TemporaryFileSystem= with ":ro".
1049
1050           It is recommended to enable this setting for all long-running
1051           services (in particular network-facing ones), to ensure they cannot
1052           get access to private user data, unless the services actually
1053           require access to the user's private data. This setting is implied
1054           if DynamicUser= is set. This setting cannot ensure protection in
1055           all cases. In general it has the same limitations as
1056           ReadOnlyPaths=, see below.
1057
1058           This option is only available for system services and is not
1059           supported for services running in per-user instances of the service
1060           manager.
1061
1062       RuntimeDirectory=, StateDirectory=, CacheDirectory=, LogsDirectory=,
1063       ConfigurationDirectory=
1064           These options take a whitespace-separated list of directory names.
1065           The specified directory names must be relative, and may not include
1066           "..". If set, when the unit is started, one or more directories by
1067           the specified names will be created (including their parents) below
1068           the locations defined in the following table. Also, the
1069           corresponding environment variable will be defined with the full
1070           paths of the directories. If multiple directories are set, then in
1071           the environment variable the paths are concatenated with colon
1072           (":").
1073
1074           Table 2. Automatic directory creation and environment variables
1075           ┌────────────────────────┬────────────────┬───────────────────────┬──────────────────────────┐
1076Directory               Below path for Below path for        Environment              
1077           │                        │ system units   user units            variable set             
1078           ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
1079RuntimeDirectory=       │ /run/          │ $XDG_RUNTIME_DIR$RUNTIME_DIRECTORY
1080           ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
1081StateDirectory=         │ /var/lib/      │ $XDG_CONFIG_HOME$STATE_DIRECTORY
1082           ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
1083CacheDirectory=         │ /var/cache/    │ $XDG_CACHE_HOME$CACHE_DIRECTORY
1084           ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
1085LogsDirectory=          │ /var/log/      │ $XDG_CONFIG_HOME/log/ │ $LOGS_DIRECTORY
1086           ├────────────────────────┼────────────────┼───────────────────────┼──────────────────────────┤
1087ConfigurationDirectory= │ /etc/          │ $XDG_CONFIG_HOME$CONFIGURATION_DIRECTORY
1088           └────────────────────────┴────────────────┴───────────────────────┴──────────────────────────┘
1089           In case of RuntimeDirectory= the innermost subdirectories are
1090           removed when the unit is stopped. It is possible to preserve the
1091           specified directories in this case if RuntimeDirectoryPreserve= is
1092           configured to restart or yes (see below). The directories specified
1093           with StateDirectory=, CacheDirectory=, LogsDirectory=,
1094           ConfigurationDirectory= are not removed when the unit is stopped.
1095
1096           Except in case of ConfigurationDirectory=, the innermost specified
1097           directories will be owned by the user and group specified in User=
1098           and Group=. If the specified directories already exist and their
1099           owning user or group do not match the configured ones, all files
1100           and directories below the specified directories as well as the
1101           directories themselves will have their file ownership recursively
1102           changed to match what is configured. As an optimization, if the
1103           specified directories are already owned by the right user and
1104           group, files and directories below of them are left as-is, even if
1105           they do not match what is requested. The innermost specified
1106           directories will have their access mode adjusted to the what is
1107           specified in RuntimeDirectoryMode=, StateDirectoryMode=,
1108           CacheDirectoryMode=, LogsDirectoryMode= and
1109           ConfigurationDirectoryMode=.
1110
1111           These options imply BindPaths= for the specified paths. When
1112           combined with RootDirectory= or RootImage= these paths always
1113           reside on the host and are mounted from there into the unit's file
1114           system namespace.
1115
1116           If DynamicUser= is used, the logic for CacheDirectory=,
1117           LogsDirectory= and StateDirectory= is slightly altered: the
1118           directories are created below /var/cache/private, /var/log/private
1119           and /var/lib/private, respectively, which are host directories made
1120           inaccessible to unprivileged users, which ensures that access to
1121           these directories cannot be gained through dynamic user ID
1122           recycling. Symbolic links are created to hide this difference in
1123           behaviour. Both from perspective of the host and from inside the
1124           unit, the relevant directories hence always appear directly below
1125           /var/cache, /var/log and /var/lib.
1126
1127           Use RuntimeDirectory= to manage one or more runtime directories for
1128           the unit and bind their lifetime to the daemon runtime. This is
1129           particularly useful for unprivileged daemons that cannot create
1130           runtime directories in /run/ due to lack of privileges, and to make
1131           sure the runtime directory is cleaned up automatically after use.
1132           For runtime directories that require more complex or different
1133           configuration or lifetime guarantees, please consider using
1134           tmpfiles.d(5).
1135
1136           RuntimeDirectory=, StateDirectory=, CacheDirectory= and
1137           LogsDirectory= optionally support a second parameter, separated by
1138           ":". The second parameter will be interpreted as a destination path
1139           that will be created as a symlink to the directory. The symlinks
1140           will be created after any BindPaths= or TemporaryFileSystem=
1141           options have been set up, to make ephemeral symlinking possible.
1142           The same source can have multiple symlinks, by using the same first
1143           parameter, but a different second parameter.
1144
1145           The directories defined by these options are always created under
1146           the standard paths used by systemd (/var/, /run/, /etc/, ...). If
1147           the service needs directories in a different location, a different
1148           mechanism has to be used to create them.
1149
1150           tmpfiles.d(5) provides functionality that overlaps with these
1151           options. Using these options is recommended, because the lifetime
1152           of the directories is tied directly to the lifetime of the unit,
1153           and it is not necessary to ensure that the tmpfiles.d configuration
1154           is executed before the unit is started.
1155
1156           To remove any of the directories created by these settings, use the
1157           systemctl clean ...  command on the relevant units, see
1158           systemctl(1) for details.
1159
1160           Example: if a system service unit has the following,
1161
1162               RuntimeDirectory=foo/bar baz
1163
1164           the service manager creates /run/foo (if it does not exist),
1165           /run/foo/bar, and /run/baz. The directories /run/foo/bar and
1166           /run/baz except /run/foo are owned by the user and group specified
1167           in User= and Group=, and removed when the service is stopped.
1168
1169           Example: if a system service unit has the following,
1170
1171               RuntimeDirectory=foo/bar
1172               StateDirectory=aaa/bbb ccc
1173
1174           then the environment variable "RUNTIME_DIRECTORY" is set with
1175           "/run/foo/bar", and "STATE_DIRECTORY" is set with
1176           "/var/lib/aaa/bbb:/var/lib/ccc".
1177
1178           Example: if a system service unit has the following,
1179
1180               RuntimeDirectory=foo:bar foo:baz
1181
1182           the service manager creates /run/foo (if it does not exist), and
1183           /run/bar plus /run/baz as symlinks to /run/foo.
1184
1185       RuntimeDirectoryMode=, StateDirectoryMode=, CacheDirectoryMode=,
1186       LogsDirectoryMode=, ConfigurationDirectoryMode=
1187           Specifies the access mode of the directories specified in
1188           RuntimeDirectory=, StateDirectory=, CacheDirectory=,
1189           LogsDirectory=, or ConfigurationDirectory=, respectively, as an
1190           octal number. Defaults to 0755. See "Permissions" in
1191           path_resolution(7) for a discussion of the meaning of permission
1192           bits.
1193
1194       RuntimeDirectoryPreserve=
1195           Takes a boolean argument or restart. If set to no (the default),
1196           the directories specified in RuntimeDirectory= are always removed
1197           when the service stops. If set to restart the directories are
1198           preserved when the service is both automatically and manually
1199           restarted. Here, the automatic restart means the operation
1200           specified in Restart=, and manual restart means the one triggered
1201           by systemctl restart foo.service. If set to yes, then the
1202           directories are not removed when the service is stopped. Note that
1203           since the runtime directory /run/ is a mount point of "tmpfs", then
1204           for system services the directories specified in RuntimeDirectory=
1205           are removed when the system is rebooted.
1206
1207       TimeoutCleanSec=
1208           Configures a timeout on the clean-up operation requested through
1209           systemctl clean ..., see systemctl(1) for details. Takes the usual
1210           time values and defaults to infinity, i.e. by default no timeout is
1211           applied. If a timeout is configured the clean operation will be
1212           aborted forcibly when the timeout is reached, potentially leaving
1213           resources on disk.
1214
1215       ReadWritePaths=, ReadOnlyPaths=, InaccessiblePaths=, ExecPaths=,
1216       NoExecPaths=
1217           Sets up a new file system namespace for executed processes. These
1218           options may be used to limit access a process has to the file
1219           system. Each setting takes a space-separated list of paths relative
1220           to the host's root directory (i.e. the system running the service
1221           manager). Note that if paths contain symlinks, they are resolved
1222           relative to the root directory set with RootDirectory=/RootImage=.
1223
1224           Paths listed in ReadWritePaths= are accessible from within the
1225           namespace with the same access modes as from outside of it. Paths
1226           listed in ReadOnlyPaths= are accessible for reading only, writing
1227           will be refused even if the usual file access controls would permit
1228           this. Nest ReadWritePaths= inside of ReadOnlyPaths= in order to
1229           provide writable subdirectories within read-only directories. Use
1230           ReadWritePaths= in order to allow-list specific paths for write
1231           access if ProtectSystem=strict is used.
1232
1233           Paths listed in InaccessiblePaths= will be made inaccessible for
1234           processes inside the namespace along with everything below them in
1235           the file system hierarchy. This may be more restrictive than
1236           desired, because it is not possible to nest ReadWritePaths=,
1237           ReadOnlyPaths=, BindPaths=, or BindReadOnlyPaths= inside it. For a
1238           more flexible option, see TemporaryFileSystem=.
1239
1240           Content in paths listed in NoExecPaths= are not executable even if
1241           the usual file access controls would permit this. Nest ExecPaths=
1242           inside of NoExecPaths= in order to provide executable content
1243           within non-executable directories.
1244
1245           Non-directory paths may be specified as well. These options may be
1246           specified more than once, in which case all paths listed will have
1247           limited access from within the namespace. If the empty string is
1248           assigned to this option, the specific list is reset, and all prior
1249           assignments have no effect.
1250
1251           Paths in ReadWritePaths=, ReadOnlyPaths=, InaccessiblePaths=,
1252           ExecPaths= and NoExecPaths= may be prefixed with "-", in which case
1253           they will be ignored when they do not exist. If prefixed with "+"
1254           the paths are taken relative to the root directory of the unit, as
1255           configured with RootDirectory=/RootImage=, instead of relative to
1256           the root directory of the host (see above). When combining "-" and
1257           "+" on the same path make sure to specify "-" first, and "+"
1258           second.
1259
1260           Note that these settings will disconnect propagation of mounts from
1261           the unit's processes to the host. This means that this setting may
1262           not be used for services which shall be able to install mount
1263           points in the main mount namespace. For ReadWritePaths= and
1264           ReadOnlyPaths= propagation in the other direction is not affected,
1265           i.e. mounts created on the host generally appear in the unit
1266           processes' namespace, and mounts removed on the host also disappear
1267           there too. In particular, note that mount propagation from host to
1268           unit will result in unmodified mounts to be created in the unit's
1269           namespace, i.e. writable mounts appearing on the host will be
1270           writable in the unit's namespace too, even when propagated below a
1271           path marked with ReadOnlyPaths=! Restricting access with these
1272           options hence does not extend to submounts of a directory that are
1273           created later on. This means the lock-down offered by that setting
1274           is not complete, and does not offer full protection.
1275
1276           Note that the effect of these settings may be undone by privileged
1277           processes. In order to set up an effective sandboxed environment
1278           for a unit it is thus recommended to combine these settings with
1279           either CapabilityBoundingSet=~CAP_SYS_ADMIN or
1280           SystemCallFilter=~@mount.
1281
1282           Simple allow-list example using these directives:
1283
1284               [Service]
1285               ReadOnlyPaths=/
1286               ReadWritePaths=/var /run
1287               InaccessiblePaths=-/lost+found
1288               NoExecPaths=/
1289               ExecPaths=/usr/sbin/my_daemon /usr/lib /usr/lib64
1290
1291           These options are only available for system services and are not
1292           supported for services running in per-user instances of the service
1293           manager.
1294
1295       TemporaryFileSystem=
1296           Takes a space-separated list of mount points for temporary file
1297           systems (tmpfs). If set, a new file system namespace is set up for
1298           executed processes, and a temporary file system is mounted on each
1299           mount point. This option may be specified more than once, in which
1300           case temporary file systems are mounted on all listed mount points.
1301           If the empty string is assigned to this option, the list is reset,
1302           and all prior assignments have no effect. Each mount point may
1303           optionally be suffixed with a colon (":") and mount options such as
1304           "size=10%" or "ro". By default, each temporary file system is
1305           mounted with "nodev,strictatime,mode=0755". These can be disabled
1306           by explicitly specifying the corresponding mount options, e.g.,
1307           "dev" or "nostrictatime".
1308
1309           This is useful to hide files or directories not relevant to the
1310           processes invoked by the unit, while necessary files or directories
1311           can be still accessed by combining with BindPaths= or
1312           BindReadOnlyPaths=:
1313
1314           Example: if a unit has the following,
1315
1316               TemporaryFileSystem=/var:ro
1317               BindReadOnlyPaths=/var/lib/systemd
1318
1319           then the invoked processes by the unit cannot see any files or
1320           directories under /var/ except for /var/lib/systemd or its
1321           contents.
1322
1323           This option is only available for system services and is not
1324           supported for services running in per-user instances of the service
1325           manager.
1326
1327       PrivateTmp=
1328           Takes a boolean argument. If true, sets up a new file system
1329           namespace for the executed processes and mounts private /tmp/ and
1330           /var/tmp/ directories inside it that are not shared by processes
1331           outside of the namespace. This is useful to secure access to
1332           temporary files of the process, but makes sharing between processes
1333           via /tmp/ or /var/tmp/ impossible. If true, all temporary files
1334           created by a service in these directories will be removed after the
1335           service is stopped. Defaults to false. It is possible to run two or
1336           more units within the same private /tmp/ and /var/tmp/ namespace by
1337           using the JoinsNamespaceOf= directive, see systemd.unit(5) for
1338           details. This setting is implied if DynamicUser= is set. For this
1339           setting the same restrictions regarding mount propagation and
1340           privileges apply as for ReadOnlyPaths= and related calls, see
1341           above. Enabling this setting has the side effect of adding
1342           Requires= and After= dependencies on all mount units necessary to
1343           access /tmp/ and /var/tmp/. Moreover an implicitly After= ordering
1344           on systemd-tmpfiles-setup.service(8) is added.
1345
1346           Note that the implementation of this setting might be impossible
1347           (for example if mount namespaces are not available), and the unit
1348           should be written in a way that does not solely rely on this
1349           setting for security.
1350
1351           This option is only available for system services and is not
1352           supported for services running in per-user instances of the service
1353           manager.
1354
1355       PrivateDevices=
1356           Takes a boolean argument. If true, sets up a new /dev/ mount for
1357           the executed processes and only adds API pseudo devices such as
1358           /dev/null, /dev/zero or /dev/random (as well as the pseudo TTY
1359           subsystem) to it, but no physical devices such as /dev/sda, system
1360           memory /dev/mem, system ports /dev/port and others. This is useful
1361           to turn off physical device access by the executed process.
1362           Defaults to false.
1363
1364           Enabling this option will install a system call filter to block
1365           low-level I/O system calls that are grouped in the @raw-io set,
1366           remove CAP_MKNOD and CAP_SYS_RAWIO from the capability bounding set
1367           for the unit, and set DevicePolicy=closed (see systemd.resource-
1368           control(5) for details). Note that using this setting will
1369           disconnect propagation of mounts from the service to the host
1370           (propagation in the opposite direction continues to work). This
1371           means that this setting may not be used for services which shall be
1372           able to install mount points in the main mount namespace. The new
1373           /dev/ will be mounted read-only and 'noexec'. The latter may break
1374           old programs which try to set up executable memory by using mmap(2)
1375           of /dev/zero instead of using MAP_ANON. For this setting the same
1376           restrictions regarding mount propagation and privileges apply as
1377           for ReadOnlyPaths= and related calls, see above. If turned on and
1378           if running in user mode, or in system mode, but without the
1379           CAP_SYS_ADMIN capability (e.g. setting User=), NoNewPrivileges=yes
1380           is implied.
1381
1382           Note that the implementation of this setting might be impossible
1383           (for example if mount namespaces are not available), and the unit
1384           should be written in a way that does not solely rely on this
1385           setting for security.
1386
1387           This option is only available for system services and is not
1388           supported for services running in per-user instances of the service
1389           manager.
1390
1391           When access to some but not all devices must be possible, the
1392           DeviceAllow= setting might be used instead. See systemd.resource-
1393           control(5).
1394
1395       PrivateNetwork=
1396           Takes a boolean argument. If true, sets up a new network namespace
1397           for the executed processes and configures only the loopback network
1398           device "lo" inside it. No other network devices will be available
1399           to the executed process. This is useful to turn off network access
1400           by the executed process. Defaults to false. It is possible to run
1401           two or more units within the same private network namespace by
1402           using the JoinsNamespaceOf= directive, see systemd.unit(5) for
1403           details. Note that this option will disconnect all socket families
1404           from the host, including AF_NETLINK and AF_UNIX. Effectively, for
1405           AF_NETLINK this means that device configuration events received
1406           from systemd-udevd.service(8) are not delivered to the unit's
1407           processes. And for AF_UNIX this has the effect that AF_UNIX sockets
1408           in the abstract socket namespace of the host will become
1409           unavailable to the unit's processes (however, those located in the
1410           file system will continue to be accessible).
1411
1412           Note that the implementation of this setting might be impossible
1413           (for example if network namespaces are not available), and the unit
1414           should be written in a way that does not solely rely on this
1415           setting for security.
1416
1417           When this option is used on a socket unit any sockets bound on
1418           behalf of this unit will be bound within a private network
1419           namespace. This may be combined with JoinsNamespaceOf= to listen on
1420           sockets inside of network namespaces of other services.
1421
1422           This option is only available for system services and is not
1423           supported for services running in per-user instances of the service
1424           manager.
1425
1426       NetworkNamespacePath=
1427           Takes an absolute file system path refererring to a Linux network
1428           namespace pseudo-file (i.e. a file like /proc/$PID/ns/net or a bind
1429           mount or symlink to one). When set the invoked processes are added
1430           to the network namespace referenced by that path. The path has to
1431           point to a valid namespace file at the moment the processes are
1432           forked off. If this option is used PrivateNetwork= has no effect.
1433           If this option is used together with JoinsNamespaceOf= then it only
1434           has an effect if this unit is started before any of the listed
1435           units that have PrivateNetwork= or NetworkNamespacePath=
1436           configured, as otherwise the network namespace of those units is
1437           reused.
1438
1439           When this option is used on a socket unit any sockets bound on
1440           behalf of this unit will be bound within the specified network
1441           namespace.
1442
1443           This option is only available for system services and is not
1444           supported for services running in per-user instances of the service
1445           manager.
1446
1447       PrivateIPC=
1448           Takes a boolean argument. If true, sets up a new IPC namespace for
1449           the executed processes. Each IPC namespace has its own set of
1450           System V IPC identifiers and its own POSIX message queue file
1451           system. This is useful to avoid name clash of IPC identifiers.
1452           Defaults to false. It is possible to run two or more units within
1453           the same private IPC namespace by using the JoinsNamespaceOf=
1454           directive, see systemd.unit(5) for details.
1455
1456           Note that IPC namespacing does not have an effect on AF_UNIX
1457           sockets, which are the most common form of IPC used on Linux.
1458           Instead, AF_UNIX sockets in the file system are subject to mount
1459           namespacing, and those in the abstract namespace are subject to
1460           network namespacing. IPC namespacing only has an effect on SysV IPC
1461           (which is mostly legacy) as well as POSIX message queues (for which
1462           AF_UNIX/SOCK_SEQPACKET sockets are typically a better replacement).
1463           IPC namespacing also has no effect on POSIX shared memory (which is
1464           subject to mount namespacing) either. See ipc_namespaces(7) for the
1465           details.
1466
1467           Note that the implementation of this setting might be impossible
1468           (for example if IPC namespaces are not available), and the unit
1469           should be written in a way that does not solely rely on this
1470           setting for security.
1471
1472           This option is only available for system services and is not
1473           supported for services running in per-user instances of the service
1474           manager.
1475
1476       IPCNamespacePath=
1477           Takes an absolute file system path refererring to a Linux IPC
1478           namespace pseudo-file (i.e. a file like /proc/$PID/ns/ipc or a bind
1479           mount or symlink to one). When set the invoked processes are added
1480           to the network namespace referenced by that path. The path has to
1481           point to a valid namespace file at the moment the processes are
1482           forked off. If this option is used PrivateIPC= has no effect. If
1483           this option is used together with JoinsNamespaceOf= then it only
1484           has an effect if this unit is started before any of the listed
1485           units that have PrivateIPC= or IPCNamespacePath= configured, as
1486           otherwise the network namespace of those units is reused.
1487
1488           This option is only available for system services and is not
1489           supported for services running in per-user instances of the service
1490           manager.
1491
1492       PrivateUsers=
1493           Takes a boolean argument. If true, sets up a new user namespace for
1494           the executed processes and configures a minimal user and group
1495           mapping, that maps the "root" user and group as well as the unit's
1496           own user and group to themselves and everything else to the
1497           "nobody" user and group. This is useful to securely detach the user
1498           and group databases used by the unit from the rest of the system,
1499           and thus to create an effective sandbox environment. All files,
1500           directories, processes, IPC objects and other resources owned by
1501           users/groups not equaling "root" or the unit's own will stay
1502           visible from within the unit but appear owned by the "nobody" user
1503           and group. If this mode is enabled, all unit processes are run
1504           without privileges in the host user namespace (regardless if the
1505           unit's own user/group is "root" or not). Specifically this means
1506           that the process will have zero process capabilities on the host's
1507           user namespace, but full capabilities within the service's user
1508           namespace. Settings such as CapabilityBoundingSet= will affect only
1509           the latter, and there's no way to acquire additional capabilities
1510           in the host's user namespace. Defaults to off.
1511
1512           When this setting is set up by a per-user instance of the service
1513           manager, the mapping of the "root" user and group to itself is
1514           omitted (unless the user manager is root). Additionally, in the
1515           per-user instance manager case, the user namespace will be set up
1516           before most other namespaces. This means that combining
1517           PrivateUsers=true with other namespaces will enable use of features
1518           not normally supported by the per-user instances of the service
1519           manager.
1520
1521           This setting is particularly useful in conjunction with
1522           RootDirectory=/RootImage=, as the need to synchronize the user and
1523           group databases in the root directory and on the host is reduced,
1524           as the only users and groups who need to be matched are "root",
1525           "nobody" and the unit's own user and group.
1526
1527           Note that the implementation of this setting might be impossible
1528           (for example if user namespaces are not available), and the unit
1529           should be written in a way that does not solely rely on this
1530           setting for security.
1531
1532       ProtectHostname=
1533           Takes a boolean argument. When set, sets up a new UTS namespace for
1534           the executed processes. In addition, changing hostname or
1535           domainname is prevented. Defaults to off.
1536
1537           Note that the implementation of this setting might be impossible
1538           (for example if UTS namespaces are not available), and the unit
1539           should be written in a way that does not solely rely on this
1540           setting for security.
1541
1542           Note that when this option is enabled for a service hostname
1543           changes no longer propagate from the system into the service, it is
1544           hence not suitable for services that need to take notice of system
1545           hostname changes dynamically.
1546
1547           If this setting is on, but the unit doesn't have the CAP_SYS_ADMIN
1548           capability (e.g. services for which User= is set),
1549           NoNewPrivileges=yes is implied.
1550
1551           This option is only available for system services and is not
1552           supported for services running in per-user instances of the service
1553           manager.
1554
1555       ProtectClock=
1556           Takes a boolean argument. If set, writes to the hardware clock or
1557           system clock will be denied. It is recommended to turn this on for
1558           most services that do not need modify the clock. Defaults to off.
1559           Enabling this option removes CAP_SYS_TIME and CAP_WAKE_ALARM from
1560           the capability bounding set for this unit, installs a system call
1561           filter to block calls that can set the clock, and
1562           DeviceAllow=char-rtc r is implied. This ensures /dev/rtc0,
1563           /dev/rtc1, etc. are made read-only to the service. See
1564           systemd.resource-control(5) for the details about DeviceAllow=. If
1565           this setting is on, but the unit doesn't have the CAP_SYS_ADMIN
1566           capability (e.g. services for which User= is set),
1567           NoNewPrivileges=yes is implied.
1568
1569           This option is only available for system services and is not
1570           supported for services running in per-user instances of the service
1571           manager.
1572
1573       ProtectKernelTunables=
1574           Takes a boolean argument. If true, kernel variables accessible
1575           through /proc/sys/, /sys/, /proc/sysrq-trigger,
1576           /proc/latency_stats, /proc/acpi, /proc/timer_stats, /proc/fs and
1577           /proc/irq will be made read-only to all processes of the unit.
1578           Usually, tunable kernel variables should be initialized only at
1579           boot-time, for example with the sysctl.d(5) mechanism. Few services
1580           need to write to these at runtime; it is hence recommended to turn
1581           this on for most services. For this setting the same restrictions
1582           regarding mount propagation and privileges apply as for
1583           ReadOnlyPaths= and related calls, see above. Defaults to off. If
1584           this setting is on, but the unit doesn't have the CAP_SYS_ADMIN
1585           capability (e.g. services for which User= is set),
1586           NoNewPrivileges=yes is implied. Note that this option does not
1587           prevent indirect changes to kernel tunables effected by IPC calls
1588           to other processes. However, InaccessiblePaths= may be used to make
1589           relevant IPC file system objects inaccessible. If
1590           ProtectKernelTunables= is set, MountAPIVFS=yes is implied.
1591
1592           This option is only available for system services and is not
1593           supported for services running in per-user instances of the service
1594           manager.
1595
1596       ProtectKernelModules=
1597           Takes a boolean argument. If true, explicit module loading will be
1598           denied. This allows module load and unload operations to be turned
1599           off on modular kernels. It is recommended to turn this on for most
1600           services that do not need special file systems or extra kernel
1601           modules to work. Defaults to off. Enabling this option removes
1602           CAP_SYS_MODULE from the capability bounding set for the unit, and
1603           installs a system call filter to block module system calls, also
1604           /usr/lib/modules is made inaccessible. For this setting the same
1605           restrictions regarding mount propagation and privileges apply as
1606           for ReadOnlyPaths= and related calls, see above. Note that limited
1607           automatic module loading due to user configuration or kernel
1608           mapping tables might still happen as side effect of requested user
1609           operations, both privileged and unprivileged. To disable module
1610           auto-load feature please see sysctl.d(5) kernel.modules_disabled
1611           mechanism and /proc/sys/kernel/modules_disabled documentation. If
1612           this setting is on, but the unit doesn't have the CAP_SYS_ADMIN
1613           capability (e.g. services for which User= is set),
1614           NoNewPrivileges=yes is implied.
1615
1616           This option is only available for system services and is not
1617           supported for services running in per-user instances of the service
1618           manager.
1619
1620       ProtectKernelLogs=
1621           Takes a boolean argument. If true, access to the kernel log ring
1622           buffer will be denied. It is recommended to turn this on for most
1623           services that do not need to read from or write to the kernel log
1624           ring buffer. Enabling this option removes CAP_SYSLOG from the
1625           capability bounding set for this unit, and installs a system call
1626           filter to block the syslog(2) system call (not to be confused with
1627           the libc API syslog(3) for userspace logging). The kernel exposes
1628           its log buffer to userspace via /dev/kmsg and /proc/kmsg. If
1629           enabled, these are made inaccessible to all the processes in the
1630           unit. If this setting is on, but the unit doesn't have the
1631           CAP_SYS_ADMIN capability (e.g. services for which User= is set),
1632           NoNewPrivileges=yes is implied.
1633
1634           This option is only available for system services and is not
1635           supported for services running in per-user instances of the service
1636           manager.
1637
1638       ProtectControlGroups=
1639           Takes a boolean argument. If true, the Linux Control Groups
1640           (cgroups(7)) hierarchies accessible through /sys/fs/cgroup/ will be
1641           made read-only to all processes of the unit. Except for container
1642           managers no services should require write access to the control
1643           groups hierarchies; it is hence recommended to turn this on for
1644           most services. For this setting the same restrictions regarding
1645           mount propagation and privileges apply as for ReadOnlyPaths= and
1646           related calls, see above. Defaults to off. If ProtectControlGroups=
1647           is set, MountAPIVFS=yes is implied.
1648
1649           This option is only available for system services and is not
1650           supported for services running in per-user instances of the service
1651           manager.
1652
1653       RestrictAddressFamilies=
1654           Restricts the set of socket address families accessible to the
1655           processes of this unit. Takes "none", or a space-separated list of
1656           address family names to allow-list, such as AF_UNIX, AF_INET or
1657           AF_INET6. When "none" is specified, then all address families will
1658           be denied. When prefixed with "~" the listed address families will
1659           be applied as deny list, otherwise as allow list. Note that this
1660           restricts access to the socket(2) system call only. Sockets passed
1661           into the process by other means (for example, by using socket
1662           activation with socket units, see systemd.socket(5)) are
1663           unaffected. Also, sockets created with socketpair() (which creates
1664           connected AF_UNIX sockets only) are unaffected. Note that this
1665           option has no effect on 32-bit x86, s390, s390x, mips, mips-le,
1666           ppc, ppc-le, ppc64, ppc64-le and is ignored (but works correctly on
1667           other ABIs, including x86-64). Note that on systems supporting
1668           multiple ABIs (such as x86/x86-64) it is recommended to turn off
1669           alternative ABIs for services, so that they cannot be used to
1670           circumvent the restrictions of this option. Specifically, it is
1671           recommended to combine this option with
1672           SystemCallArchitectures=native or similar. If running in user mode,
1673           or in system mode, but without the CAP_SYS_ADMIN capability (e.g.
1674           setting User=), NoNewPrivileges=yes is implied. By default, no
1675           restrictions apply, all address families are accessible to
1676           processes. If assigned the empty string, any previous address
1677           family restriction changes are undone. This setting does not affect
1678           commands prefixed with "+".
1679
1680           Use this option to limit exposure of processes to remote access, in
1681           particular via exotic and sensitive network protocols, such as
1682           AF_PACKET. Note that in most cases, the local AF_UNIX address
1683           family should be included in the configured allow list as it is
1684           frequently used for local communication, including for syslog(2)
1685           logging.
1686
1687       RestrictFileSystems=
1688           Restricts the set of filesystems processes of this unit can open
1689           files on. Takes a space-separated list of filesystem names. Any
1690           filesystem listed is made accessible to the unit's processes,
1691           access to filesystem types not listed is prohibited
1692           (allow-listing). If the first character of the list is "~", the
1693           effect is inverted: access to the filesystems listed is prohibited
1694           (deny-listing). If the empty string is assigned, access to
1695           filesystems is not restricted.
1696
1697           If you specify both types of this option (i.e. allow-listing and
1698           deny-listing), the first encountered will take precedence and will
1699           dictate the default action (allow access to the filesystem or deny
1700           it). Then the next occurrences of this option will add or delete
1701           the listed filesystems from the set of the restricted filesystems,
1702           depending on its type and the default action.
1703
1704           Example: if a unit has the following,
1705
1706               RestrictFileSystems=ext4 tmpfs
1707               RestrictFileSystems=ext2 ext4
1708
1709           then access to ext4, tmpfs, and ext2 is allowed and access to other
1710           filesystems is denied.
1711
1712           Example: if a unit has the following,
1713
1714               RestrictFileSystems=ext4 tmpfs
1715               RestrictFileSystems=~ext4
1716
1717           then only access tmpfs is allowed.
1718
1719           Example: if a unit has the following,
1720
1721               RestrictFileSystems=~ext4 tmpfs
1722               RestrictFileSystems=ext4
1723
1724           then only access to tmpfs is denied.
1725
1726           As the number of possible filesystems is large, predefined sets of
1727           filesystems are provided. A set starts with "@" character, followed
1728           by name of the set.
1729
1730           Table 3. Currently predefined filesystem sets
1731           ┌──────────────────┬────────────────────────────┐
1732Set               Description                
1733           ├──────────────────┼────────────────────────────┤
1734           │@basic-api        │ Basic filesystem API.      │
1735           ├──────────────────┼────────────────────────────┤
1736           │@auxiliary-api    │ Auxiliary filesystem API.  │
1737           ├──────────────────┼────────────────────────────┤
1738           │@common-block     │ Common block device        │
1739           │                  │ filesystems.               │
1740           ├──────────────────┼────────────────────────────┤
1741           │@historical-block │ Historical block device    │
1742           │                  │ filesystems.               │
1743           ├──────────────────┼────────────────────────────┤
1744           │@network          │ Well-known network         │
1745           │                  │ filesystems.               │
1746           ├──────────────────┼────────────────────────────┤
1747           │@privileged-api   │ Privileged filesystem API. │
1748           ├──────────────────┼────────────────────────────┤
1749           │@temporary        │ Temporary filesystems:     │
1750           │                  │ tmpfs, ramfs.              │
1751           ├──────────────────┼────────────────────────────┤
1752           │@known            │ All known filesystems      │
1753           │                  │ defined by the kernel.     │
1754           │                  │ This list is defined       │
1755           │                  │ statically in systemd      │
1756           │                  │ based on a kernel version  │
1757           │                  │ that was available when    │
1758           │                  │ this systemd version was   │
1759           │                  │ released. It will become   │
1760           │                  │ progressively more         │
1761           │                  │ out-of-date as the kernel  │
1762           │                  │ is updated.                │
1763           └──────────────────┴────────────────────────────┘
1764           Use systemd-analyze(1)'s filesystems command to retrieve a list of
1765           filesystems defined on the local system.
1766
1767           Note that this setting might not be supported on some systems (for
1768           example if the LSM eBPF hook is not enabled in the underlying
1769           kernel or if not using the unified control group hierarchy). In
1770           that case this setting has no effect.
1771
1772       RestrictNamespaces=
1773           Restricts access to Linux namespace functionality for the processes
1774           of this unit. For details about Linux namespaces, see
1775           namespaces(7). Either takes a boolean argument, or a
1776           space-separated list of namespace type identifiers. If false (the
1777           default), no restrictions on namespace creation and switching are
1778           made. If true, access to any kind of namespacing is prohibited.
1779           Otherwise, a space-separated list of namespace type identifiers
1780           must be specified, consisting of any combination of: cgroup, ipc,
1781           net, mnt, pid, user and uts. Any namespace type listed is made
1782           accessible to the unit's processes, access to namespace types not
1783           listed is prohibited (allow-listing). By prepending the list with a
1784           single tilde character ("~") the effect may be inverted: only the
1785           listed namespace types will be made inaccessible, all unlisted ones
1786           are permitted (deny-listing). If the empty string is assigned, the
1787           default namespace restrictions are applied, which is equivalent to
1788           false. This option may appear more than once, in which case the
1789           namespace types are merged by OR, or by AND if the lines are
1790           prefixed with "~" (see examples below). Internally, this setting
1791           limits access to the unshare(2), clone(2) and setns(2) system
1792           calls, taking the specified flags parameters into account. Note
1793           that — if this option is used — in addition to restricting creation
1794           and switching of the specified types of namespaces (or all of them,
1795           if true) access to the setns() system call with a zero flags
1796           parameter is prohibited. This setting is only supported on x86,
1797           x86-64, mips, mips-le, mips64, mips64-le, mips64-n32,
1798           mips64-le-n32, ppc64, ppc64-le, s390 and s390x, and enforces no
1799           restrictions on other architectures. If running in user mode, or in
1800           system mode, but without the CAP_SYS_ADMIN capability (e.g. setting
1801           User=), NoNewPrivileges=yes is implied.
1802
1803           Example: if a unit has the following,
1804
1805               RestrictNamespaces=cgroup ipc
1806               RestrictNamespaces=cgroup net
1807
1808           then cgroup, ipc, and net are set. If the second line is prefixed
1809           with "~", e.g.,
1810
1811               RestrictNamespaces=cgroup ipc
1812               RestrictNamespaces=~cgroup net
1813
1814           then, only ipc is set.
1815
1816       LockPersonality=
1817           Takes a boolean argument. If set, locks down the personality(2)
1818           system call so that the kernel execution domain may not be changed
1819           from the default or the personality selected with Personality=
1820           directive. This may be useful to improve security, because odd
1821           personality emulations may be poorly tested and source of
1822           vulnerabilities. If running in user mode, or in system mode, but
1823           without the CAP_SYS_ADMIN capability (e.g. setting User=),
1824           NoNewPrivileges=yes is implied.
1825
1826       MemoryDenyWriteExecute=
1827           Takes a boolean argument. If set, attempts to create memory
1828           mappings that are writable and executable at the same time, or to
1829           change existing memory mappings to become executable, or mapping
1830           shared memory segments as executable are prohibited. Specifically,
1831           a system call filter is added that rejects mmap(2) system calls
1832           with both PROT_EXEC and PROT_WRITE set, mprotect(2) or
1833           pkey_mprotect(2) system calls with PROT_EXEC set and shmat(2)
1834           system calls with SHM_EXEC set. Note that this option is
1835           incompatible with programs and libraries that generate program code
1836           dynamically at runtime, including JIT execution engines, executable
1837           stacks, and code "trampoline" feature of various C compilers. This
1838           option improves service security, as it makes harder for software
1839           exploits to change running code dynamically. However, the
1840           protection can be circumvented, if the service can write to a
1841           filesystem, which is not mounted with noexec (such as /dev/shm), or
1842           it can use memfd_create(). This can be prevented by making such
1843           file systems inaccessible to the service (e.g.
1844           InaccessiblePaths=/dev/shm) and installing further system call
1845           filters (SystemCallFilter=~memfd_create). Note that this feature is
1846           fully available on x86-64, and partially on x86. Specifically, the
1847           shmat() protection is not available on x86. Note that on systems
1848           supporting multiple ABIs (such as x86/x86-64) it is recommended to
1849           turn off alternative ABIs for services, so that they cannot be used
1850           to circumvent the restrictions of this option. Specifically, it is
1851           recommended to combine this option with
1852           SystemCallArchitectures=native or similar. If running in user mode,
1853           or in system mode, but without the CAP_SYS_ADMIN capability (e.g.
1854           setting User=), NoNewPrivileges=yes is implied.
1855
1856       RestrictRealtime=
1857           Takes a boolean argument. If set, any attempts to enable realtime
1858           scheduling in a process of the unit are refused. This restricts
1859           access to realtime task scheduling policies such as SCHED_FIFO,
1860           SCHED_RR or SCHED_DEADLINE. See sched(7) for details about these
1861           scheduling policies. If running in user mode, or in system mode,
1862           but without the CAP_SYS_ADMIN capability (e.g. setting User=),
1863           NoNewPrivileges=yes is implied. Realtime scheduling policies may be
1864           used to monopolize CPU time for longer periods of time, and may
1865           hence be used to lock up or otherwise trigger Denial-of-Service
1866           situations on the system. It is hence recommended to restrict
1867           access to realtime scheduling to the few programs that actually
1868           require them. Defaults to off.
1869
1870       RestrictSUIDSGID=
1871           Takes a boolean argument. If set, any attempts to set the
1872           set-user-ID (SUID) or set-group-ID (SGID) bits on files or
1873           directories will be denied (for details on these bits see
1874           inode(7)). If running in user mode, or in system mode, but without
1875           the CAP_SYS_ADMIN capability (e.g. setting User=),
1876           NoNewPrivileges=yes is implied. As the SUID/SGID bits are
1877           mechanisms to elevate privileges, and allows users to acquire the
1878           identity of other users, it is recommended to restrict creation of
1879           SUID/SGID files to the few programs that actually require them.
1880           Note that this restricts marking of any type of file system object
1881           with these bits, including both regular files and directories
1882           (where the SGID is a different meaning than for files, see
1883           documentation). This option is implied if DynamicUser= is enabled.
1884           Defaults to off.
1885
1886       RemoveIPC=
1887           Takes a boolean parameter. If set, all System V and POSIX IPC
1888           objects owned by the user and group the processes of this unit are
1889           run as are removed when the unit is stopped. This setting only has
1890           an effect if at least one of User=, Group= and DynamicUser= are
1891           used. It has no effect on IPC objects owned by the root user.
1892           Specifically, this removes System V semaphores, as well as System V
1893           and POSIX shared memory segments and message queues. If multiple
1894           units use the same user or group the IPC objects are removed when
1895           the last of these units is stopped. This setting is implied if
1896           DynamicUser= is set.
1897
1898           This option is only available for system services and is not
1899           supported for services running in per-user instances of the service
1900           manager.
1901
1902       PrivateMounts=
1903           Takes a boolean parameter. If set, the processes of this unit will
1904           be run in their own private file system (mount) namespace with all
1905           mount propagation from the processes towards the host's main file
1906           system namespace turned off. This means any file system mount
1907           points established or removed by the unit's processes will be
1908           private to them and not be visible to the host. However, file
1909           system mount points established or removed on the host will be
1910           propagated to the unit's processes. See mount_namespaces(7) for
1911           details on file system namespaces. Defaults to off.
1912
1913           When turned on, this executes three operations for each invoked
1914           process: a new CLONE_NEWNS namespace is created, after which all
1915           existing mounts are remounted to MS_SLAVE to disable propagation
1916           from the unit's processes to the host (but leaving propagation in
1917           the opposite direction in effect). Finally, the mounts are
1918           remounted again to the propagation mode configured with
1919           MountFlags=, see below.
1920
1921           File system namespaces are set up individually for each process
1922           forked off by the service manager. Mounts established in the
1923           namespace of the process created by ExecStartPre= will hence be
1924           cleaned up automatically as soon as that process exits and will not
1925           be available to subsequent processes forked off for ExecStart= (and
1926           similar applies to the various other commands configured for
1927           units). Similarly, JoinsNamespaceOf= does not permit sharing kernel
1928           mount namespaces between units, it only enables sharing of the
1929           /tmp/ and /var/tmp/ directories.
1930
1931           Other file system namespace unit settings — PrivateMounts=,
1932           PrivateTmp=, PrivateDevices=, ProtectSystem=, ProtectHome=,
1933           ReadOnlyPaths=, InaccessiblePaths=, ReadWritePaths=, ... — also
1934           enable file system namespacing in a fashion equivalent to this
1935           option. Hence it is primarily useful to explicitly request this
1936           behaviour if none of the other settings are used.
1937
1938           This option is only available for system services and is not
1939           supported for services running in per-user instances of the service
1940           manager.
1941
1942       MountFlags=
1943           Takes a mount propagation setting: shared, slave or private, which
1944           controls whether file system mount points in the file system
1945           namespaces set up for this unit's processes will receive or
1946           propagate mounts and unmounts from other file system namespaces.
1947           See mount(2) for details on mount propagation, and the three
1948           propagation flags in particular.
1949
1950           This setting only controls the final propagation setting in effect
1951           on all mount points of the file system namespace created for each
1952           process of this unit. Other file system namespacing unit settings
1953           (see the discussion in PrivateMounts= above) will implicitly
1954           disable mount and unmount propagation from the unit's processes
1955           towards the host by changing the propagation setting of all mount
1956           points in the unit's file system namespace to slave first. Setting
1957           this option to shared does not reestablish propagation in that
1958           case.
1959
1960           If not set – but file system namespaces are enabled through another
1961           file system namespace unit setting – shared mount propagation is
1962           used, but — as mentioned — as slave is applied first, propagation
1963           from the unit's processes to the host is still turned off.
1964
1965           It is not recommended to use private mount propagation for units,
1966           as this means temporary mounts (such as removable media) of the
1967           host will stay mounted and thus indefinitely busy in forked off
1968           processes, as unmount propagation events won't be received by the
1969           file system namespace of the unit.
1970
1971           Usually, it is best to leave this setting unmodified, and use
1972           higher level file system namespacing options instead, in particular
1973           PrivateMounts=, see above.
1974
1975           This option is only available for system services and is not
1976           supported for services running in per-user instances of the service
1977           manager.
1978

SYSTEM CALL FILTERING

1980       SystemCallFilter=
1981           Takes a space-separated list of system call names. If this setting
1982           is used, all system calls executed by the unit processes except for
1983           the listed ones will result in immediate process termination with
1984           the SIGSYS signal (allow-listing). (See SystemCallErrorNumber=
1985           below for changing the default action). If the first character of
1986           the list is "~", the effect is inverted: only the listed system
1987           calls will result in immediate process termination (deny-listing).
1988           Deny-listed system calls and system call groups may optionally be
1989           suffixed with a colon (":") and "errno" error number (between 0 and
1990           4095) or errno name such as EPERM, EACCES or EUCLEAN (see errno(3)
1991           for a full list). This value will be returned when a deny-listed
1992           system call is triggered, instead of terminating the processes
1993           immediately. Special setting "kill" can be used to explicitly
1994           specify killing. This value takes precedence over the one given in
1995           SystemCallErrorNumber=, see below. If running in user mode, or in
1996           system mode, but without the CAP_SYS_ADMIN capability (e.g. setting
1997           User=), NoNewPrivileges=yes is implied. This feature makes use of
1998           the Secure Computing Mode 2 interfaces of the kernel ('seccomp
1999           filtering') and is useful for enforcing a minimal sandboxing
2000           environment. Note that the execve(), exit(), exit_group(),
2001           getrlimit(), rt_sigreturn(), sigreturn() system calls and the
2002           system calls for querying time and sleeping are implicitly
2003           allow-listed and do not need to be listed explicitly. This option
2004           may be specified more than once, in which case the filter masks are
2005           merged. If the empty string is assigned, the filter is reset, all
2006           prior assignments will have no effect. This does not affect
2007           commands prefixed with "+".
2008
2009           Note that on systems supporting multiple ABIs (such as x86/x86-64)
2010           it is recommended to turn off alternative ABIs for services, so
2011           that they cannot be used to circumvent the restrictions of this
2012           option. Specifically, it is recommended to combine this option with
2013           SystemCallArchitectures=native or similar.
2014
2015           Note that strict system call filters may impact execution and error
2016           handling code paths of the service invocation. Specifically, access
2017           to the execve() system call is required for the execution of the
2018           service binary — if it is blocked service invocation will
2019           necessarily fail. Also, if execution of the service binary fails
2020           for some reason (for example: missing service executable), the
2021           error handling logic might require access to an additional set of
2022           system calls in order to process and log this failure correctly. It
2023           might be necessary to temporarily disable system call filters in
2024           order to simplify debugging of such failures.
2025
2026           If you specify both types of this option (i.e. allow-listing and
2027           deny-listing), the first encountered will take precedence and will
2028           dictate the default action (termination or approval of a system
2029           call). Then the next occurrences of this option will add or delete
2030           the listed system calls from the set of the filtered system calls,
2031           depending of its type and the default action. (For example, if you
2032           have started with an allow list rule for read() and write(), and
2033           right after it add a deny list rule for write(), then write() will
2034           be removed from the set.)
2035
2036           As the number of possible system calls is large, predefined sets of
2037           system calls are provided. A set starts with "@" character,
2038           followed by name of the set.
2039
2040           Table 4. Currently predefined system call sets
2041           ┌────────────────┬────────────────────────────┐
2042Set             Description                
2043           ├────────────────┼────────────────────────────┤
2044           │@aio            │ Asynchronous I/O           │
2045           │                │ (io_setup(2),              │
2046           │                │ io_submit(2), and related  │
2047           │                │ calls)                     │
2048           ├────────────────┼────────────────────────────┤
2049           │@basic-io       │ System calls for basic     │
2050           │                │ I/O: reading, writing,     │
2051           │                │ seeking, file descriptor   │
2052           │                │ duplication and closing    │
2053           │                │ (read(2), write(2), and    │
2054           │                │ related calls)             │
2055           ├────────────────┼────────────────────────────┤
2056           │@chown          │ Changing file ownership    │
2057           │                │ (chown(2), fchownat(2),    │
2058           │                │ and related calls)         │
2059           ├────────────────┼────────────────────────────┤
2060           │@clock          │ System calls for changing  │
2061           │                │ the system clock           │
2062           │                │ (adjtimex(2),              │
2063           │                │ settimeofday(2), and       │
2064           │                │ related calls)             │
2065           ├────────────────┼────────────────────────────┤
2066           │@cpu-emulation  │ System calls for CPU       │
2067           │                │ emulation functionality    │
2068           │                │ (vm86(2) and related       │
2069           │                │ calls)                     │
2070           ├────────────────┼────────────────────────────┤
2071           │@debug          │ Debugging, performance     │
2072           │                │ monitoring and tracing     │
2073           │                │ functionality (ptrace(2),  │
2074           │                │ perf_event_open(2) and     │
2075           │                │ related calls)             │
2076           ├────────────────┼────────────────────────────┤
2077           │@file-system    │ File system operations:    │
2078           │                │ opening, creating files    │
2079           │                │ and directories for read   │
2080           │                │ and write, renaming and    │
2081           │                │ removing them, reading     │
2082           │                │ file properties, or        │
2083           │                │ creating hard and symbolic │
2084           │                │ links                      │
2085           ├────────────────┼────────────────────────────┤
2086           │@io-event       │ Event loop system calls    │
2087           │                │ (poll(2), select(2),       │
2088           │                │ epoll(7), eventfd(2) and   │
2089           │                │ related calls)             │
2090           ├────────────────┼────────────────────────────┤
2091           │@ipc            │ Pipes, SysV IPC, POSIX     │
2092           │                │ Message Queues and other   │
2093           │                │ IPC (mq_overview(7),       │
2094           │                │ svipc(7))                  │
2095           ├────────────────┼────────────────────────────┤
2096           │@keyring        │ Kernel keyring access      │
2097           │                │ (keyctl(2) and related     │
2098           │                │ calls)                     │
2099           ├────────────────┼────────────────────────────┤
2100           │@memlock        │ Locking of memory in RAM   │
2101           │                │ (mlock(2), mlockall(2) and │
2102           │                │ related calls)             │
2103           ├────────────────┼────────────────────────────┤
2104           │@module         │ Loading and unloading of   │
2105           │                │ kernel modules             │
2106           │                │ (init_module(2),           │
2107           │                │ delete_module(2) and       │
2108           │                │ related calls)             │
2109           ├────────────────┼────────────────────────────┤
2110           │@mount          │ Mounting and unmounting of │
2111           │                │ file systems (mount(2),    │
2112           │                │ chroot(2), and related     │
2113           │                │ calls)                     │
2114           ├────────────────┼────────────────────────────┤
2115           │@network-io     │ Socket I/O (including      │
2116           │                │ local AF_UNIX): socket(7), │
2117           │                │ unix(7)
2118           ├────────────────┼────────────────────────────┤
2119           │@obsolete       │ Unusual, obsolete or       │
2120           │                │ unimplemented              │
2121           │                │ (create_module(2),         │
2122           │                │ gtty(2), ...)              │
2123           ├────────────────┼────────────────────────────┤
2124           │@privileged     │ All system calls which     │
2125           │                │ need super-user            │
2126           │                │ capabilities               │
2127           │                │ (capabilities(7))          │
2128           ├────────────────┼────────────────────────────┤
2129           │@process        │ Process control,           │
2130           │                │ execution, namespacing     │
2131           │                │ operations (clone(2),      │
2132           │                │ kill(2), namespaces(7),    │
2133           │                │ ...)                       │
2134           ├────────────────┼────────────────────────────┤
2135           │@raw-io         │ Raw I/O port access        │
2136           │                │ (ioperm(2), iopl(2),       │
2137           │                │ pciconfig_read(), ...)     │
2138           ├────────────────┼────────────────────────────┤
2139           │@reboot         │ System calls for rebooting │
2140           │                │ and reboot preparation     │
2141           │                │ (reboot(2), kexec(), ...)  │
2142           ├────────────────┼────────────────────────────┤
2143           │@resources      │ System calls for changing  │
2144           │                │ resource limits, memory    │
2145           │                │ and scheduling parameters  │
2146           │                │ (setrlimit(2),             │
2147           │                │ setpriority(2), ...)       │
2148           ├────────────────┼────────────────────────────┤
2149           │@setuid         │ System calls for changing  │
2150           │                │ user ID and group ID       │
2151           │                │ credentials, (setuid(2),   │
2152           │                │ setgid(2), setresuid(2),   │
2153           │                │ ...)                       │
2154           ├────────────────┼────────────────────────────┤
2155           │@signal         │ System calls for           │
2156           │                │ manipulating and handling  │
2157           │                │ process signals            │
2158           │                │ (signal(2),                │
2159           │                │ sigprocmask(2), ...)       │
2160           ├────────────────┼────────────────────────────┤
2161           │@swap           │ System calls for           │
2162           │                │ enabling/disabling swap    │
2163           │                │ devices (swapon(2),        │
2164           │                │ swapoff(2))                │
2165           ├────────────────┼────────────────────────────┤
2166           │@sync           │ Synchronizing files and    │
2167           │                │ memory to disk (fsync(2),  │
2168           │                │ msync(2), and related      │
2169           │                │ calls)                     │
2170           ├────────────────┼────────────────────────────┤
2171           │@system-service │ A reasonable set of system │
2172           │                │ calls used by common       │
2173           │                │ system services, excluding │
2174           │                │ any special purpose calls. │
2175           │                │ This is the recommended    │
2176           │                │ starting point for         │
2177           │                │ allow-listing system calls │
2178           │                │ for system services, as it │
2179           │                │ contains what is typically │
2180           │                │ needed by system services, │
2181           │                │ but excludes overly        │
2182           │                │ specific interfaces. For   │
2183           │                │ example, the following     │
2184           │                │ APIs are excluded:         │
2185           │                │ "@clock", "@mount",        │
2186           │                │ "@swap", "@reboot".        │
2187           ├────────────────┼────────────────────────────┤
2188           │@timer          │ System calls for           │
2189           │                │ scheduling operations by   │
2190           │                │ time (alarm(2),            │
2191           │                │ timer_create(2), ...)      │
2192           ├────────────────┼────────────────────────────┤
2193           │@known          │ All system calls defined   │
2194           │                │ by the kernel. This list   │
2195           │                │ is defined statically in   │
2196           │                │ systemd based on a kernel  │
2197           │                │ version that was available │
2198           │                │ when this systemd version  │
2199           │                │ was released. It will      │
2200           │                │ become progressively more  │
2201           │                │ out-of-date as the kernel  │
2202           │                │ is updated.                │
2203           └────────────────┴────────────────────────────┘
2204           Note, that as new system calls are added to the kernel, additional
2205           system calls might be added to the groups above. Contents of the
2206           sets may also change between systemd versions. In addition, the
2207           list of system calls depends on the kernel version and architecture
2208           for which systemd was compiled. Use systemd-analyze syscall-filter
2209           to list the actual list of system calls in each filter.
2210
2211           Generally, allow-listing system calls (rather than deny-listing) is
2212           the safer mode of operation. It is recommended to enforce system
2213           call allow lists for all long-running system services.
2214           Specifically, the following lines are a relatively safe basic
2215           choice for the majority of system services:
2216
2217               [Service]
2218               SystemCallFilter=@system-service
2219               SystemCallErrorNumber=EPERM
2220
2221           Note that various kernel system calls are defined redundantly:
2222           there are multiple system calls for executing the same operation.
2223           For example, the pidfd_send_signal() system call may be used to
2224           execute operations similar to what can be done with the older
2225           kill() system call, hence blocking the latter without the former
2226           only provides weak protection. Since new system calls are added
2227           regularly to the kernel as development progresses, keeping system
2228           call deny lists comprehensive requires constant work. It is thus
2229           recommended to use allow-listing instead, which offers the benefit
2230           that new system calls are by default implicitly blocked until the
2231           allow list is updated.
2232
2233           Also note that a number of system calls are required to be
2234           accessible for the dynamic linker to work. The dynamic linker is
2235           required for running most regular programs (specifically: all
2236           dynamic ELF binaries, which is how most distributions build
2237           packaged programs). This means that blocking these system calls
2238           (which include open(), openat() or mmap()) will make most programs
2239           typically shipped with generic distributions unusable.
2240
2241           It is recommended to combine the file system namespacing related
2242           options with SystemCallFilter=~@mount, in order to prohibit the
2243           unit's processes to undo the mappings. Specifically these are the
2244           options PrivateTmp=, PrivateDevices=, ProtectSystem=, ProtectHome=,
2245           ProtectKernelTunables=, ProtectControlGroups=, ProtectKernelLogs=,
2246           ProtectClock=, ReadOnlyPaths=, InaccessiblePaths= and
2247           ReadWritePaths=.
2248
2249       SystemCallErrorNumber=
2250           Takes an "errno" error number (between 1 and 4095) or errno name
2251           such as EPERM, EACCES or EUCLEAN, to return when the system call
2252           filter configured with SystemCallFilter= is triggered, instead of
2253           terminating the process immediately. See errno(3) for a full list
2254           of error codes. When this setting is not used, or when the empty
2255           string or the special setting "kill" is assigned, the process will
2256           be terminated immediately when the filter is triggered.
2257
2258       SystemCallArchitectures=
2259           Takes a space-separated list of architecture identifiers to include
2260           in the system call filter. The known architecture identifiers are
2261           the same as for ConditionArchitecture= described in
2262           systemd.unit(5), as well as x32, mips64-n32, mips64-le-n32, and the
2263           special identifier native. The special identifier native implicitly
2264           maps to the native architecture of the system (or more precisely:
2265           to the architecture the system manager is compiled for). If running
2266           in user mode, or in system mode, but without the CAP_SYS_ADMIN
2267           capability (e.g. setting User=), NoNewPrivileges=yes is implied. By
2268           default, this option is set to the empty list, i.e. no filtering is
2269           applied.
2270
2271           If this setting is used, processes of this unit will only be
2272           permitted to call native system calls, and system calls of the
2273           specified architectures. For the purposes of this option, the x32
2274           architecture is treated as including x86-64 system calls. However,
2275           this setting still fulfills its purpose, as explained below, on
2276           x32.
2277
2278           System call filtering is not equally effective on all
2279           architectures. For example, on x86 filtering of network
2280           socket-related calls is not possible, due to ABI limitations — a
2281           limitation that x86-64 does not have, however. On systems
2282           supporting multiple ABIs at the same time — such as x86/x86-64 — it
2283           is hence recommended to limit the set of permitted system call
2284           architectures so that secondary ABIs may not be used to circumvent
2285           the restrictions applied to the native ABI of the system. In
2286           particular, setting SystemCallArchitectures=native is a good choice
2287           for disabling non-native ABIs.
2288
2289           System call architectures may also be restricted system-wide via
2290           the SystemCallArchitectures= option in the global configuration.
2291           See systemd-system.conf(5) for details.
2292
2293       SystemCallLog=
2294           Takes a space-separated list of system call names. If this setting
2295           is used, all system calls executed by the unit processes for the
2296           listed ones will be logged. If the first character of the list is
2297           "~", the effect is inverted: all system calls except the listed
2298           system calls will be logged. If running in user mode, or in system
2299           mode, but without the CAP_SYS_ADMIN capability (e.g. setting
2300           User=), NoNewPrivileges=yes is implied. This feature makes use of
2301           the Secure Computing Mode 2 interfaces of the kernel ('seccomp
2302           filtering') and is useful for auditing or setting up a minimal
2303           sandboxing environment. This option may be specified more than
2304           once, in which case the filter masks are merged. If the empty
2305           string is assigned, the filter is reset, all prior assignments will
2306           have no effect. This does not affect commands prefixed with "+".
2307

ENVIRONMENT

2309       Environment=
2310           Sets environment variables for executed processes. Each line is
2311           unquoted using the rules described in "Quoting" section in
2312           systemd.syntax(7) and becomes a list of variable assignments. If
2313           you need to assign a value containing spaces or the equals sign to
2314           a variable, put quotes around the whole assignment. Variable
2315           expansion is not performed inside the strings and the "$" character
2316           has no special meaning. Specifier expansion is performed, see the
2317           "Specifiers" section in systemd.unit(5).
2318
2319           This option may be specified more than once, in which case all
2320           listed variables will be set. If the same variable is listed twice,
2321           the later setting will override the earlier setting. If the empty
2322           string is assigned to this option, the list of environment
2323           variables is reset, all prior assignments have no effect.
2324
2325           The names of the variables can contain ASCII letters, digits, and
2326           the underscore character. Variable names cannot be empty or start
2327           with a digit. In variable values, most characters are allowed, but
2328           non-printable characters are currently rejected.
2329
2330           Example:
2331
2332               Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
2333
2334           gives three variables "VAR1", "VAR2", "VAR3" with the values "word1
2335           word2", "word3", "$word 5 6".
2336
2337           See environ(7) for details about environment variables.
2338
2339           Note that environment variables are not suitable for passing
2340           secrets (such as passwords, key material, ...) to service
2341           processes. Environment variables set for a unit are exposed to
2342           unprivileged clients via D-Bus IPC, and generally not understood as
2343           being data that requires protection. Moreover, environment
2344           variables are propagated down the process tree, including across
2345           security boundaries (such as setuid/setgid executables), and hence
2346           might leak to processes that should not have access to the secret
2347           data. Use LoadCredential=, LoadCredentialEncrypted= or
2348           SetCredentialEncrypted= (see below) to pass data to unit processes
2349           securely.
2350
2351       EnvironmentFile=
2352           Similar to Environment= but reads the environment variables from a
2353           text file. The text file should contain new-line-separated variable
2354           assignments. Empty lines, lines without an "=" separator, or lines
2355           starting with ; or # will be ignored, which may be used for
2356           commenting. A line ending with a backslash will be concatenated
2357           with the following one, allowing multiline variable definitions.
2358           The parser strips leading and trailing whitespace from the values
2359           of assignments, unless you use double quotes (").
2360
2361           C escapes[7] are supported, but not most control characters[8].
2362           "\t" and "\n" can be used to insert tabs and newlines within
2363           EnvironmentFile=.
2364
2365           The argument passed should be an absolute filename or wildcard
2366           expression, optionally prefixed with "-", which indicates that if
2367           the file does not exist, it will not be read and no error or
2368           warning message is logged. This option may be specified more than
2369           once in which case all specified files are read. If the empty
2370           string is assigned to this option, the list of file to read is
2371           reset, all prior assignments have no effect.
2372
2373           The files listed with this directive will be read shortly before
2374           the process is executed (more specifically, after all processes
2375           from a previous unit state terminated. This means you can generate
2376           these files in one unit state, and read it with this option in the
2377           next. The files are read from the file system of the service
2378           manager, before any file system changes like bind mounts take
2379           place).
2380
2381           Settings from these files override settings made with Environment=.
2382           If the same variable is set twice from these files, the files will
2383           be read in the order they are specified and the later setting will
2384           override the earlier setting.
2385
2386       PassEnvironment=
2387           Pass environment variables set for the system service manager to
2388           executed processes. Takes a space-separated list of variable names.
2389           This option may be specified more than once, in which case all
2390           listed variables will be passed. If the empty string is assigned to
2391           this option, the list of environment variables to pass is reset,
2392           all prior assignments have no effect. Variables specified that are
2393           not set for the system manager will not be passed and will be
2394           silently ignored. Note that this option is only relevant for the
2395           system service manager, as system services by default do not
2396           automatically inherit any environment variables set for the service
2397           manager itself. However, in case of the user service manager all
2398           environment variables are passed to the executed processes anyway,
2399           hence this option is without effect for the user service manager.
2400
2401           Variables set for invoked processes due to this setting are subject
2402           to being overridden by those configured with Environment= or
2403           EnvironmentFile=.
2404
2405           C escapes[7] are supported, but not most control characters[8].
2406           "\t" and "\n" can be used to insert tabs and newlines within
2407           EnvironmentFile=.
2408
2409           Example:
2410
2411               PassEnvironment=VAR1 VAR2 VAR3
2412
2413           passes three variables "VAR1", "VAR2", "VAR3" with the values set
2414           for those variables in PID1.
2415
2416           See environ(7) for details about environment variables.
2417
2418       UnsetEnvironment=
2419           Explicitly unset environment variable assignments that would
2420           normally be passed from the service manager to invoked processes of
2421           this unit. Takes a space-separated list of variable names or
2422           variable assignments. This option may be specified more than once,
2423           in which case all listed variables/assignments will be unset. If
2424           the empty string is assigned to this option, the list of
2425           environment variables/assignments to unset is reset. If a variable
2426           assignment is specified (that is: a variable name, followed by "=",
2427           followed by its value), then any environment variable matching this
2428           precise assignment is removed. If a variable name is specified
2429           (that is a variable name without any following "=" or value), then
2430           any assignment matching the variable name, regardless of its value
2431           is removed. Note that the effect of UnsetEnvironment= is applied as
2432           final step when the environment list passed to executed processes
2433           is compiled. That means it may undo assignments from any
2434           configuration source, including assignments made through
2435           Environment= or EnvironmentFile=, inherited from the system
2436           manager's global set of environment variables, inherited via
2437           PassEnvironment=, set by the service manager itself (such as
2438           $NOTIFY_SOCKET and such), or set by a PAM module (in case PAMName=
2439           is used).
2440
2441           See "Environment Variables in Spawned Processes" below for a
2442           description of how those settings combine to form the inherited
2443           environment. See environ(7) for general information about
2444           environment variables.
2445

LOGGING AND STANDARD INPUT/OUTPUT

2447       StandardInput=
2448           Controls where file descriptor 0 (STDIN) of the executed processes
2449           is connected to. Takes one of null, tty, tty-force, tty-fail, data,
2450           file:path, socket or fd:name.
2451
2452           If null is selected, standard input will be connected to /dev/null,
2453           i.e. all read attempts by the process will result in immediate EOF.
2454
2455           If tty is selected, standard input is connected to a TTY (as
2456           configured by TTYPath=, see below) and the executed process becomes
2457           the controlling process of the terminal. If the terminal is already
2458           being controlled by another process, the executed process waits
2459           until the current controlling process releases the terminal.
2460
2461           tty-force is similar to tty, but the executed process is forcefully
2462           and immediately made the controlling process of the terminal,
2463           potentially removing previous controlling processes from the
2464           terminal.
2465
2466           tty-fail is similar to tty, but if the terminal already has a
2467           controlling process start-up of the executed process fails.
2468
2469           The data option may be used to configure arbitrary textual or
2470           binary data to pass via standard input to the executed process. The
2471           data to pass is configured via
2472           StandardInputText=/StandardInputData= (see below). Note that the
2473           actual file descriptor type passed (memory file, regular file, UNIX
2474           pipe, ...) might depend on the kernel and available privileges. In
2475           any case, the file descriptor is read-only, and when read returns
2476           the specified data followed by EOF.
2477
2478           The file:path option may be used to connect a specific file system
2479           object to standard input. An absolute path following the ":"
2480           character is expected, which may refer to a regular file, a FIFO or
2481           special file. If an AF_UNIX socket in the file system is specified,
2482           a stream socket is connected to it. The latter is useful for
2483           connecting standard input of processes to arbitrary system
2484           services.
2485
2486           The socket option is valid in socket-activated services only, and
2487           requires the relevant socket unit file (see systemd.socket(5) for
2488           details) to have Accept=yes set, or to specify a single socket
2489           only. If this option is set, standard input will be connected to
2490           the socket the service was activated from, which is primarily
2491           useful for compatibility with daemons designed for use with the
2492           traditional inetd(8) socket activation daemon.
2493
2494           The fd:name option connects standard input to a specific, named
2495           file descriptor provided by a socket unit. The name may be
2496           specified as part of this option, following a ":" character (e.g.
2497           "fd:foobar"). If no name is specified, the name "stdin" is implied
2498           (i.e.  "fd" is equivalent to "fd:stdin"). At least one socket unit
2499           defining the specified name must be provided via the Sockets=
2500           option, and the file descriptor name may differ from the name of
2501           its containing socket unit. If multiple matches are found, the
2502           first one will be used. See FileDescriptorName= in
2503           systemd.socket(5) for more details about named file descriptors and
2504           their ordering.
2505
2506           This setting defaults to null, unless
2507           StandardInputText=/StandardInputData= are set, in which case it
2508           defaults to data.
2509
2510       StandardOutput=
2511           Controls where file descriptor 1 (stdout) of the executed processes
2512           is connected to. Takes one of inherit, null, tty, journal, kmsg,
2513           journal+console, kmsg+console, file:path, append:path,
2514           truncate:path, socket or fd:name.
2515
2516           inherit duplicates the file descriptor of standard input for
2517           standard output.
2518
2519           null connects standard output to /dev/null, i.e. everything written
2520           to it will be lost.
2521
2522           tty connects standard output to a tty (as configured via TTYPath=,
2523           see below). If the TTY is used for output only, the executed
2524           process will not become the controlling process of the terminal,
2525           and will not fail or wait for other processes to release the
2526           terminal.
2527
2528           journal connects standard output with the journal, which is
2529           accessible via journalctl(1). Note that everything that is written
2530           to kmsg (see below) is implicitly stored in the journal as well,
2531           the specific option listed below is hence a superset of this one.
2532           (Also note that any external, additional syslog daemons receive
2533           their log data from the journal, too, hence this is the option to
2534           use when logging shall be processed with such a daemon.)
2535
2536           kmsg connects standard output with the kernel log buffer which is
2537           accessible via dmesg(1), in addition to the journal. The journal
2538           daemon might be configured to send all logs to kmsg anyway, in
2539           which case this option is no different from journal.
2540
2541           journal+console and kmsg+console work in a similar way as the two
2542           options above but copy the output to the system console as well.
2543
2544           The file:path option may be used to connect a specific file system
2545           object to standard output. The semantics are similar to the same
2546           option of StandardInput=, see above. If path refers to a regular
2547           file on the filesystem, it is opened (created if it doesn't exist
2548           yet) for writing at the beginning of the file, but without
2549           truncating it. If standard input and output are directed to the
2550           same file path, it is opened only once, for reading as well as
2551           writing and duplicated. This is particularly useful when the
2552           specified path refers to an AF_UNIX socket in the file system, as
2553           in that case only a single stream connection is created for both
2554           input and output.
2555
2556           append:path is similar to file:path above, but it opens the file in
2557           append mode.
2558
2559           truncate:path is similar to file:path above, but it truncates the
2560           file when opening it. For units with multiple command lines, e.g.
2561           Type=oneshot services with multiple ExecStart=, or services with
2562           ExecCondition=, ExecStartPre= or ExecStartPost=, the output file is
2563           reopened and therefore re-truncated for each command line. If the
2564           output file is truncated while another process still has the file
2565           open, e.g. by an ExecReload= running concurrently with an
2566           ExecStart=, and the other process continues writing to the file
2567           without adjusting its offset, then the space between the file
2568           pointers of the two processes may be filled with NUL bytes,
2569           producing a sparse file. Thus, truncate:path is typically only
2570           useful for units where only one process runs at a time, such as
2571           services with a single ExecStart= and no ExecStartPost=,
2572           ExecReload=, ExecStop= or similar.
2573
2574           socket connects standard output to a socket acquired via socket
2575           activation. The semantics are similar to the same option of
2576           StandardInput=, see above.
2577
2578           The fd:name option connects standard output to a specific, named
2579           file descriptor provided by a socket unit. A name may be specified
2580           as part of this option, following a ":" character (e.g.
2581           "fd:foobar"). If no name is specified, the name "stdout" is implied
2582           (i.e.  "fd" is equivalent to "fd:stdout"). At least one socket unit
2583           defining the specified name must be provided via the Sockets=
2584           option, and the file descriptor name may differ from the name of
2585           its containing socket unit. If multiple matches are found, the
2586           first one will be used. See FileDescriptorName= in
2587           systemd.socket(5) for more details about named descriptors and
2588           their ordering.
2589
2590           If the standard output (or error output, see below) of a unit is
2591           connected to the journal or the kernel log buffer, the unit will
2592           implicitly gain a dependency of type After= on
2593           systemd-journald.socket (also see the "Implicit Dependencies"
2594           section above). Also note that in this case stdout (or stderr, see
2595           below) will be an AF_UNIX stream socket, and not a pipe or FIFO
2596           that can be re-opened. This means when executing shell scripts the
2597           construct echo "hello" > /dev/stderr for writing text to stderr
2598           will not work. To mitigate this use the construct echo "hello" >&2
2599           instead, which is mostly equivalent and avoids this pitfall.
2600
2601           This setting defaults to the value set with DefaultStandardOutput=
2602           in systemd-system.conf(5), which defaults to journal. Note that
2603           setting this parameter might result in additional dependencies to
2604           be added to the unit (see above).
2605
2606       StandardError=
2607           Controls where file descriptor 2 (stderr) of the executed processes
2608           is connected to. The available options are identical to those of
2609           StandardOutput=, with some exceptions: if set to inherit the file
2610           descriptor used for standard output is duplicated for standard
2611           error, while fd:name will use a default file descriptor name of
2612           "stderr".
2613
2614           This setting defaults to the value set with DefaultStandardError=
2615           in systemd-system.conf(5), which defaults to inherit. Note that
2616           setting this parameter might result in additional dependencies to
2617           be added to the unit (see above).
2618
2619       StandardInputText=, StandardInputData=
2620           Configures arbitrary textual or binary data to pass via file
2621           descriptor 0 (STDIN) to the executed processes. These settings have
2622           no effect unless StandardInput= is set to data (which is the
2623           default if StandardInput= is not set otherwise, but
2624           StandardInputText=/StandardInputData= is). Use this option to embed
2625           process input data directly in the unit file.
2626
2627           StandardInputText= accepts arbitrary textual data. C-style escapes
2628           for special characters as well as the usual "%"-specifiers are
2629           resolved. Each time this setting is used the specified text is
2630           appended to the per-unit data buffer, followed by a newline
2631           character (thus every use appends a new line to the end of the
2632           buffer). Note that leading and trailing whitespace of lines
2633           configured with this option is removed. If an empty line is
2634           specified the buffer is cleared (hence, in order to insert an empty
2635           line, add an additional "\n" to the end or beginning of a line).
2636
2637           StandardInputData= accepts arbitrary binary data, encoded in
2638           Base64[9]. No escape sequences or specifiers are resolved. Any
2639           whitespace in the encoded version is ignored during decoding.
2640
2641           Note that StandardInputText= and StandardInputData= operate on the
2642           same data buffer, and may be mixed in order to configure both
2643           binary and textual data for the same input stream. The textual or
2644           binary data is joined strictly in the order the settings appear in
2645           the unit file. Assigning an empty string to either will reset the
2646           data buffer.
2647
2648           Please keep in mind that in order to maintain readability long unit
2649           file settings may be split into multiple lines, by suffixing each
2650           line (except for the last) with a "\" character (see
2651           systemd.unit(5) for details). This is particularly useful for large
2652           data configured with these two options. Example:
2653
2654               ...
2655               StandardInput=data
2656               StandardInputData=SWNrIHNpdHplIGRhIHVuJyBlc3NlIEtsb3BzLAp1ZmYgZWVtYWwga2xvcHAncy4KSWNrIGtpZWtl \
2657                                 LCBzdGF1bmUsIHd1bmRyZSBtaXIsCnVmZiBlZW1hbCBqZWh0IHNlIHVmZiBkaWUgVMO8ci4KTmFu \
2658                                 dSwgZGVuayBpY2ssIGljayBkZW5rIG5hbnUhCkpldHogaXNzZSB1ZmYsIGVyc2NodCB3YXIgc2Ug \
2659                                 enUhCkljayBqZWhlIHJhdXMgdW5kIGJsaWNrZSDigJQKdW5kIHdlciBzdGVodCBkcmF1w59lbj8g \
2660                                 SWNrZSEK
2661               ...
2662
2663       LogLevelMax=
2664           Configures filtering by log level of log messages generated by this
2665           unit. Takes a syslog log level, one of emerg (lowest log level,
2666           only highest priority messages), alert, crit, err, warning, notice,
2667           info, debug (highest log level, also lowest priority messages). See
2668           syslog(3) for details. By default no filtering is applied (i.e. the
2669           default maximum log level is debug). Use this option to configure
2670           the logging system to drop log messages of a specific service above
2671           the specified level. For example, set LogLevelMax=info in order to
2672           turn off debug logging of a particularly chatty unit. Note that the
2673           configured level is applied to any log messages written by any of
2674           the processes belonging to this unit, as well as any log messages
2675           written by the system manager process (PID 1) in reference to this
2676           unit, sent via any supported logging protocol. The filtering is
2677           applied early in the logging pipeline, before any kind of further
2678           processing is done. Moreover, messages which pass through this
2679           filter successfully might still be dropped by filters applied at a
2680           later stage in the logging subsystem. For example, MaxLevelStore=
2681           configured in journald.conf(5) might prohibit messages of higher
2682           log levels to be stored on disk, even though the per-unit
2683           LogLevelMax= permitted it to be processed.
2684
2685       LogExtraFields=
2686           Configures additional log metadata fields to include in all log
2687           records generated by processes associated with this unit. This
2688           setting takes one or more journal field assignments in the format
2689           "FIELD=VALUE" separated by whitespace. See systemd.journal-
2690           fields(7) for details on the journal field concept. Even though the
2691           underlying journal implementation permits binary field values, this
2692           setting accepts only valid UTF-8 values. To include space
2693           characters in a journal field value, enclose the assignment in
2694           double quotes (").  The usual specifiers are expanded in all
2695           assignments (see below). Note that this setting is not only useful
2696           for attaching additional metadata to log records of a unit, but
2697           given that all fields and values are indexed may also be used to
2698           implement cross-unit log record matching. Assign an empty string to
2699           reset the list.
2700
2701       LogRateLimitIntervalSec=, LogRateLimitBurst=
2702           Configures the rate limiting that is applied to messages generated
2703           by this unit. If, in the time interval defined by
2704           LogRateLimitIntervalSec=, more messages than specified in
2705           LogRateLimitBurst= are logged by a service, all further messages
2706           within the interval are dropped until the interval is over. A
2707           message about the number of dropped messages is generated. The time
2708           specification for LogRateLimitIntervalSec= may be specified in the
2709           following units: "s", "min", "h", "ms", "us" (see systemd.time(7)
2710           for details). The default settings are set by RateLimitIntervalSec=
2711           and RateLimitBurst= configured in journald.conf(5).
2712
2713       LogNamespace=
2714           Run the unit's processes in the specified journal namespace.
2715           Expects a short user-defined string identifying the namespace. If
2716           not used the processes of the service are run in the default
2717           journal namespace, i.e. their log stream is collected and processed
2718           by systemd-journald.service. If this option is used any log data
2719           generated by processes of this unit (regardless if via the
2720           syslog(), journal native logging or stdout/stderr logging) is
2721           collected and processed by an instance of the
2722           systemd-journald@.service template unit, which manages the
2723           specified namespace. The log data is stored in a data store
2724           independent from the default log namespace's data store. See
2725           systemd-journald.service(8) for details about journal namespaces.
2726
2727           Internally, journal namespaces are implemented through Linux mount
2728           namespacing and over-mounting the directory that contains the
2729           relevant AF_UNIX sockets used for logging in the unit's mount
2730           namespace. Since mount namespaces are used this setting disconnects
2731           propagation of mounts from the unit's processes to the host,
2732           similar to how ReadOnlyPaths= and similar settings (see above)
2733           work. Journal namespaces may hence not be used for services that
2734           need to establish mount points on the host.
2735
2736           When this option is used the unit will automatically gain ordering
2737           and requirement dependencies on the two socket units associated
2738           with the systemd-journald@.service instance so that they are
2739           automatically established prior to the unit starting up. Note that
2740           when this option is used log output of this service does not appear
2741           in the regular journalctl(1) output, unless the --namespace= option
2742           is used.
2743
2744           This option is only available for system services and is not
2745           supported for services running in per-user instances of the service
2746           manager.
2747
2748       SyslogIdentifier=
2749           Sets the process name ("syslog tag") to prefix log lines sent to
2750           the logging system or the kernel log buffer with. If not set,
2751           defaults to the process name of the executed process. This option
2752           is only useful when StandardOutput= or StandardError= are set to
2753           journal or kmsg (or to the same settings in combination with
2754           +console) and only applies to log messages written to stdout or
2755           stderr.
2756
2757       SyslogFacility=
2758           Sets the syslog facility identifier to use when logging. One of
2759           kern, user, mail, daemon, auth, syslog, lpr, news, uucp, cron,
2760           authpriv, ftp, local0, local1, local2, local3, local4, local5,
2761           local6 or local7. See syslog(3) for details. This option is only
2762           useful when StandardOutput= or StandardError= are set to journal or
2763           kmsg (or to the same settings in combination with +console), and
2764           only applies to log messages written to stdout or stderr. Defaults
2765           to daemon.
2766
2767       SyslogLevel=
2768           The default syslog log level to use when logging to the logging
2769           system or the kernel log buffer. One of emerg, alert, crit, err,
2770           warning, notice, info, debug. See syslog(3) for details. This
2771           option is only useful when StandardOutput= or StandardError= are
2772           set to journal or kmsg (or to the same settings in combination with
2773           +console), and only applies to log messages written to stdout or
2774           stderr. Note that individual lines output by executed processes may
2775           be prefixed with a different log level which can be used to
2776           override the default log level specified here. The interpretation
2777           of these prefixes may be disabled with SyslogLevelPrefix=, see
2778           below. For details, see sd-daemon(3). Defaults to info.
2779
2780       SyslogLevelPrefix=
2781           Takes a boolean argument. If true and StandardOutput= or
2782           StandardError= are set to journal or kmsg (or to the same settings
2783           in combination with +console), log lines written by the executed
2784           process that are prefixed with a log level will be processed with
2785           this log level set but the prefix removed. If set to false, the
2786           interpretation of these prefixes is disabled and the logged lines
2787           are passed on as-is. This only applies to log messages written to
2788           stdout or stderr. For details about this prefixing see sd-
2789           daemon(3). Defaults to true.
2790
2791       TTYPath=
2792           Sets the terminal device node to use if standard input, output, or
2793           error are connected to a TTY (see above). Defaults to /dev/console.
2794
2795       TTYReset=
2796           Reset the terminal device specified with TTYPath= before and after
2797           execution. Defaults to "no".
2798
2799       TTYVHangup=
2800           Disconnect all clients which have opened the terminal device
2801           specified with TTYPath= before and after execution. Defaults to
2802           "no".
2803
2804       TTYRows=, TTYColumns=
2805           Configure the size of the TTY specified with TTYPath=. If unset or
2806           set to the empty string, the kernel default is used.
2807
2808       TTYVTDisallocate=
2809           If the terminal device specified with TTYPath= is a virtual console
2810           terminal, try to deallocate the TTY before and after execution.
2811           This ensures that the screen and scrollback buffer is cleared.
2812           Defaults to "no".
2813

CREDENTIALS

2815       LoadCredential=ID[:PATH], LoadCredentialEncrypted=ID[:PATH]
2816           Pass a credential to the unit. Credentials are limited-size binary
2817           or textual objects that may be passed to unit processes. They are
2818           primarily used for passing cryptographic keys (both public and
2819           private) or certificates, user account information or identity
2820           information from host to services. The data is accessible from the
2821           unit's processes via the file system, at a read-only location that
2822           (if possible and permitted) is backed by non-swappable memory. The
2823           data is only accessible to the user associated with the unit, via
2824           the User=/DynamicUser= settings (as well as the superuser). When
2825           available, the location of credentials is exported as the
2826           $CREDENTIALS_DIRECTORY environment variable to the unit's
2827           processes.
2828
2829           The LoadCredential= setting takes a textual ID to use as name for a
2830           credential plus a file system path, separated by a colon. The ID
2831           must be a short ASCII string suitable as filename in the
2832           filesystem, and may be chosen freely by the user. If the specified
2833           path is absolute it is opened as regular file and the credential
2834           data is read from it. If the absolute path refers to an AF_UNIX
2835           stream socket in the file system a connection is made to it (only
2836           once at unit start-up) and the credential data read from the
2837           connection, providing an easy IPC integration point for dynamically
2838           providing credentials from other services. If the specified path is
2839           not absolute and itself qualifies as valid credential identifier it
2840           is understood to refer to a credential that the service manager
2841           itself received via the $CREDENTIALS_DIRECTORY environment
2842           variable, which may be used to propagate credentials from an
2843           invoking environment (e.g. a container manager that invoked the
2844           service manager) into a service. The contents of the file/socket
2845           may be arbitrary binary or textual data, including newline
2846           characters and NUL bytes. If the file system path is omitted it is
2847           chosen identical to the credential name, i.e. this is a terse way
2848           do declare credentials to inherit from the service manager into a
2849           service. This option may be used multiple times, each time defining
2850           an additional credential to pass to the unit.
2851
2852           The LoadCredentialEncrypted= setting is identical to
2853           LoadCredential=, except that the credential data is decrypted
2854           before being passed on to the executed processes. Specifically, the
2855           referenced path should refer to a file or socket with an encrypted
2856           credential, as implemented by systemd-creds(1). This credential is
2857           loaded, decrypted and then passed to the application in decrypted
2858           plaintext form, in the same way a regular credential specified via
2859           LoadCredential= would be. A credential configured this way may
2860           encrypted with a secret key derived from the system's TPM2 security
2861           chip, or with a secret key stored in
2862           /var/lib/systemd/credentials.secret, or with both. Using encrypted
2863           credentials improves security as credentials are not stored in
2864           plaintext and only decrypted into plaintext the moment a service
2865           requiring them is started. Moreover, credentials may be bound to
2866           the local hardware and installations, so that they cannot easily be
2867           analyzed offline.
2868
2869           The credential files/IPC sockets must be accessible to the service
2870           manager, but don't have to be directly accessible to the unit's
2871           processes: the credential data is read and copied into separate,
2872           read-only copies for the unit that are accessible to appropriately
2873           privileged processes. This is particularly useful in combination
2874           with DynamicUser= as this way privileged data can be made available
2875           to processes running under a dynamic UID (i.e. not a previously
2876           known one) without having to open up access to all users.
2877
2878           In order to reference the path a credential may be read from within
2879           a ExecStart= command line use "${CREDENTIALS_DIRECTORY}/mycred",
2880           e.g.  "ExecStart=cat ${CREDENTIALS_DIRECTORY}/mycred".
2881
2882           Currently, an accumulated credential size limit of 1 MB per unit is
2883           enforced.
2884
2885           If referencing an AF_UNIX stream socket to connect to, the
2886           connection will originate from an abstract namespace socket, that
2887           includes information about the unit and the credential ID in its
2888           socket name. Use getpeername(2) to query this information. The
2889           returned socket name is formatted as NUL RANDOM "/unit/" UNIT "/"
2890           ID, i.e. a NUL byte (as required for abstract namespace socket
2891           names), followed by a random string (consisting of alphadecimal
2892           characters), followed by the literal string "/unit/", followed by
2893           the requesting unit name, followed by the literal character "/",
2894           followed by the textual credential ID requested. Example:
2895           "\0adf9d86b6eda275e/unit/foobar.service/credx" in case the
2896           credential "credx" is requested for a unit "foobar.service". This
2897           functionality is useful for using a single listening socket to
2898           serve credentials to multiple consumers.
2899
2900       SetCredential=ID:VALUE, SetCredentialEncrypted=ID:VALUE
2901           The SetCredential= setting is similar to LoadCredential= but
2902           accepts a literal value to use as data for the credential, instead
2903           of a file system path to read the data from. Do not use this option
2904           for data that is supposed to be secret, as it is accessible to
2905           unprivileged processes via IPC. It's only safe to use this for user
2906           IDs, public key material and similar non-sensitive data. For
2907           everything else use LoadCredential=. In order to embed binary data
2908           into the credential data use C-style escaping (i.e.  "\n" to embed
2909           a newline, or "\x00" to embed a NUL byte).
2910
2911           The SetCredentialEncrypted= setting is identical to SetCredential=
2912           but expects an encrypted credential in literal form as value. This
2913           allows embedding confidential credentials securely directly in unit
2914           files. Use systemd-creds(1)' -p switch to generate suitable
2915           SetCredentialEncrypted= lines directly from plaintext credentials.
2916           For further details see LoadCredentialEncrypted= above.
2917
2918           If a credential of the same ID is listed in both LoadCredential=
2919           and SetCredential=, the latter will act as default if the former
2920           cannot be retrieved. In this case not being able to retrieve the
2921           credential from the path specified in LoadCredential= is not
2922           considered fatal.
2923

SYSTEM V COMPATIBILITY

2925       UtmpIdentifier=
2926           Takes a four character identifier string for an utmp(5) and wtmp
2927           entry for this service. This should only be set for services such
2928           as getty implementations (such as agetty(8)) where utmp/wtmp
2929           entries must be created and cleared before and after execution, or
2930           for services that shall be executed as if they were run by a getty
2931           process (see below). If the configured string is longer than four
2932           characters, it is truncated and the terminal four characters are
2933           used. This setting interprets %I style string replacements. This
2934           setting is unset by default, i.e. no utmp/wtmp entries are created
2935           or cleaned up for this service.
2936
2937       UtmpMode=
2938           Takes one of "init", "login" or "user". If UtmpIdentifier= is set,
2939           controls which type of utmp(5)/wtmp entries for this service are
2940           generated. This setting has no effect unless UtmpIdentifier= is set
2941           too. If "init" is set, only an INIT_PROCESS entry is generated and
2942           the invoked process must implement a getty-compatible utmp/wtmp
2943           logic. If "login" is set, first an INIT_PROCESS entry, followed by
2944           a LOGIN_PROCESS entry is generated. In this case, the invoked
2945           process must implement a login(1)-compatible utmp/wtmp logic. If
2946           "user" is set, first an INIT_PROCESS entry, then a LOGIN_PROCESS
2947           entry and finally a USER_PROCESS entry is generated. In this case,
2948           the invoked process may be any process that is suitable to be run
2949           as session leader. Defaults to "init".
2950

ENVIRONMENT VARIABLES IN SPAWNED PROCESSES

2952       Processes started by the service manager are executed with an
2953       environment variable block assembled from multiple sources. Processes
2954       started by the system service manager generally do not inherit
2955       environment variables set for the service manager itself (but this may
2956       be altered via PassEnvironment=), but processes started by the user
2957       service manager instances generally do inherit all environment
2958       variables set for the service manager itself.
2959
2960       For each invoked process the list of environment variables set is
2961       compiled from the following sources:
2962
2963       •   Variables globally configured for the service manager, using the
2964           DefaultEnvironment= setting in systemd-system.conf(5), the kernel
2965           command line option systemd.setenv= understood by systemd(1), or
2966           via systemctl(1) set-environment verb.
2967
2968       •   Variables defined by the service manager itself (see the list
2969           below).
2970
2971       •   Variables set in the service manager's own environment variable
2972           block (subject to PassEnvironment= for the system service manager).
2973
2974       •   Variables set via Environment= in the unit file.
2975
2976       •   Variables read from files specified via EnvironmentFile= in the
2977           unit file.
2978
2979       •   Variables set by any PAM modules in case PAMName= is in effect,
2980           cf. pam_env(8).
2981
2982       If the same environment variable is set by multiple of these sources,
2983       the later source — according to the order of the list above — wins.
2984       Note that as the final step all variables listed in UnsetEnvironment=
2985       are removed from the compiled environment variable list, immediately
2986       before it is passed to the executed process.
2987
2988       The general philosophy is to expose a small curated list of environment
2989       variables to processes. Services started by the system manager (PID 1)
2990       will be started, without additional service-specific configuration,
2991       with just a few environment variables. The user manager inherits
2992       environment variables as any other system service, but in addition may
2993       receive additional environment variables from PAM, and, typically,
2994       additional imported variables when the user starts a graphical session.
2995       It is recommended to keep the environment blocks in both the system and
2996       user managers lean. Importing all variables inherited by the graphical
2997       session or by one of the user shells is strongly discouraged.
2998
2999       Hint: systemd-run -P env and systemd-run --user -P env print the
3000       effective system and user service environment blocks.
3001
3002   Environment Variables Set or Propagated by the Service Manager
3003       The following environment variables are propagated by the service
3004       manager or generated internally for each invoked process:
3005
3006       $PATH
3007           Colon-separated list of directories to use when launching
3008           executables.  systemd uses a fixed value of
3009           "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin" in the system
3010           manager. When compiled for systems with "unmerged /usr/" (/bin is
3011           not a symlink to /usr/bin), ":/sbin:/bin" is appended. In case of
3012           the user manager, a different path may be configured by the
3013           distribution. It is recommended to not rely on the order of
3014           entries, and have only one program with a given name in $PATH.
3015
3016       $LANG
3017           Locale. Can be set in locale.conf(5) or on the kernel command line
3018           (see systemd(1) and kernel-command-line(7)).
3019
3020       $USER, $LOGNAME, $HOME, $SHELL
3021           User name (twice), home directory, and the login shell. The
3022           variables are set for the units that have User= set, which includes
3023           user systemd instances. See passwd(5).
3024
3025       $INVOCATION_ID
3026           Contains a randomized, unique 128bit ID identifying each runtime
3027           cycle of the unit, formatted as 32 character hexadecimal string. A
3028           new ID is assigned each time the unit changes from an inactive
3029           state into an activating or active state, and may be used to
3030           identify this specific runtime cycle, in particular in data stored
3031           offline, such as the journal. The same ID is passed to all
3032           processes run as part of the unit.
3033
3034       $XDG_RUNTIME_DIR
3035           The directory to use for runtime objects (such as IPC objects) and
3036           volatile state. Set for all services run by the user systemd
3037           instance, as well as any system services that use PAMName= with a
3038           PAM stack that includes pam_systemd. See below and pam_systemd(8)
3039           for more information.
3040
3041       $RUNTIME_DIRECTORY, $STATE_DIRECTORY, $CACHE_DIRECTORY,
3042       $LOGS_DIRECTORY, $CONFIGURATION_DIRECTORY
3043           Absolute paths to the directories defined with RuntimeDirectory=,
3044           StateDirectory=, CacheDirectory=, LogsDirectory=, and
3045           ConfigurationDirectory= when those settings are used.
3046
3047       $CREDENTIALS_DIRECTORY
3048           An absolute path to the per-unit directory with credentials
3049           configured via LoadCredential=/SetCredential=. The directory is
3050           marked read-only and is placed in unswappable memory (if supported
3051           and permitted), and is only accessible to the UID associated with
3052           the unit via User= or DynamicUser= (and the superuser).
3053
3054       $MAINPID
3055           The PID of the unit's main process if it is known. This is only set
3056           for control processes as invoked by ExecReload= and similar.
3057
3058       $MANAGERPID
3059           The PID of the user systemd instance, set for processes spawned by
3060           it.
3061
3062       $LISTEN_FDS, $LISTEN_PID, $LISTEN_FDNAMES
3063           Information about file descriptors passed to a service for socket
3064           activation. See sd_listen_fds(3).
3065
3066       $NOTIFY_SOCKET
3067           The socket sd_notify() talks to. See sd_notify(3).
3068
3069       $WATCHDOG_PID, $WATCHDOG_USEC
3070           Information about watchdog keep-alive notifications. See
3071           sd_watchdog_enabled(3).
3072
3073       $SYSTEMD_EXEC_PID
3074           The PID of the unit process (e.g. process invoked by ExecStart=).
3075           The child process can use this information to determine whether the
3076           process is directly invoked by the service manager or indirectly as
3077           a child of another process by comparing this value with the current
3078           PID (as similar to the scheme used in sd_listen_fds(3) with
3079           $LISTEN_PID and $LISTEN_FDS).
3080
3081       $TERM
3082           Terminal type, set only for units connected to a terminal
3083           (StandardInput=tty, StandardOutput=tty, or StandardError=tty). See
3084           termcap(5).
3085
3086       $LOG_NAMESPACE
3087           Contains the name of the selected logging namespace when the
3088           LogNamespace= service setting is used.
3089
3090       $JOURNAL_STREAM
3091           If the standard output or standard error output of the executed
3092           processes are connected to the journal (for example, by setting
3093           StandardError=journal) $JOURNAL_STREAM contains the device and
3094           inode numbers of the connection file descriptor, formatted in
3095           decimal, separated by a colon (":"). This permits invoked processes
3096           to safely detect whether their standard output or standard error
3097           output are connected to the journal. The device and inode numbers
3098           of the file descriptors should be compared with the values set in
3099           the environment variable to determine whether the process output is
3100           still connected to the journal. Note that it is generally not
3101           sufficient to only check whether $JOURNAL_STREAM is set at all as
3102           services might invoke external processes replacing their standard
3103           output or standard error output, without unsetting the environment
3104           variable.
3105
3106           If both standard output and standard error of the executed
3107           processes are connected to the journal via a stream socket, this
3108           environment variable will contain information about the standard
3109           error stream, as that's usually the preferred destination for log
3110           data. (Note that typically the same stream is used for both
3111           standard output and standard error, hence very likely the
3112           environment variable contains device and inode information matching
3113           both stream file descriptors.)
3114
3115           This environment variable is primarily useful to allow services to
3116           optionally upgrade their used log protocol to the native journal
3117           protocol (using sd_journal_print(3) and other functions) if their
3118           standard output or standard error output is connected to the
3119           journal anyway, thus enabling delivery of structured metadata along
3120           with logged messages.
3121
3122       $SERVICE_RESULT
3123           Only defined for the service unit type, this environment variable
3124           is passed to all ExecStop= and ExecStopPost= processes, and encodes
3125           the service "result". Currently, the following values are defined:
3126
3127           Table 5. Defined $SERVICE_RESULT values
3128           ┌──────────────────┬────────────────────────────┐
3129Value             Meaning                    
3130           ├──────────────────┼────────────────────────────┤
3131           │"success"         │ The service ran            │
3132           │                  │ successfully and exited    │
3133           │                  │ cleanly.                   │
3134           ├──────────────────┼────────────────────────────┤
3135           │"protocol"        │ A protocol violation       │
3136           │                  │ occurred: the service did  │
3137           │                  │ not take the steps         │
3138           │                  │ required by its unit       │
3139           │                  │ configuration              │
3140           │                  │ (specifically what is      │
3141           │                  │ configured in its Type=
3142           │                  │ setting).                  │
3143           ├──────────────────┼────────────────────────────┤
3144           │"timeout"         │ One of the steps timed     │
3145           │                  │ out.                       │
3146           ├──────────────────┼────────────────────────────┤
3147           │"exit-code"       │ Service process exited     │
3148           │                  │ with a non-zero exit code; │
3149           │                  │ see $EXIT_CODE below for   │
3150           │                  │ the actual exit code       │
3151           │                  │ returned.                  │
3152           ├──────────────────┼────────────────────────────┤
3153           │"signal"          │ A service process was      │
3154           │                  │ terminated abnormally by a │
3155           │                  │ signal, without dumping    │
3156           │                  │ core. See $EXIT_CODE below │
3157           │                  │ for the actual signal      │
3158           │                  │ causing the termination.   │
3159           ├──────────────────┼────────────────────────────┤
3160           │"core-dump"       │ A service process          │
3161           │                  │ terminated abnormally with │
3162           │                  │ a signal and dumped core.  │
3163           │                  │ See $EXIT_CODE below for   │
3164           │                  │ the signal causing the     │
3165           │                  │ termination.               │
3166           ├──────────────────┼────────────────────────────┤
3167           │"watchdog"        │ Watchdog keep-alive ping   │
3168           │                  │ was enabled for the        │
3169           │                  │ service, but the deadline  │
3170           │                  │ was missed.                │
3171           ├──────────────────┼────────────────────────────┤
3172           │"start-limit-hit" │ A start limit was defined  │
3173           │                  │ for the unit and it was    │
3174           │                  │ hit, causing the unit to   │
3175           │                  │ fail to start. See         │
3176           │                  │ systemd.unit(5)'s          │
3177           │                  │ StartLimitIntervalSec= and │
3178           │                  │ StartLimitBurst= for       │
3179           │                  │ details.                   │
3180           ├──────────────────┼────────────────────────────┤
3181           │"resources"       │ A catch-all condition in   │
3182           │                  │ case a system operation    │
3183           │                  │ failed.                    │
3184           └──────────────────┴────────────────────────────┘
3185           This environment variable is useful to monitor failure or
3186           successful termination of a service. Even though this variable is
3187           available in both ExecStop= and ExecStopPost=, it is usually a
3188           better choice to place monitoring tools in the latter, as the
3189           former is only invoked for services that managed to start up
3190           correctly, and the latter covers both services that failed during
3191           their start-up and those which failed during their runtime.
3192
3193       $EXIT_CODE, $EXIT_STATUS
3194           Only defined for the service unit type, these environment variables
3195           are passed to all ExecStop=, ExecStopPost= processes and contain
3196           exit status/code information of the main process of the service.
3197           For the precise definition of the exit code and status, see
3198           wait(2).  $EXIT_CODE is one of "exited", "killed", "dumped".
3199           $EXIT_STATUS contains the numeric exit code formatted as string if
3200           $EXIT_CODE is "exited", and the signal name in all other cases.
3201           Note that these environment variables are only set if the service
3202           manager succeeded to start and identify the main process of the
3203           service.
3204
3205           Table 6. Summary of possible service result variable values
3206           ┌──────────────────┬──────────────────┬─────────────────────┐
3207$SERVICE_RESULT$EXIT_CODE$EXIT_STATUS
3208           ├──────────────────┼──────────────────┼─────────────────────┤
3209           │"success"         │ "killed"         │ "HUP", "INT",       │
3210           │                  │                  │ "TERM", "PIPE"      │
3211           │                  ├──────────────────┼─────────────────────┤
3212           │                  │ "exited"         │ "0"                 │
3213           ├──────────────────┼──────────────────┼─────────────────────┤
3214           │"protocol"        │ not set          │ not set             │
3215           │                  ├──────────────────┼─────────────────────┤
3216           │                  │ "exited"         │ "0"                 │
3217           ├──────────────────┼──────────────────┼─────────────────────┤
3218           │"timeout"         │ "killed"         │ "TERM", "KILL"      │
3219           │                  ├──────────────────┼─────────────────────┤
3220           │                  │ "exited"         │ "0", "1", "2", "3", │
3221           │                  │                  │ ..., "255"          │
3222           ├──────────────────┼──────────────────┼─────────────────────┤
3223           │"exit-code"       │ "exited"         │ "1", "2", "3", ..., │
3224           │                  │                  │ "255"               │
3225           ├──────────────────┼──────────────────┼─────────────────────┤
3226           │"signal"          │ "killed"         │ "HUP", "INT",       │
3227           │                  │                  │ "KILL", ...         │
3228           ├──────────────────┼──────────────────┼─────────────────────┤
3229           │"core-dump"       │ "dumped"         │ "ABRT", "SEGV",     │
3230           │                  │                  │ "QUIT", ...         │
3231           ├──────────────────┼──────────────────┼─────────────────────┤
3232           │"watchdog"        │ "dumped"         │ "ABRT"              │
3233           │                  ├──────────────────┼─────────────────────┤
3234           │                  │ "killed"         │ "TERM", "KILL"      │
3235           │                  ├──────────────────┼─────────────────────┤
3236           │                  │ "exited"         │ "0", "1", "2", "3", │
3237           │                  │                  │ ..., "255"          │
3238           ├──────────────────┼──────────────────┼─────────────────────┤
3239           │"exec-condition"  │ "exited"         │ "1", "2", "3", "4", │
3240           │                  │                  │ ..., "254"          │
3241           ├──────────────────┼──────────────────┼─────────────────────┤
3242           │"oom-kill"        │ "killed"         │ "TERM", "KILL"      │
3243           ├──────────────────┼──────────────────┼─────────────────────┤
3244           │"start-limit-hit" │ not set          │ not set             │
3245           ├──────────────────┼──────────────────┼─────────────────────┤
3246           │"resources"       │ any of the above │ any of the above    │
3247           ├──────────────────┴──────────────────┴─────────────────────┤
3248           │Note: the process may be also terminated by a signal not   │
3249           │sent by systemd. In particular the process may send an     │
3250           │arbitrary signal to itself in a handler for any of the     │
3251           │non-maskable signals. Nevertheless, in the "timeout" and   │
3252           │"watchdog" rows above only the signals that systemd sends  │
3253           │have been included. Moreover, using SuccessExitStatus=
3254           │additional exit statuses may be declared to indicate clean │
3255           │termination, which is not reflected by this table.         │
3256           └───────────────────────────────────────────────────────────┘
3257
3258       $PIDFILE
3259           The path to the configured PID file, in case the process is forked
3260           off on behalf of a service that uses the PIDFile= setting, see
3261           systemd.service(5) for details. Service code may use this
3262           environment variable to automatically generate a PID file at the
3263           location configured in the unit file. This field is set to an
3264           absolute path in the file system.
3265
3266       For system services, when PAMName= is enabled and pam_systemd is part
3267       of the selected PAM stack, additional environment variables defined by
3268       systemd may be set for services. Specifically, these are $XDG_SEAT,
3269       $XDG_VTNR, see pam_systemd(8) for details.
3270

PROCESS EXIT CODES

3272       When invoking a unit process the service manager possibly fails to
3273       apply the execution parameters configured with the settings above. In
3274       that case the already created service process will exit with a non-zero
3275       exit code before the configured command line is executed. (Or in other
3276       words, the child process possibly exits with these error codes, after
3277       having been created by the fork(2) system call, but before the matching
3278       execve(2) system call is called.) Specifically, exit codes defined by
3279       the C library, by the LSB specification and by the systemd service
3280       manager itself are used.
3281
3282       The following basic service exit codes are defined by the C library.
3283
3284       Table 7. Basic C library exit codes
3285       ┌──────────┬───────────────┬────────────────────┐
3286Exit Code Symbolic Name Description        
3287       ├──────────┼───────────────┼────────────────────┤
3288       │0         │ EXIT_SUCCESS  │ Generic success    │
3289       │          │               │ code.              │
3290       ├──────────┼───────────────┼────────────────────┤
3291       │1         │ EXIT_FAILURE  │ Generic failure or │
3292       │          │               │ unspecified error. │
3293       └──────────┴───────────────┴────────────────────┘
3294
3295       The following service exit codes are defined by the LSB
3296       specification[10].
3297
3298       Table 8. LSB service exit codes
3299       ┌──────────┬──────────────────────┬────────────────────┐
3300Exit Code Symbolic Name        Description        
3301       ├──────────┼──────────────────────┼────────────────────┤
3302       │2         │ EXIT_INVALIDARGUMENT │ Invalid or excess  │
3303       │          │                      │ arguments.         │
3304       ├──────────┼──────────────────────┼────────────────────┤
3305       │3         │ EXIT_NOTIMPLEMENTED  │ Unimplemented      │
3306       │          │                      │ feature.           │
3307       ├──────────┼──────────────────────┼────────────────────┤
3308       │4         │ EXIT_NOPERMISSION    │ The user has       │
3309       │          │                      │ insufficient       │
3310       │          │                      │ privileges.        │
3311       ├──────────┼──────────────────────┼────────────────────┤
3312       │5         │ EXIT_NOTINSTALLED    │ The program is not │
3313       │          │                      │ installed.         │
3314       ├──────────┼──────────────────────┼────────────────────┤
3315       │6         │ EXIT_NOTCONFIGURED   │ The program is not │
3316       │          │                      │ configured.        │
3317       ├──────────┼──────────────────────┼────────────────────┤
3318       │7         │ EXIT_NOTRUNNING      │ The program is not │
3319       │          │                      │ running.           │
3320       └──────────┴──────────────────────┴────────────────────┘
3321
3322       The LSB specification suggests that error codes 200 and above are
3323       reserved for implementations. Some of them are used by the service
3324       manager to indicate problems during process invocation:
3325
3326       Table 9. systemd-specific exit codes
3327       ┌──────────┬──────────────────────────────┬─────────────────────────────────────────────┐
3328Exit Code Symbolic Name                Description                                 
3329       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3330       │200       │ EXIT_CHDIR                   │ Changing to the                             │
3331       │          │                              │ requested working                           │
3332       │          │                              │ directory failed.                           │
3333       │          │                              │ See                                         │
3334       │          │                              │ WorkingDirectory=
3335       │          │                              │ above.                                      │
3336       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3337       │201       │ EXIT_NICE                    │ Failed to set up                            │
3338       │          │                              │ process scheduling                          │
3339       │          │                              │ priority (nice                              │
3340       │          │                              │ level). See Nice=
3341       │          │                              │ above.                                      │
3342       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3343       │202       │ EXIT_FDS                     │ Failed to close                             │
3344       │          │                              │ unwanted file                               │
3345       │          │                              │ descriptors, or to                          │
3346       │          │                              │ adjust passed file                          │
3347       │          │                              │ descriptors.                                │
3348       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3349       │203       │ EXIT_EXEC                    │ The actual process                          │
3350       │          │                              │ execution failed                            │
3351       │          │                              │ (specifically, the                          │
3352       │          │                              │ execve(2) system                            │
3353       │          │                              │ call). Most likely                          │
3354       │          │                              │ this is caused by a                         │
3355       │          │                              │ missing or                                  │
3356       │          │                              │ non-accessible                              │
3357       │          │                              │ executable file.                            │
3358       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3359       │204       │ EXIT_MEMORY                  │ Failed to perform                           │
3360       │          │                              │ an action due to                            │
3361       │          │                              │ memory shortage.                            │
3362       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3363       │205       │ EXIT_LIMITS                  │ Failed to adjust                            │
3364       │          │                              │ resource limits.                            │
3365       │          │                              │ See LimitCPU= and                           │
3366       │          │                              │ related settings                            │
3367       │          │                              │ above.                                      │
3368       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3369       │206       │ EXIT_OOM_ADJUST              │ Failed to adjust                            │
3370       │          │                              │ the OOM setting.                            │
3371       │          │                              │ See OOMScoreAdjust=
3372       │          │                              │ above.                                      │
3373       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3374       │207       │ EXIT_SIGNAL_MASK             │ Failed to set                               │
3375       │          │                              │ process signal                              │
3376       │          │                              │ mask.                                       │
3377       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3378       │208       │ EXIT_STDIN                   │ Failed to set up                            │
3379       │          │                              │ standard input. See                         │
3380       │          │                              │ StandardInput=
3381       │          │                              │ above.                                      │
3382       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3383       │209       │ EXIT_STDOUT                  │ Failed to set up                            │
3384       │          │                              │ standard output.                            │
3385       │          │                              │ See StandardOutput=
3386       │          │                              │ above.                                      │
3387       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3388       │210       │ EXIT_CHROOT                  │ Failed to change                            │
3389       │          │                              │ root directory                              │
3390       │          │                              │ (chroot(2)). See                            │
3391       │          │                              │ RootDirectory=/RootImage=
3392       │          │                              │ above.                                      │
3393       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3394       │211       │ EXIT_IOPRIO                  │ Failed to set up IO                         │
3395       │          │                              │ scheduling priority. See                    │
3396       │          │                              │ IOSchedulingClass=/IOSchedulingPriority=
3397       │          │                              │ above.                                      │
3398       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3399       │212       │ EXIT_TIMERSLACK              │ Failed to set up timer slack. See           │
3400       │          │                              │ TimerSlackNSec= above.                      │
3401       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3402       │213       │ EXIT_SECUREBITS              │ Failed to set process secure bits. See      │
3403       │          │                              │ SecureBits= above.                          │
3404       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3405       │214       │ EXIT_SETSCHEDULER            │ Failed to set up CPU scheduling. See        │
3406       │          │                              │ CPUSchedulingPolicy=/CPUSchedulingPriority=
3407       │          │                              │ above.                                      │
3408       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3409       │215       │ EXIT_CPUAFFINITY             │ Failed to set up CPU affinity. See          │
3410       │          │                              │ CPUAffinity= above.                         │
3411       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3412       │216       │ EXIT_GROUP                   │ Failed to determine or change group         │
3413       │          │                              │ credentials. See                            │
3414       │          │                              │ Group=/SupplementaryGroups= above.          │
3415       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3416       │217       │ EXIT_USER                    │ Failed to determine or change user          │
3417       │          │                              │ credentials, or to set up user namespacing. │
3418       │          │                              │ See User=/PrivateUsers= above.              │
3419       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3420       │218       │ EXIT_CAPABILITIES            │ Failed to drop capabilities, or apply       │
3421       │          │                              │ ambient capabilities. See                   │
3422       │          │                              │ CapabilityBoundingSet=/AmbientCapabilities=
3423       │          │                              │ above.                                      │
3424       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3425       │219       │ EXIT_CGROUP                  │ Setting up the service control group        │
3426       │          │                              │ failed.                                     │
3427       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3428       │220       │ EXIT_SETSID                  │ Failed to create new process session.       │
3429       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3430       │221       │ EXIT_CONFIRM                 │ Execution has been cancelled by the user.   │
3431       │          │                              │ See the systemd.confirm_spawn= kernel       │
3432       │          │                              │ command line setting on kernel-command-     
3433       │          │                              │ line(7) for details.                        │
3434       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3435       │222       │ EXIT_STDERR                  │ Failed to set up standard error output. See │
3436       │          │                              │ StandardError= above.                       │
3437       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3438       │224       │ EXIT_PAM                     │ Failed to set up PAM session. See PAMName=
3439       │          │                              │ above.                                      │
3440       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3441       │225       │ EXIT_NETWORK                 │ Failed to set up network namespacing. See   │
3442       │          │                              │ PrivateNetwork= above.                      │
3443       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3444       │226       │ EXIT_NAMESPACE               │ Failed to set up mount, UTS, or IPC         │
3445       │          │                              │ namespacing. See ReadOnlyPaths=,            │
3446       │          │                              │ ProtectHostname=, PrivateIPC=, and related  │
3447       │          │                              │ settings above.                             │
3448       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3449       │227       │ EXIT_NO_NEW_PRIVILEGES       │ Failed to disable new privileges. See       │
3450       │          │                              │ NoNewPrivileges=yes above.                  │
3451       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3452       │228       │ EXIT_SECCOMP                 │ Failed to apply system call filters. See    │
3453       │          │                              │ SystemCallFilter= and related settings      │
3454       │          │                              │ above.                                      │
3455       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3456       │229       │ EXIT_SELINUX_CONTEXT         │ Determining or changing SELinux context     │
3457       │          │                              │ failed. See SELinuxContext= above.          │
3458       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3459       │230       │ EXIT_PERSONALITY             │ Failed to set up an execution domain        │
3460       │          │                              │ (personality). See Personality= above.      │
3461       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3462       │231       │ EXIT_APPARMOR_PROFILE        │ Failed to prepare changing AppArmor         │
3463       │          │                              │ profile. See AppArmorProfile= above.        │
3464       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3465       │232       │ EXIT_ADDRESS_FAMILIES        │ Failed to restrict address families. See    │
3466       │          │                              │ RestrictAddressFamilies= above.             │
3467       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3468       │233       │ EXIT_RUNTIME_DIRECTORY       │ Setting up runtime directory failed. See    │
3469       │          │                              │ RuntimeDirectory= and related settings      │
3470       │          │                              │ above.                                      │
3471       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3472       │235       │ EXIT_CHOWN                   │ Failed to adjust socket ownership. Used for │
3473       │          │                              │ socket units only.                          │
3474       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3475       │236       │ EXIT_SMACK_PROCESS_LABEL     │ Failed to set SMACK label. See              │
3476       │          │                              │ SmackProcessLabel= above.                   │
3477       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3478       │237       │ EXIT_KEYRING                 │ Failed to set up kernel keyring.            │
3479       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3480       │238       │ EXIT_STATE_DIRECTORY         │ Failed to set up unit's state directory.    │
3481       │          │                              │ See StateDirectory= above.                  │
3482       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3483       │239       │ EXIT_CACHE_DIRECTORY         │ Failed to set up unit's cache directory.    │
3484       │          │                              │ See CacheDirectory= above.                  │
3485       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3486       │240       │ EXIT_LOGS_DIRECTORY          │ Failed to set up unit's logging directory.  │
3487       │          │                              │ See LogsDirectory= above.                   │
3488       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3489       │241       │ EXIT_CONFIGURATION_DIRECTORY │ Failed to set up unit's configuration       │
3490       │          │                              │ directory. See ConfigurationDirectory=
3491       │          │                              │ above.                                      │
3492       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3493       │242       │ EXIT_NUMA_POLICY             │ Failed to set up unit's NUMA memory policy. │
3494       │          │                              │ See NUMAPolicy= and NUMAMask= above.        │
3495       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3496       │243       │ EXIT_CREDENTIALS             │ Failed to set up unit's credentials. See    │
3497       │          │                              │ LoadCredential= and SetCredential= above.   │
3498       ├──────────┼──────────────────────────────┼─────────────────────────────────────────────┤
3499       │245       │ EXIT_BPF                     │ Failed to apply BPF restrictions. See       │
3500       │          │                              │ RestrictFileSystems= above.                 │
3501       └──────────┴──────────────────────────────┴─────────────────────────────────────────────┘
3502
3503       Finally, the BSD operating systems define a set of exit codes,
3504       typically defined on Linux systems too:
3505
3506       Table 10. BSD exit codes
3507       ┌──────────┬────────────────┬─────────────────────┐
3508Exit Code Symbolic Name  Description         
3509       ├──────────┼────────────────┼─────────────────────┤
3510       │64        │ EX_USAGE       │ Command line usage  │
3511       │          │                │ error               │
3512       ├──────────┼────────────────┼─────────────────────┤
3513       │65        │ EX_DATAERR     │ Data format error   │
3514       ├──────────┼────────────────┼─────────────────────┤
3515       │66        │ EX_NOINPUT     │ Cannot open input   │
3516       ├──────────┼────────────────┼─────────────────────┤
3517       │67        │ EX_NOUSER      │ Addressee unknown   │
3518       ├──────────┼────────────────┼─────────────────────┤
3519       │68        │ EX_NOHOST      │ Host name unknown   │
3520       ├──────────┼────────────────┼─────────────────────┤
3521       │69        │ EX_UNAVAILABLE │ Service unavailable │
3522       ├──────────┼────────────────┼─────────────────────┤
3523       │70        │ EX_SOFTWARE    │ internal software   │
3524       │          │                │ error               │
3525       ├──────────┼────────────────┼─────────────────────┤
3526       │71        │ EX_OSERR       │ System error (e.g., │
3527       │          │                │ can't fork)         │
3528       ├──────────┼────────────────┼─────────────────────┤
3529       │72        │ EX_OSFILE      │ Critical OS file    │
3530       │          │                │ missing             │
3531       ├──────────┼────────────────┼─────────────────────┤
3532       │73        │ EX_CANTCREAT   │ Can't create (user) │
3533       │          │                │ output file         │
3534       ├──────────┼────────────────┼─────────────────────┤
3535       │74        │ EX_IOERR       │ Input/output error  │
3536       ├──────────┼────────────────┼─────────────────────┤
3537       │75        │ EX_TEMPFAIL    │ Temporary failure;  │
3538       │          │                │ user is invited to  │
3539       │          │                │ retry               │
3540       ├──────────┼────────────────┼─────────────────────┤
3541       │76        │ EX_PROTOCOL    │ Remote error in     │
3542       │          │                │ protocol            │
3543       ├──────────┼────────────────┼─────────────────────┤
3544       │77        │ EX_NOPERM      │ Permission denied   │
3545       ├──────────┼────────────────┼─────────────────────┤
3546       │78        │ EX_CONFIG      │ Configuration error │
3547       └──────────┴────────────────┴─────────────────────┘
3548

SEE ALSO

3550       systemd(1), systemctl(1), systemd-analyze(1), journalctl(1), systemd-
3551       system.conf(5), systemd.unit(5), systemd.service(5), systemd.socket(5),
3552       systemd.swap(5), systemd.mount(5), systemd.kill(5), systemd.resource-
3553       control(5), systemd.time(7), systemd.directives(7), tmpfiles.d(5),
3554       exec(3), fork(2)
3555

NOTES

3557        1. Discoverable Partitions Specification
3558           https://systemd.io/DISCOVERABLE_PARTITIONS
3559
3560        2. The /proc Filesystem
3561           https://www.kernel.org/doc/html/latest/filesystems/proc.html#mount-options
3562
3563        3. User/Group Name Syntax
3564           https://systemd.io/USER_NAMES
3565
3566        4. No New Privileges Flag
3567           https://www.kernel.org/doc/html/latest/userspace-api/no_new_privs.html
3568
3569        5. JSON User Record
3570           https://systemd.io/USER_RECORD
3571
3572        6. proc.txt
3573           https://www.kernel.org/doc/Documentation/filesystems/proc.txt
3574
3575        7. C escapes
3576           https://en.wikipedia.org/wiki/Escape_sequences_in_C#Table_of_escape_sequences
3577
3578        8. most control characters
3579           https://en.wikipedia.org/wiki/Control_character#In_ASCII
3580
3581        9. Base64
3582           https://tools.ietf.org/html/rfc2045#section-6.8
3583
3584       10. LSB specification
3585           https://refspecs.linuxbase.org/LSB_5.0.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html
3586
3587
3588
3589systemd 250                                                    SYSTEMD.EXEC(5)
Impressum