Provided by: libconfig-model-systemd-perl_0.256.1-1_all 

NAME
Config::Model::models::Systemd::Section::Service - Configuration class Systemd::Section::Service
DESCRIPTION
Configuration classes used by Config::Model
A unit configuration file whose name ends in ".service" encodes information about a process controlled
and supervised by systemd.
This man page lists the configuration options specific to this unit type. See systemd.unit(5) for the
common options of all unit configuration files. The common configuration items are configured in the
generic [Unit] and [Install] sections. The service specific configuration options are configured in the
[Service] section.
Additional options are listed in systemd.exec(5), which define the execution environment the commands are
executed in, and in systemd.kill(5), which define the way the processes of the service are terminated,
and in systemd.resource-control(5), which configure resource control settings for the processes of the
service.
If SysV init compat is enabled, systemd automatically creates service units that wrap SysV init scripts
(the service name is the same as the name of the script, with a ".service" suffix added); see
systemd-sysv-generator(8).
The systemd-run(1) command allows creating ".service" and ".scope" units dynamically and transiently from
the command line. This configuration class was generated from systemd documentation. by parse-man.pl
<https://github.com/dod38fr/config-model-systemd/contrib/parse-man.pl>
Elements
CPUAccounting
Turn on CPU usage accounting for this unit. Takes a boolean argument. Note that turning on CPU accounting
for one unit will also implicitly turn it on for all units contained in the same slice and for all its
parent slices and the units contained therein. The system default for this setting may be controlled with
"DefaultCPUAccounting" in systemd-system.conf(5).
Under the unified cgroup hierarchy, CPU accounting is available for all units and this setting has no
effect. Optional. Type boolean.
CPUWeight
These settings control the "cpu" controller in the unified hierarchy.
These options accept an integer value or a the special string "idle":
While "StartupCPUWeight" applies to the startup and shutdown phases of the system, "CPUWeight" applies to
normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using
"StartupCPUWeight" allows prioritizing specific services at boot-up and shutdown differently than during
normal runtime.
In addition to the resource allocation performed by the "cpu" controller, the kernel may automatically
divide resources based on session-id grouping, see "The autogroup feature" in sched(7). The effect of
this feature is similar to the "cpu" controller with no explicit configuration, so users should be
careful to not mistake one for the other. Optional. Type uniline.
StartupCPUWeight
These settings control the "cpu" controller in the unified hierarchy.
These options accept an integer value or a the special string "idle":
While "StartupCPUWeight" applies to the startup and shutdown phases of the system, "CPUWeight" applies to
normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using
"StartupCPUWeight" allows prioritizing specific services at boot-up and shutdown differently than during
normal runtime.
In addition to the resource allocation performed by the "cpu" controller, the kernel may automatically
divide resources based on session-id grouping, see "The autogroup feature" in sched(7). The effect of
this feature is similar to the "cpu" controller with no explicit configuration, so users should be
careful to not mistake one for the other. Optional. Type uniline.
CPUQuota
This setting controls the "cpu" controller in the unified hierarchy.
Assign the specified CPU time quota to the processes executed. Takes a percentage value, suffixed with
"%". The percentage specifies how much CPU time the unit shall get at maximum, relative to the total CPU
time available on one CPU. Use values > 100% for allotting CPU time on more than one CPU. This controls
the "cpu.max" attribute on the unified control group hierarchy and "cpu.cfs_quota_us" on legacy. For
details about these control group attributes, see Control Groups v2 <https://docs.kernel.org/admin-
guide/cgroup-v2.html> and CFS Bandwidth Control <https://docs.kernel.org/scheduler/sched-bwc.html>.
Setting "CPUQuota" to an empty value unsets the quota.
Example: "CPUQuota=20%" ensures that the executed processes will never get more than 20% CPU time on one
CPU. Optional. Type uniline.
CPUQuotaPeriodSec
This setting controls the "cpu" controller in the unified hierarchy.
Assign the duration over which the CPU time quota specified by "CPUQuota" is measured. Takes a time
duration value in seconds, with an optional suffix such as "ms" for milliseconds (or "s" for seconds.)
The default setting is 100ms. The period is clamped to the range supported by the kernel, which is [1ms,
1000ms]. Additionally, the period is adjusted up so that the quota interval is also at least 1ms.
Setting "CPUQuotaPeriodSec" to an empty value resets it to the default.
This controls the second field of "cpu.max" attribute on the unified control group hierarchy and
"cpu.cfs_period_us" on legacy. For details about these control group attributes, see Control Groups v2
<https://docs.kernel.org/admin-guide/cgroup-v2.html> and CFS Scheduler
<https://docs.kernel.org/scheduler/sched-design-CFS.html>.
Example: "CPUQuotaPeriodSec=10ms" to request that the CPU quota is measured in periods of 10ms.
Optional. Type uniline.
AllowedCPUs
This setting controls the "cpuset" controller in the unified hierarchy.
Restrict processes to be executed on specific CPUs. Takes a list of CPU indices or ranges separated by
either whitespace or commas. CPU ranges are specified by the lower and upper CPU indices separated by a
dash.
Setting "AllowedCPUs" or "StartupAllowedCPUs" doesn't guarantee that all of the CPUs will be used by the
processes as it may be limited by parent units. The effective configuration is reported as
"EffectiveCPUs".
While "StartupAllowedCPUs" applies to the startup and shutdown phases of the system, "AllowedCPUs"
applies to normal runtime of the system, and if the former is not set also to the startup and shutdown
phases. Using "StartupAllowedCPUs" allows prioritizing specific services at boot-up and shutdown
differently than during normal runtime.
This setting is supported only with the unified control group hierarchy. Optional. Type uniline.
StartupAllowedCPUs
This setting controls the "cpuset" controller in the unified hierarchy.
Restrict processes to be executed on specific CPUs. Takes a list of CPU indices or ranges separated by
either whitespace or commas. CPU ranges are specified by the lower and upper CPU indices separated by a
dash.
Setting "AllowedCPUs" or "StartupAllowedCPUs" doesn't guarantee that all of the CPUs will be used by the
processes as it may be limited by parent units. The effective configuration is reported as
"EffectiveCPUs".
While "StartupAllowedCPUs" applies to the startup and shutdown phases of the system, "AllowedCPUs"
applies to normal runtime of the system, and if the former is not set also to the startup and shutdown
phases. Using "StartupAllowedCPUs" allows prioritizing specific services at boot-up and shutdown
differently than during normal runtime.
This setting is supported only with the unified control group hierarchy. Optional. Type uniline.
MemoryAccounting
This setting controls the "memory" controller in the unified hierarchy.
Turn on process and kernel memory accounting for this unit. Takes a boolean argument. Note that turning
on memory accounting for one unit will also implicitly turn it on for all units contained in the same
slice and for all its parent slices and the units contained therein. The system default for this setting
may be controlled with "DefaultMemoryAccounting" in systemd-system.conf(5). Optional. Type boolean.
MemoryMin
These settings control the "memory" controller in the unified hierarchy.
Specify the memory usage protection of the executed processes in this unit. When reclaiming memory, the
unit is treated as if it was using less memory resulting in memory to be preferentially reclaimed from
unprotected units. Using "MemoryLow" results in a weaker protection where memory may still be reclaimed
to avoid invoking the OOM killer in case there is no other reclaimable memory.
For a protection to be effective, it is generally required to set a corresponding allocation on all
ancestors, which is then distributed between children (with the exception of the root slice). Any
"MemoryMin" or "MemoryLow" allocation that is not explicitly distributed to specific children is used to
create a shared protection for all children. As this is a shared protection, the children will freely
compete for the memory.
Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively.
Alternatively, a percentage value may be specified, which is taken relative to the installed physical
memory on the system. If assigned the special value "infinity", all available memory is protected, which
may be useful in order to always inherit all of the protection afforded by ancestors. This controls the
"memory.min" or "memory.low" control group attribute. For details about this control group attribute,
see Memory Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>.
Units may have their children use a default "memory.min" or "memory.low" value by specifying
"DefaultMemoryMin" or "DefaultMemoryLow", which has the same semantics as "MemoryMin" and "MemoryLow", or
"DefaultStartupMemoryLow" which has the same semantics as "StartupMemoryLow". This setting does not
affect "memory.min" or "memory.low" in the unit itself. Using it to set a default child allocation is
only useful on kernels older than 5.7, which do not support the "memory_recursiveprot" cgroup2 mount
option.
While "StartupMemoryLow" applies to the startup and shutdown phases of the system, "MemoryMin" applies to
normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using
"StartupMemoryLow" allows prioritizing specific services at boot-up and shutdown differently than during
normal runtime. Optional. Type uniline.
StartupMemoryLow
These settings control the "memory" controller in the unified hierarchy.
Specify the memory usage protection of the executed processes in this unit. When reclaiming memory, the
unit is treated as if it was using less memory resulting in memory to be preferentially reclaimed from
unprotected units. Using "MemoryLow" results in a weaker protection where memory may still be reclaimed
to avoid invoking the OOM killer in case there is no other reclaimable memory.
For a protection to be effective, it is generally required to set a corresponding allocation on all
ancestors, which is then distributed between children (with the exception of the root slice). Any
"MemoryMin" or "MemoryLow" allocation that is not explicitly distributed to specific children is used to
create a shared protection for all children. As this is a shared protection, the children will freely
compete for the memory.
Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively.
Alternatively, a percentage value may be specified, which is taken relative to the installed physical
memory on the system. If assigned the special value "infinity", all available memory is protected, which
may be useful in order to always inherit all of the protection afforded by ancestors. This controls the
"memory.min" or "memory.low" control group attribute. For details about this control group attribute,
see Memory Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>.
Units may have their children use a default "memory.min" or "memory.low" value by specifying
"DefaultMemoryMin" or "DefaultMemoryLow", which has the same semantics as "MemoryMin" and "MemoryLow", or
"DefaultStartupMemoryLow" which has the same semantics as "StartupMemoryLow". This setting does not
affect "memory.min" or "memory.low" in the unit itself. Using it to set a default child allocation is
only useful on kernels older than 5.7, which do not support the "memory_recursiveprot" cgroup2 mount
option.
While "StartupMemoryLow" applies to the startup and shutdown phases of the system, "MemoryMin" applies to
normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using
"StartupMemoryLow" allows prioritizing specific services at boot-up and shutdown differently than during
normal runtime. Optional. Type uniline.
MemoryHigh
These settings control the "memory" controller in the unified hierarchy.
Specify the throttling limit on memory usage of the executed processes in this unit. Memory usage may go
above the limit if unavoidable, but the processes are heavily slowed down and memory is taken away
aggressively in such cases. This is the main mechanism to control memory usage of a unit.
Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively.
Alternatively, a percentage value may be specified, which is taken relative to the installed physical
memory on the system. If assigned the special value "infinity", no memory throttling is applied. This
controls the "memory.high" control group attribute. For details about this control group attribute, see
Memory Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>. The
effective configuration is reported as "EffectiveMemoryHigh" (see also "EffectiveMemoryMax").
While "StartupMemoryHigh" applies to the startup and shutdown phases of the system, "MemoryHigh" applies
to normal runtime of the system, and if the former is not set also to the startup and shutdown phases.
Using "StartupMemoryHigh" allows prioritizing specific services at boot-up and shutdown differently than
during normal runtime. Optional. Type uniline.
StartupMemoryHigh
These settings control the "memory" controller in the unified hierarchy.
Specify the throttling limit on memory usage of the executed processes in this unit. Memory usage may go
above the limit if unavoidable, but the processes are heavily slowed down and memory is taken away
aggressively in such cases. This is the main mechanism to control memory usage of a unit.
Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively.
Alternatively, a percentage value may be specified, which is taken relative to the installed physical
memory on the system. If assigned the special value "infinity", no memory throttling is applied. This
controls the "memory.high" control group attribute. For details about this control group attribute, see
Memory Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>. The
effective configuration is reported as "EffectiveMemoryHigh" (see also "EffectiveMemoryMax").
While "StartupMemoryHigh" applies to the startup and shutdown phases of the system, "MemoryHigh" applies
to normal runtime of the system, and if the former is not set also to the startup and shutdown phases.
Using "StartupMemoryHigh" allows prioritizing specific services at boot-up and shutdown differently than
during normal runtime. Optional. Type uniline.
MemoryMax
These settings control the "memory" controller in the unified hierarchy.
Specify the absolute limit on memory usage of the executed processes in this unit. If memory usage cannot
be contained under the limit, out-of-memory killer is invoked inside the unit. It is recommended to use
"MemoryHigh" as the main control mechanism and use "MemoryMax" as the last line of defense.
Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively.
Alternatively, a percentage value may be specified, which is taken relative to the installed physical
memory on the system. If assigned the special value "infinity", no memory limit is applied. This controls
the "memory.max" control group attribute. For details about this control group attribute, see Memory
Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>. The
effective configuration is reported as "EffectiveMemoryMax" (the value is the most stringent limit of the
unit and parent slices and it is capped by physical memory).
While "StartupMemoryMax" applies to the startup and shutdown phases of the system, "MemoryMax" applies to
normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using
"StartupMemoryMax" allows prioritizing specific services at boot-up and shutdown differently than during
normal runtime. Optional. Type uniline.
StartupMemoryMax
These settings control the "memory" controller in the unified hierarchy.
Specify the absolute limit on memory usage of the executed processes in this unit. If memory usage cannot
be contained under the limit, out-of-memory killer is invoked inside the unit. It is recommended to use
"MemoryHigh" as the main control mechanism and use "MemoryMax" as the last line of defense.
Takes a memory size in bytes. If the value is suffixed with K, M, G or T, the specified memory size is
parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively.
Alternatively, a percentage value may be specified, which is taken relative to the installed physical
memory on the system. If assigned the special value "infinity", no memory limit is applied. This controls
the "memory.max" control group attribute. For details about this control group attribute, see Memory
Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>. The
effective configuration is reported as "EffectiveMemoryMax" (the value is the most stringent limit of the
unit and parent slices and it is capped by physical memory).
While "StartupMemoryMax" applies to the startup and shutdown phases of the system, "MemoryMax" applies to
normal runtime of the system, and if the former is not set also to the startup and shutdown phases. Using
"StartupMemoryMax" allows prioritizing specific services at boot-up and shutdown differently than during
normal runtime. Optional. Type uniline.
MemorySwapMax
These settings control the "memory" controller in the unified hierarchy.
Specify the absolute limit on swap usage of the executed processes in this unit.
Takes a swap size in bytes. If the value is suffixed with K, M, G or T, the specified swap size is parsed
as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
percentage value may be specified, which is taken relative to the specified swap size on the system. If
assigned the special value "infinity", no swap limit is applied. These settings control the
"memory.swap.max" control group attribute. For details about this control group attribute, see Memory
Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>.
While "StartupMemorySwapMax" applies to the startup and shutdown phases of the system, "MemorySwapMax"
applies to normal runtime of the system, and if the former is not set also to the startup and shutdown
phases. Using "StartupMemorySwapMax" allows prioritizing specific services at boot-up and shutdown
differently than during normal runtime. Optional. Type uniline.
StartupMemorySwapMax
These settings control the "memory" controller in the unified hierarchy.
Specify the absolute limit on swap usage of the executed processes in this unit.
Takes a swap size in bytes. If the value is suffixed with K, M, G or T, the specified swap size is parsed
as Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. Alternatively, a
percentage value may be specified, which is taken relative to the specified swap size on the system. If
assigned the special value "infinity", no swap limit is applied. These settings control the
"memory.swap.max" control group attribute. For details about this control group attribute, see Memory
Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>.
While "StartupMemorySwapMax" applies to the startup and shutdown phases of the system, "MemorySwapMax"
applies to normal runtime of the system, and if the former is not set also to the startup and shutdown
phases. Using "StartupMemorySwapMax" allows prioritizing specific services at boot-up and shutdown
differently than during normal runtime. Optional. Type uniline.
MemoryZSwapMax
These settings control the "memory" controller in the unified hierarchy.
Specify the absolute limit on zswap usage of the processes in this unit. Zswap is a lightweight
compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts
to compress them into a dynamically allocated RAM-based memory pool. If the limit specified is hit, no
entries from this unit will be stored in the pool until existing entries are faulted back or written out
to disk. See the kernel's Zswap <https://docs.kernel.org/admin-guide/mm/zswap.html> documentation for
more details.
Takes a size in bytes. If the value is suffixed with K, M, G or T, the specified size is parsed as
Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. If assigned the special
value "infinity", no limit is applied. These settings control the "memory.zswap.max" control group
attribute. For details about this control group attribute, see Memory Interface Files
<https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>.
While "StartupMemoryZSwapMax" applies to the startup and shutdown phases of the system, "MemoryZSwapMax"
applies to normal runtime of the system, and if the former is not set also to the startup and shutdown
phases. Using "StartupMemoryZSwapMax" allows prioritizing specific services at boot-up and shutdown
differently than during normal runtime. Optional. Type uniline.
StartupMemoryZSwapMax
These settings control the "memory" controller in the unified hierarchy.
Specify the absolute limit on zswap usage of the processes in this unit. Zswap is a lightweight
compressed cache for swap pages. It takes pages that are in the process of being swapped out and attempts
to compress them into a dynamically allocated RAM-based memory pool. If the limit specified is hit, no
entries from this unit will be stored in the pool until existing entries are faulted back or written out
to disk. See the kernel's Zswap <https://docs.kernel.org/admin-guide/mm/zswap.html> documentation for
more details.
Takes a size in bytes. If the value is suffixed with K, M, G or T, the specified size is parsed as
Kilobytes, Megabytes, Gigabytes, or Terabytes (with the base 1024), respectively. If assigned the special
value "infinity", no limit is applied. These settings control the "memory.zswap.max" control group
attribute. For details about this control group attribute, see Memory Interface Files
<https://docs.kernel.org/admin-guide/cgroup-v2.html#memory-interface-files>.
While "StartupMemoryZSwapMax" applies to the startup and shutdown phases of the system, "MemoryZSwapMax"
applies to normal runtime of the system, and if the former is not set also to the startup and shutdown
phases. Using "StartupMemoryZSwapMax" allows prioritizing specific services at boot-up and shutdown
differently than during normal runtime. Optional. Type uniline.
MemoryZSwapWriteback
This setting controls the "memory" controller in the unified hierarchy.
Takes a boolean argument. When true, pages stored in the Zswap cache are permitted to be written to the
backing storage, false otherwise. Defaults to true. This allows disabling writeback of swap pages for IO-
intensive applications, while retaining the ability to store compressed pages in Zswap. See the kernel's
Zswap <https://docs.kernel.org/admin-guide/mm/zswap.html> documentation for more details. Optional. Type
boolean.
AllowedMemoryNodes
These settings control the "cpuset" controller in the unified hierarchy.
Restrict processes to be executed on specific memory NUMA nodes. Takes a list of memory NUMA nodes
indices or ranges separated by either whitespace or commas. Memory NUMA nodes ranges are specified by the
lower and upper NUMA nodes indices separated by a dash.
Setting "AllowedMemoryNodes" or "StartupAllowedMemoryNodes" doesn't guarantee that all of the memory NUMA
nodes will be used by the processes as it may be limited by parent units. The effective configuration is
reported as "EffectiveMemoryNodes".
While "StartupAllowedMemoryNodes" applies to the startup and shutdown phases of the system,
"AllowedMemoryNodes" applies to normal runtime of the system, and if the former is not set also to the
startup and shutdown phases. Using "StartupAllowedMemoryNodes" allows prioritizing specific services at
boot-up and shutdown differently than during normal runtime.
This setting is supported only with the unified control group hierarchy. Optional. Type uniline.
StartupAllowedMemoryNodes
These settings control the "cpuset" controller in the unified hierarchy.
Restrict processes to be executed on specific memory NUMA nodes. Takes a list of memory NUMA nodes
indices or ranges separated by either whitespace or commas. Memory NUMA nodes ranges are specified by the
lower and upper NUMA nodes indices separated by a dash.
Setting "AllowedMemoryNodes" or "StartupAllowedMemoryNodes" doesn't guarantee that all of the memory NUMA
nodes will be used by the processes as it may be limited by parent units. The effective configuration is
reported as "EffectiveMemoryNodes".
While "StartupAllowedMemoryNodes" applies to the startup and shutdown phases of the system,
"AllowedMemoryNodes" applies to normal runtime of the system, and if the former is not set also to the
startup and shutdown phases. Using "StartupAllowedMemoryNodes" allows prioritizing specific services at
boot-up and shutdown differently than during normal runtime.
This setting is supported only with the unified control group hierarchy. Optional. Type uniline.
TasksAccounting
This setting controls the "pids" controller in the unified hierarchy.
Turn on task accounting for this unit. Takes a boolean argument. If enabled, the kernel will keep track
of the total number of tasks in the unit and its children. This number includes both kernel threads and
userspace processes, with each thread counted individually. Note that turning on tasks accounting for one
unit will also implicitly turn it on for all units contained in the same slice and for all its parent
slices and the units contained therein. The system default for this setting may be controlled with
"DefaultTasksAccounting" in systemd-system.conf(5). Optional. Type boolean.
TasksMax
This setting controls the "pids" controller in the unified hierarchy.
Specify the maximum number of tasks that may be created in the unit. This ensures that the number of
tasks accounted for the unit (see above) stays below a specific limit. This either takes an absolute
number of tasks or a percentage value that is taken relative to the configured maximum number of tasks on
the system. If assigned the special value "infinity", no tasks limit is applied. This controls the
"pids.max" control group attribute. For details about this control group attribute, the pids controller
<https://docs.kernel.org/admin-guide/cgroup-v2.html#pid>. The effective configuration is reported as
"EffectiveTasksMax".
The system default for this setting may be controlled with "DefaultTasksMax" in systemd-system.conf(5).
Optional. Type uniline.
IOAccounting
This setting controls the "io" controller in the unified hierarchy.
Turn on Block I/O accounting for this unit, if the unified control group hierarchy is used on the system.
Takes a boolean argument. Note that turning on block I/O accounting for one unit will also implicitly
turn it on for all units contained in the same slice and all for its parent slices and the units
contained therein. The system default for this setting may be controlled with "DefaultIOAccounting" in
systemd-system.conf(5). Optional. Type boolean.
IOWeight
These settings control the "io" controller in the unified hierarchy.
Set the default overall block I/O weight for the executed processes, if the unified control group
hierarchy is used on the system. Takes a single weight value (between 1 and 10000) to set the default
block I/O weight. This controls the "io.weight" control group attribute, which defaults to 100. For
details about this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-
guide/cgroup-v2.html#io-interface-files>. The available I/O bandwidth is split up among all units within
one slice relative to their block I/O weight. A higher weight means more I/O bandwidth, a lower weight
means less.
While "StartupIOWeight" applies to the startup and shutdown phases of the system, "IOWeight" applies to
the later runtime of the system, and if the former is not set also to the startup and shutdown phases.
This allows prioritizing specific services at boot-up and shutdown differently than during runtime.
Optional. Type uniline.
StartupIOWeight
These settings control the "io" controller in the unified hierarchy.
Set the default overall block I/O weight for the executed processes, if the unified control group
hierarchy is used on the system. Takes a single weight value (between 1 and 10000) to set the default
block I/O weight. This controls the "io.weight" control group attribute, which defaults to 100. For
details about this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-
guide/cgroup-v2.html#io-interface-files>. The available I/O bandwidth is split up among all units within
one slice relative to their block I/O weight. A higher weight means more I/O bandwidth, a lower weight
means less.
While "StartupIOWeight" applies to the startup and shutdown phases of the system, "IOWeight" applies to
the later runtime of the system, and if the former is not set also to the startup and shutdown phases.
This allows prioritizing specific services at boot-up and shutdown differently than during runtime.
Optional. Type uniline.
IODeviceWeight
This setting controls the "io" controller in the unified hierarchy.
Set the per-device overall block I/O weight for the executed processes, if the unified control group
hierarchy is used on the system. Takes a space-separated pair of a file path and a weight value to
specify the device specific weight value, between 1 and 10000. (Example: "/dev/sda 1000"). The file path
may be specified as path to a block device node or as any other file, in which case the backing block
device of the file system of the file is determined. This controls the "io.weight" control group
attribute, which defaults to 100. Use this option multiple times to set weights for multiple devices.
For details about this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-
guide/cgroup-v2.html#io-interface-files>.
The specified device node should reference a block device that has an I/O scheduler associated, i.e.
should not refer to partition or loopback block devices, but to the originating, physical device. When a
path to a regular file or directory is specified it is attempted to discover the correct originating
device backing the file system of the specified path. This works correctly only for simpler cases, where
the file system is directly placed on a partition or physical block device, or where simple 1:1
encryption using dm-crypt/LUKS is used. This discovery does not cover complex storage and in particular
RAID and volume management storage devices. Optional. Type uniline.
IOReadBandwidthMax
These settings control the "io" controller in the unified hierarchy.
Set the per-device overall block I/O bandwidth maximum limit for the executed processes, if the unified
control group hierarchy is used on the system. This limit is not work-conserving and the executed
processes are not allowed to use more even if the device has idle capacity. Takes a space-separated pair
of a file path and a bandwidth value (in bytes per second) to specify the device specific bandwidth. The
file path may be a path to a block device node, or as any other file in which case the backing block
device of the file system of the file is used. If the bandwidth is suffixed with K, M, G, or T, the
specified bandwidth is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes, respectively, to the base
of 1000. (Example: "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the "io.max"
control group attributes. Use this option multiple times to set bandwidth limits for multiple devices.
For details about this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-
guide/cgroup-v2.html#io-interface-files>.
Similar restrictions on block device discovery as for "IODeviceWeight" apply, see above. Optional. Type
uniline.
IOWriteBandwidthMax
These settings control the "io" controller in the unified hierarchy.
Set the per-device overall block I/O bandwidth maximum limit for the executed processes, if the unified
control group hierarchy is used on the system. This limit is not work-conserving and the executed
processes are not allowed to use more even if the device has idle capacity. Takes a space-separated pair
of a file path and a bandwidth value (in bytes per second) to specify the device specific bandwidth. The
file path may be a path to a block device node, or as any other file in which case the backing block
device of the file system of the file is used. If the bandwidth is suffixed with K, M, G, or T, the
specified bandwidth is parsed as Kilobytes, Megabytes, Gigabytes, or Terabytes, respectively, to the base
of 1000. (Example: "/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 5M"). This controls the "io.max"
control group attributes. Use this option multiple times to set bandwidth limits for multiple devices.
For details about this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-
guide/cgroup-v2.html#io-interface-files>.
Similar restrictions on block device discovery as for "IODeviceWeight" apply, see above. Optional. Type
uniline.
IOReadIOPSMax
These settings control the "io" controller in the unified hierarchy.
Set the per-device overall block I/O IOs-Per-Second maximum limit for the executed processes, if the
unified control group hierarchy is used on the system. This limit is not work-conserving and the executed
processes are not allowed to use more even if the device has idle capacity. Takes a space-separated pair
of a file path and an IOPS value to specify the device specific IOPS. The file path may be a path to a
block device node, or as any other file in which case the backing block device of the file system of the
file is used. If the IOPS is suffixed with K, M, G, or T, the specified IOPS is parsed as KiloIOPS,
MegaIOPS, GigaIOPS, or TeraIOPS, respectively, to the base of 1000. (Example:
"/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 1K"). This controls the "io.max" control group
attributes. Use this option multiple times to set IOPS limits for multiple devices. For details about
this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-guide/cgroup-
v2.html#io-interface-files>.
Similar restrictions on block device discovery as for "IODeviceWeight" apply, see above. Optional. Type
uniline.
IOWriteIOPSMax
These settings control the "io" controller in the unified hierarchy.
Set the per-device overall block I/O IOs-Per-Second maximum limit for the executed processes, if the
unified control group hierarchy is used on the system. This limit is not work-conserving and the executed
processes are not allowed to use more even if the device has idle capacity. Takes a space-separated pair
of a file path and an IOPS value to specify the device specific IOPS. The file path may be a path to a
block device node, or as any other file in which case the backing block device of the file system of the
file is used. If the IOPS is suffixed with K, M, G, or T, the specified IOPS is parsed as KiloIOPS,
MegaIOPS, GigaIOPS, or TeraIOPS, respectively, to the base of 1000. (Example:
"/dev/disk/by-path/pci-0000:00:1f.2-scsi-0:0:0:0 1K"). This controls the "io.max" control group
attributes. Use this option multiple times to set IOPS limits for multiple devices. For details about
this control group attribute, see IO Interface Files <https://docs.kernel.org/admin-guide/cgroup-
v2.html#io-interface-files>.
Similar restrictions on block device discovery as for "IODeviceWeight" apply, see above. Optional. Type
uniline.
IODeviceLatencyTargetSec
This setting controls the "io" controller in the unified hierarchy.
Set the per-device average target I/O latency for the executed processes, if the unified control group
hierarchy is used on the system. Takes a file path and a timespan separated by a space to specify the
device specific latency target. (Example: "/dev/sda 25ms"). The file path may be specified as path to a
block device node or as any other file, in which case the backing block device of the file system of the
file is determined. This controls the "io.latency" control group attribute. Use this option multiple
times to set latency target for multiple devices. For details about this control group attribute, see IO
Interface Files <https://docs.kernel.org/admin-guide/cgroup-v2.html#io-interface-files>.
Implies "IOAccounting=yes".
These settings are supported only if the unified control group hierarchy is used.
Similar restrictions on block device discovery as for "IODeviceWeight" apply, see above. Optional. Type
uniline.
IPAccounting
Takes a boolean argument. If true, turns on IPv4 and IPv6 network traffic accounting for packets sent or
received by the unit. When this option is turned on, all IPv4 and IPv6 sockets created by any process of
the unit are accounted for.
When this option is used in socket units, it applies to all IPv4 and IPv6 sockets associated with it
(including both listening and connection sockets where this applies). Note that for socket-activated
services, this configuration setting and the accounting data of the service unit and the socket unit are
kept separate, and displayed separately. No propagation of the setting and the collected statistics is
done, in either direction. Moreover, any traffic sent or received on any of the socket unit's sockets is
accounted to the socket unit — and never to the service unit it might have activated, even if the socket
is used by it.
The system default for this setting may be controlled with "DefaultIPAccounting" in
systemd-system.conf(5).
Note that this functionality is currently only available for system services, not for per-user services.
Optional. Type boolean.
IPAddressAllow
Turn on network traffic filtering for IP packets sent and received over "AF_INET" and "AF_INET6" sockets.
Both directives take a space separated list of IPv4 or IPv6 addresses, each optionally suffixed with an
address prefix length in bits after a "/" character. If the suffix is omitted, the address is considered
a host address, i.e. the filter covers the whole address (32 bits for IPv4, 128 bits for IPv6).
The access lists configured with this option are applied to all sockets created by processes of this unit
(or in the case of socket units, associated with it). The lists are implicitly combined with any lists
configured for any of the parent slice units this unit might be a member of. By default both access lists
are empty. Both ingress and egress traffic is filtered by these settings. In case of ingress traffic the
source IP address is checked against these access lists, in case of egress traffic the destination IP
address is checked. The following rules are applied in turn:
In order to implement an allow-listing IP firewall, it is recommended to use a "IPAddressDeny""any"
setting on an upper-level slice unit (such as the root slice "-.slice" or the slice containing all system
services "system.slice" – see systemd.special(7) for details on these slice units), plus individual per-
service "IPAddressAllow" lines permitting network access to relevant services, and only them.
Note that for socket-activated services, the IP access list configured on the socket unit applies to all
sockets associated with it directly, but not to any sockets created by the ultimately activated services
for it. Conversely, the IP access list configured for the service is not applied to any sockets passed
into the service via socket activation. Thus, it is usually a good idea to replicate the IP access lists
on both the socket and the service unit. Nevertheless, it may make sense to maintain one list more open
and the other one more restricted, depending on the use case.
If these settings are used multiple times in the same unit the specified lists are combined. If an empty
string is assigned to these settings the specific access list is reset and all previous settings undone.
In place of explicit IPv4 or IPv6 address and prefix length specifications a small set of symbolic names
may be used. The following names are defined:
Note that these settings might not be supported on some systems (for example if eBPF control group
support is not enabled in the underlying kernel or container manager). These settings will have no effect
in that case. If compatibility with such systems is desired it is hence recommended to not exclusively
rely on them for IP security. Optional. Type uniline.
IPAddressDeny
Turn on network traffic filtering for IP packets sent and received over "AF_INET" and "AF_INET6" sockets.
Both directives take a space separated list of IPv4 or IPv6 addresses, each optionally suffixed with an
address prefix length in bits after a "/" character. If the suffix is omitted, the address is considered
a host address, i.e. the filter covers the whole address (32 bits for IPv4, 128 bits for IPv6).
The access lists configured with this option are applied to all sockets created by processes of this unit
(or in the case of socket units, associated with it). The lists are implicitly combined with any lists
configured for any of the parent slice units this unit might be a member of. By default both access lists
are empty. Both ingress and egress traffic is filtered by these settings. In case of ingress traffic the
source IP address is checked against these access lists, in case of egress traffic the destination IP
address is checked. The following rules are applied in turn:
In order to implement an allow-listing IP firewall, it is recommended to use a "IPAddressDeny""any"
setting on an upper-level slice unit (such as the root slice "-.slice" or the slice containing all system
services "system.slice" – see systemd.special(7) for details on these slice units), plus individual per-
service "IPAddressAllow" lines permitting network access to relevant services, and only them.
Note that for socket-activated services, the IP access list configured on the socket unit applies to all
sockets associated with it directly, but not to any sockets created by the ultimately activated services
for it. Conversely, the IP access list configured for the service is not applied to any sockets passed
into the service via socket activation. Thus, it is usually a good idea to replicate the IP access lists
on both the socket and the service unit. Nevertheless, it may make sense to maintain one list more open
and the other one more restricted, depending on the use case.
If these settings are used multiple times in the same unit the specified lists are combined. If an empty
string is assigned to these settings the specific access list is reset and all previous settings undone.
In place of explicit IPv4 or IPv6 address and prefix length specifications a small set of symbolic names
may be used. The following names are defined:
Note that these settings might not be supported on some systems (for example if eBPF control group
support is not enabled in the underlying kernel or container manager). These settings will have no effect
in that case. If compatibility with such systems is desired it is hence recommended to not exclusively
rely on them for IP security. Optional. Type uniline.
SocketBindAllow
Configures restrictions on the ability of unit processes to invoke bind(2) on a socket. Both allow and
deny rules may defined that restrict which addresses a socket may be bound to.
bind-rule describes socket properties such as address-family, transport-protocol and ip-ports.
bind-rule := { [address-family":"][transport-protocol":"][ip-ports] | "any" }
address-family := { "ipv4" | "ipv6" }
transport-protocol := { "tcp" | "udp" }
ip-ports := { ip-port | ip-port-range }
An optional address-family expects "ipv4" or "ipv6" values. If not specified, a rule will be matched for
both IPv4 and IPv6 addresses and applied depending on other socket fields, e.g. transport-protocol, ip-
port.
An optional transport-protocol expects "tcp" or "udp" transport protocol names. If not specified, a rule
will be matched for any transport protocol.
An optional ip-port value must lie within 1…65535 interval inclusively, i.e. dynamic port 0 is not
allowed. A range of sequential ports is described by ip-port-range := ip-port-low"-"ip-port-high, where
ip-port-low is smaller than or equal to ip-port-high and both are within 1…65535 inclusively.
A special value "any" can be used to apply a rule to any address family, transport protocol and any port
with a positive value.
To allow multiple rules assign "SocketBindAllow" or "SocketBindDeny" multiple times. To clear the
existing assignments pass an empty "SocketBindAllow" or "SocketBindDeny" assignment.
For each of "SocketBindAllow" and "SocketBindDeny", maximum allowed number of assignments is 128.
The feature is implemented with "cgroup/bind4" and "cgroup/bind6" cgroup-bpf hooks.
Note that these settings apply to any bind(2) system call invocation by the unit processes, regardless in
which network namespace they are placed. Or in other words: changing the network namespace is not a
suitable mechanism for escaping these restrictions on bind().
Examples:
…
# Allow binding IPv6 socket addresses with a port greater than or equal to 10000.
[Service]
SocketBindAllow=ipv6:10000-65535
SocketBindDeny=any
…
# Allow binding IPv4 and IPv6 socket addresses with 1234 and 4321 ports.
[Service]
SocketBindAllow=1234
SocketBindAllow=4321
SocketBindDeny=any
…
# Deny binding IPv6 socket addresses.
[Service]
SocketBindDeny=ipv6
…
# Deny binding IPv4 and IPv6 socket addresses.
[Service]
SocketBindDeny=any
…
# Allow binding only over TCP
[Service]
SocketBindAllow=tcp
SocketBindDeny=any
…
# Allow binding only over IPv6/TCP
[Service]
SocketBindAllow=ipv6:tcp
SocketBindDeny=any
…
# Allow binding ports within 10000-65535 range over IPv4/UDP.
[Service]
SocketBindAllow=ipv4:udp:10000-65535
SocketBindDeny=any
… Optional. Type uniline.
SocketBindDeny
Configures restrictions on the ability of unit processes to invoke bind(2) on a socket. Both allow and
deny rules may defined that restrict which addresses a socket may be bound to.
bind-rule describes socket properties such as address-family, transport-protocol and ip-ports.
bind-rule := { [address-family":"][transport-protocol":"][ip-ports] | "any" }
address-family := { "ipv4" | "ipv6" }
transport-protocol := { "tcp" | "udp" }
ip-ports := { ip-port | ip-port-range }
An optional address-family expects "ipv4" or "ipv6" values. If not specified, a rule will be matched for
both IPv4 and IPv6 addresses and applied depending on other socket fields, e.g. transport-protocol, ip-
port.
An optional transport-protocol expects "tcp" or "udp" transport protocol names. If not specified, a rule
will be matched for any transport protocol.
An optional ip-port value must lie within 1…65535 interval inclusively, i.e. dynamic port 0 is not
allowed. A range of sequential ports is described by ip-port-range := ip-port-low"-"ip-port-high, where
ip-port-low is smaller than or equal to ip-port-high and both are within 1…65535 inclusively.
A special value "any" can be used to apply a rule to any address family, transport protocol and any port
with a positive value.
To allow multiple rules assign "SocketBindAllow" or "SocketBindDeny" multiple times. To clear the
existing assignments pass an empty "SocketBindAllow" or "SocketBindDeny" assignment.
For each of "SocketBindAllow" and "SocketBindDeny", maximum allowed number of assignments is 128.
The feature is implemented with "cgroup/bind4" and "cgroup/bind6" cgroup-bpf hooks.
Note that these settings apply to any bind(2) system call invocation by the unit processes, regardless in
which network namespace they are placed. Or in other words: changing the network namespace is not a
suitable mechanism for escaping these restrictions on bind().
Examples:
…
# Allow binding IPv6 socket addresses with a port greater than or equal to 10000.
[Service]
SocketBindAllow=ipv6:10000-65535
SocketBindDeny=any
…
# Allow binding IPv4 and IPv6 socket addresses with 1234 and 4321 ports.
[Service]
SocketBindAllow=1234
SocketBindAllow=4321
SocketBindDeny=any
…
# Deny binding IPv6 socket addresses.
[Service]
SocketBindDeny=ipv6
…
# Deny binding IPv4 and IPv6 socket addresses.
[Service]
SocketBindDeny=any
…
# Allow binding only over TCP
[Service]
SocketBindAllow=tcp
SocketBindDeny=any
…
# Allow binding only over IPv6/TCP
[Service]
SocketBindAllow=ipv6:tcp
SocketBindDeny=any
…
# Allow binding ports within 10000-65535 range over IPv4/UDP.
[Service]
SocketBindAllow=ipv4:udp:10000-65535
SocketBindDeny=any
… Optional. Type uniline.
RestrictNetworkInterfaces
Takes a list of space-separated network interface names. This option restricts the network interfaces
that processes of this unit can use. By default processes can only use the network interfaces listed
(allow-list). If the first character of the rule is "~", the effect is inverted: the processes can only
use network interfaces not listed (deny-list).
This option can appear multiple times, in which case the network interface names are merged. If the empty
string is assigned the set is reset, all prior assignments will have not effect.
If you specify both types of this option (i.e. allow-listing and deny-listing), the first encountered
will take precedence and will dictate the default action (allow vs deny). Then the next occurrences of
this option will add or delete the listed network interface names from the set, depending of its type and
the default action.
The loopback interface ("lo") is not treated in any special way, you have to configure it explicitly in
the unit file.
Example 1: allow-list
RestrictNetworkInterfaces=eth1
RestrictNetworkInterfaces=eth2
Programs in the unit will be only able to use the eth1 and eth2 network interfaces.
Example 2: deny-list
RestrictNetworkInterfaces=~eth1 eth2
Programs in the unit will be able to use any network interface but eth1 and eth2.
Example 3: mixed
RestrictNetworkInterfaces=eth1 eth2
RestrictNetworkInterfaces=~eth1
Programs in the unit will be only able to use the eth2 network interface. Optional. Type uniline.
NFTSet
This setting provides a method for integrating dynamic cgroup, user and group IDs into firewall rules
with NFT <https://netfilter.org/projects/nftables/index.html> sets. The benefit of using this setting is
to be able to use the IDs as selectors in firewall rules easily and this in turn allows more fine grained
filtering. NFT rules for cgroup matching use numeric cgroup IDs, which change every time a service is
restarted, making them hard to use in systemd environment otherwise. Dynamic and random IDs used by
"DynamicUser" can be also integrated with this setting.
This option expects a whitespace separated list of NFT set definitions. Each definition consists of a
colon-separated tuple of source type (one of "cgroup", "user" or "group"), NFT address family (one of
"arp", "bridge", "inet", "ip", "ip6", or "netdev"), table name and set name. The names of tables and sets
must conform to lexical restrictions of NFT table names. The type of the element used in the NFT filter
must match the type implied by the directive ("cgroup", "user" or "group") as shown in the table below.
When a control group or a unit is realized, the corresponding ID will be appended to the NFT sets and it
will be be removed when the control group or unit is removed. systemd only inserts elements to (or
removes from) the sets, so the related NFT rules, tables and sets must be prepared elsewhere in advance.
Failures to manage the sets will be ignored.
If the firewall rules are reinstalled so that the contents of NFT sets are destroyed, command systemctl
daemon-reload can be used to refill the sets.
Example:
[Unit]
NFTSet=cgroup:inet:filter:my_service user:inet:filter:serviceuser
Corresponding NFT rules:
table inet filter {
set my_service {
type cgroupsv2
}
set serviceuser {
typeof meta skuid
}
chain x {
socket cgroupv2 level 2 @my_service accept
drop
}
chain y {
meta skuid @serviceuser accept
drop
}
}
I< Optional. Type uniline. >
IPIngressFilterPath
Add custom network traffic filters implemented as BPF programs, applying to all IP packets sent and
received over "AF_INET" and "AF_INET6" sockets. Takes an absolute path to a pinned BPF program in the
BPF virtual filesystem ("/sys/fs/bpf/").
The filters configured with this option are applied to all sockets created by processes of this unit (or
in the case of socket units, associated with it). The filters are loaded in addition to filters any of
the parent slice units this unit might be a member of as well as any "IPAddressAllow" and "IPAddressDeny"
filters in any of these units. By default there are no filters specified.
If these settings are used multiple times in the same unit all the specified programs are attached. If an
empty string is assigned to these settings the program list is reset and all previous specified programs
ignored.
If the path BPF_FS_PROGRAM_PATH in "IPIngressFilterPath" assignment is already being handled by
"BPFProgram" ingress hook, e.g. "BPFProgram""ingress":BPF_FS_PROGRAM_PATH, the assignment will be still
considered valid and the program will be attached to a cgroup. Same for "IPEgressFilterPath" path and
"egress" hook.
Note that for socket-activated services, the IP filter programs configured on the socket unit apply to
all sockets associated with it directly, but not to any sockets created by the ultimately activated
services for it. Conversely, the IP filter programs configured for the service are not applied to any
sockets passed into the service via socket activation. Thus, it is usually a good idea, to replicate the
IP filter programs on both the socket and the service unit, however it often makes sense to maintain one
configuration more open and the other one more restricted, depending on the use case.
Note that these settings might not be supported on some systems (for example if eBPF control group
support is not enabled in the underlying kernel or container manager). These settings will fail the
service in that case. If compatibility with such systems is desired it is hence recommended to attach
your filter manually (requires "Delegate""yes") instead of using this setting. Optional. Type uniline.
IPEgressFilterPath
Add custom network traffic filters implemented as BPF programs, applying to all IP packets sent and
received over "AF_INET" and "AF_INET6" sockets. Takes an absolute path to a pinned BPF program in the
BPF virtual filesystem ("/sys/fs/bpf/").
The filters configured with this option are applied to all sockets created by processes of this unit (or
in the case of socket units, associated with it). The filters are loaded in addition to filters any of
the parent slice units this unit might be a member of as well as any "IPAddressAllow" and "IPAddressDeny"
filters in any of these units. By default there are no filters specified.
If these settings are used multiple times in the same unit all the specified programs are attached. If an
empty string is assigned to these settings the program list is reset and all previous specified programs
ignored.
If the path BPF_FS_PROGRAM_PATH in "IPIngressFilterPath" assignment is already being handled by
"BPFProgram" ingress hook, e.g. "BPFProgram""ingress":BPF_FS_PROGRAM_PATH, the assignment will be still
considered valid and the program will be attached to a cgroup. Same for "IPEgressFilterPath" path and
"egress" hook.
Note that for socket-activated services, the IP filter programs configured on the socket unit apply to
all sockets associated with it directly, but not to any sockets created by the ultimately activated
services for it. Conversely, the IP filter programs configured for the service are not applied to any
sockets passed into the service via socket activation. Thus, it is usually a good idea, to replicate the
IP filter programs on both the socket and the service unit, however it often makes sense to maintain one
configuration more open and the other one more restricted, depending on the use case.
Note that these settings might not be supported on some systems (for example if eBPF control group
support is not enabled in the underlying kernel or container manager). These settings will fail the
service in that case. If compatibility with such systems is desired it is hence recommended to attach
your filter manually (requires "Delegate""yes") instead of using this setting. Optional. Type uniline.
BPFProgram
"BPFProgram" allows attaching custom BPF programs to the cgroup of a unit. (This generalizes the
functionality exposed via "IPEgressFilterPath" and "IPIngressFilterPath" for other hooks.) Cgroup-bpf
hooks in the form of BPF programs loaded to the BPF filesystem are attached with cgroup-bpf attach flags
determined by the unit. For details about attachment types and flags see "bpf.h"
<https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/plain/include/uapi/linux/bpf.h>. Also
refer to the general BPF documentation <https://docs.kernel.org/bpf/>.
The specification of BPF program consists of a pair of BPF program type and program path in the file
system, with ":" as the separator: type:program-path.
The BPF program type is equivalent to the BPF attach type used in bpftool(8) It may be one of "egress",
"ingress", "sock_create", "sock_ops", "device", "bind4", "bind6", "connect4", "connect6", "post_bind4",
"post_bind6", "sendmsg4", "sendmsg6", "sysctl", "recvmsg4", "recvmsg6", "getsockopt", or "setsockopt".
The specified program path must be an absolute path referencing a BPF program inode in the bpffs file
system (which generally means it must begin with "/sys/fs/bpf/"). If a specified program does not exist
(i.e. has not been uploaded to the BPF subsystem of the kernel yet), it will not be installed but unit
activation will continue (a warning will be printed to the logs).
Setting "BPFProgram" to an empty value makes previous assignments ineffective.
Multiple assignments of the same program type/path pair have the same effect as a single assignment: the
program will be attached just once.
If BPF "egress" pinned to program-path path is already being handled by "IPEgressFilterPath",
"BPFProgram" assignment will be considered valid and "BPFProgram" will be attached to a cgroup.
Similarly for "ingress" hook and "IPIngressFilterPath" assignment.
BPF programs passed with "BPFProgram" are attached to the cgroup of a unit with BPF attach flag "multi",
that allows further attachments of the same type within cgroup hierarchy topped by the unit cgroup.
Examples:
BPFProgram=egress:/sys/fs/bpf/egress-hook
BPFProgram=bind6:/sys/fs/bpf/sock-addr-hook . Optional. Type uniline.
DeviceAllow
Control access to specific device nodes by the executed processes. Takes two space-separated strings: a
device node specifier followed by a combination of "r", "w", "m" to control reading, writing, or creation
of the specific device nodes by the unit (mknod), respectively. This functionality is implemented using
eBPF filtering.
When access to all physical devices should be disallowed, "PrivateDevices" may be used instead. See
systemd.exec(5).
The device node specifier is either a path to a device node in the file system, starting with "/dev/", or
a string starting with either "char-" or "block-" followed by a device group name, as listed in
"/proc/devices". The latter is useful to allow-list all current and future devices belonging to a
specific device group at once. The device group is matched according to filename globbing rules, you may
hence use the "*" and "?" wildcards. (Note that such globbing wildcards are not available for device
node path specifications!) In order to match device nodes by numeric major/minor, use device node paths
in the "/dev/char/" and "/dev/block/" directories. However, matching devices by major/minor is generally
not recommended as assignments are neither stable nor portable between systems or different kernel
versions.
Examples: "/dev/sda5" is a path to a device node, referring to an ATA or SCSI block device. "char-pts"
and "char-alsa" are specifiers for all pseudo TTYs and all ALSA sound devices, respectively. "char-cpu/*"
is a specifier matching all CPU related device groups.
Note that allow lists defined this way should only reference device groups which are resolvable at the
time the unit is started. Any device groups not resolvable then are not added to the device allow list.
In order to work around this limitation, consider extending service units with a pair of
After=modprobe@xyz.service and Wants=modprobe@xyz.service lines that load the necessary kernel module
implementing the device group if missing. Example:
…
[Unit]
Wants=modprobe@loop.service
After=modprobe@loop.service
[Service]
DeviceAllow=block-loop
DeviceAllow=/dev/loop-control
… Optional. Type list of uniline.
DevicePolicy
Control the policy for allowing device access: Optional. Type enum. choice: 'auto', 'closed', 'strict'.
Slice
The name of the slice unit to place the unit in. Defaults to "system.slice" for all non-instantiated
units of all unit types (except for slice units themselves see below). Instance units are by default
placed in a subslice of "system.slice" that is named after the template name.
This option may be used to arrange systemd units in a hierarchy of slices each of which might have
resource settings applied.
For units of type slice, the only accepted value for this setting is the parent slice. Since the name of
a slice unit implies the parent slice, it is hence redundant to ever set this parameter directly for
slice units.
Special care should be taken when relying on the default slice assignment in templated service units that
have "DefaultDependencies=no" set, see systemd.service(5), section "Default Dependencies" for details.
Optional. Type uniline.
Delegate
Turns on delegation of further resource control partitioning to processes of the unit. Units where this
is enabled may create and manage their own private subhierarchy of control groups below the control group
of the unit itself. For unprivileged services (i.e. those using the "User" setting) the unit's control
group will be made accessible to the relevant user.
When enabled the service manager will refrain from manipulating control groups or moving processes below
the unit's control group, so that a clear concept of ownership is established: the control group tree at
the level of the unit's control group and above (i.e. towards the root control group) is owned and
managed by the service manager of the host, while the control group tree below the unit's control group
is owned and managed by the unit itself.
Takes either a boolean argument or a (possibly empty) list of control group controller names. If true,
delegation is turned on, and all supported controllers are enabled for the unit, making them available to
the unit's processes for management. If false, delegation is turned off entirely (and no additional
controllers are enabled). If set to a list of controllers, delegation is turned on, and the specified
controllers are enabled for the unit. Assigning the empty string will enable delegation, but reset the
list of controllers, and all assignments prior to this will have no effect. Note that additional
controllers other than the ones specified might be made available as well, depending on configuration of
the containing slice unit or other units contained in it. Defaults to false.
Note that controller delegation to less privileged code is only safe on the unified control group
hierarchy. Accordingly, access to the specified controllers will not be granted to unprivileged services
on the legacy hierarchy, even when requested.
Not all of these controllers are available on all kernels however, and some are specific to the unified
hierarchy while others are specific to the legacy hierarchy. Also note that the kernel might support
further controllers, which aren't covered here yet as delegation is either not supported at all for them
or not defined cleanly.
Note that because of the hierarchical nature of cgroup hierarchy, any controllers that are delegated will
be enabled for the parent and sibling units of the unit with delegation.
For further details on the delegation model consult Control Group APIs and Delegation
<https://systemd.io/CGROUP_DELEGATION>. Optional. Type uniline.
DelegateSubgroup
Place unit processes in the specified subgroup of the unit's control group. Takes a valid control group
name (not a path!) as parameter, or an empty string to turn this feature off. Defaults to off. The
control group name must be usable as filename and avoid conflicts with the kernel's control group
attribute files (i.e. "cgroup.procs" is not an acceptable name, since the kernel exposes a native control
group attribute file by that name). This option has no effect unless control group delegation is turned
on via "Delegate", see above. Note that this setting only applies to "main" processes of a unit, i.e. for
services to "ExecStart", but not for "ExecReload" and similar. If delegation is enabled, the latter are
always placed inside a subgroup named ".control". The specified subgroup is automatically created (and
potentially ownership is passed to the unit's configured user/group) when a process is started in it.
This option is useful to avoid manually moving the invoked process into a subgroup after it has been
started. Since no processes should live in inner nodes of the control group tree it's almost always
necessary to run the main ("supervising") process of a unit that has delegation turned on in a subgroup.
Optional. Type uniline.
DisableControllers
Disables controllers from being enabled for a unit's children. If a controller listed is already in use
in its subtree, the controller will be removed from the subtree. This can be used to avoid configuration
in child units from being able to implicitly or explicitly enable a controller. Defaults to empty.
Multiple controllers may be specified, separated by spaces. You may also pass "DisableControllers"
multiple times, in which case each new instance adds another controller to disable. Passing
"DisableControllers" by itself with no controller name present resets the disabled controller list.
It may not be possible to disable a controller after units have been started, if the unit or any child of
the unit in question delegates controllers to its children, as any delegated subtree of the cgroup
hierarchy is unmanaged by systemd. Optional. Type uniline.
ManagedOOMSwap
Specifies how systemd-oomd.service(8) will act on this unit's cgroups. Defaults to "auto".
When set to "kill", the unit becomes a candidate for monitoring by systemd-oomd. If the cgroup passes the
limits set by oomd.conf(5) or the unit configuration, systemd-oomd will select a descendant cgroup and
send "SIGKILL" to all of the processes under it. You can find more details on candidates and kill
behavior at systemd-oomd.service(8) and oomd.conf(5).
Setting either of these properties to "kill" will also result in "After" and "Wants" dependencies on
"systemd-oomd.service" unless "DefaultDependencies=no".
When set to "auto", systemd-oomd will not actively use this cgroup's data for monitoring and detection.
However, if an ancestor cgroup has one of these properties set to "kill", a unit with "auto" can still be
a candidate for systemd-oomd to terminate. Optional. Type enum. choice: 'auto', 'kill'.
ManagedOOMMemoryPressure
Specifies how systemd-oomd.service(8) will act on this unit's cgroups. Defaults to "auto".
When set to "kill", the unit becomes a candidate for monitoring by systemd-oomd. If the cgroup passes the
limits set by oomd.conf(5) or the unit configuration, systemd-oomd will select a descendant cgroup and
send "SIGKILL" to all of the processes under it. You can find more details on candidates and kill
behavior at systemd-oomd.service(8) and oomd.conf(5).
Setting either of these properties to "kill" will also result in "After" and "Wants" dependencies on
"systemd-oomd.service" unless "DefaultDependencies=no".
When set to "auto", systemd-oomd will not actively use this cgroup's data for monitoring and detection.
However, if an ancestor cgroup has one of these properties set to "kill", a unit with "auto" can still be
a candidate for systemd-oomd to terminate. Optional. Type enum. choice: 'auto', 'kill'.
ManagedOOMMemoryPressureLimit
Overrides the default memory pressure limit set by oomd.conf(5) for this unit (cgroup). Takes a
percentage value between 0% and 100%, inclusive. This property is ignored unless
"ManagedOOMMemoryPressure""kill". Defaults to 0%, which means to use the default set by oomd.conf(5).
Optional. Type uniline.
ManagedOOMPreference
Allows deprioritizing or omitting this unit's cgroup as a candidate when systemd-oomd needs to act.
Requires support for extended attributes (see xattr(7)) in order to use "avoid" or "omit".
When calculating candidates to relieve swap usage, systemd-oomd will only respect these extended
attributes if the unit's cgroup is owned by root.
When calculating candidates to relieve memory pressure, systemd-oomd will only respect these extended
attributes if the unit's cgroup is owned by root, or if the unit's cgroup owner, and the owner of the
monitored ancestor cgroup are the same. For example, if systemd-oomd is calculating candidates for
"-.slice", then extended attributes set on descendants of
"/user.slice/user-1000.slice/user@1000.service/" will be ignored because the descendants are owned by UID
1000, and "-.slice" is owned by UID 0. But, if calculating candidates for
"/user.slice/user-1000.slice/user@1000.service/", then extended attributes set on the descendants would
be respected.
If this property is set to "avoid", the service manager will convey this to systemd-oomd, which will only
select this cgroup if there are no other viable candidates.
If this property is set to "omit", the service manager will convey this to systemd-oomd, which will
ignore this cgroup as a candidate and will not perform any actions on it.
It is recommended to use "avoid" and "omit" sparingly, as it can adversely affect systemd-oomd's kill
behavior. Also note that these extended attributes are not applied recursively to cgroups under this
unit's cgroup.
Defaults to "none" which means systemd-oomd will rank this unit's cgroup as defined in
systemd-oomd.service(8) and oomd.conf(5). Optional. Type enum. choice: 'avoid', 'none', 'omit'.
MemoryPressureWatch
Controls memory pressure monitoring for invoked processes. Takes one of "off", "on", "auto" or "skip". If
"off" tells the service not to watch for memory pressure events, by setting the $MEMORY_PRESSURE_WATCH
environment variable to the literal string "/dev/null". If "on" tells the service to watch for memory
pressure events. This enables memory accounting for the service, and ensures the "memory.pressure" cgroup
attribute file is accessible for reading and writing by the service's user. It then sets the
$MEMORY_PRESSURE_WATCH environment variable for processes invoked by the unit to the file system path to
this file. The threshold information configured with "MemoryPressureThresholdSec" is encoded in the
$MEMORY_PRESSURE_WRITE environment variable. If the "auto" value is set the protocol is enabled if memory
accounting is anyway enabled for the unit, and disabled otherwise. If set to "skip" the logic is neither
enabled, nor disabled and the two environment variables are not set.
Note that services are free to use the two environment variables, but it's unproblematic if they ignore
them. Memory pressure handling must be implemented individually in each service, and usually means
different things for different software. For further details on memory pressure handling see Memory
Pressure Handling in systemd <https://systemd.io/MEMORY_PRESSURE>.
Services implemented using sd-event(3) may use sd_event_add_memory_pressure(3) to watch for and handle
memory pressure events.
If not explicit set, defaults to the "DefaultMemoryPressureWatch" setting in systemd-system.conf(5).
Optional. Type enum. choice: 'auto', 'off', 'on', 'skip'.
MemoryPressureThresholdSec
Sets the memory pressure threshold time for memory pressure monitor as configured via
"MemoryPressureWatch". Specifies the maximum allocation latency before a memory pressure event is
signalled to the service, per 2s window. If not specified defaults to the
"DefaultMemoryPressureThresholdSec" setting in systemd-system.conf(5) (which in turn defaults to 200ms).
The specified value expects a time unit such as "ms" or "μs", see systemd.time(7) for details on the
permitted syntax. Optional. Type uniline.
CoredumpReceive
Takes a boolean argument. This setting is used to enable coredump forwarding for containers that belong
to this unit's cgroup. Units with "CoredumpReceive=yes" must also be configured with "Delegate=yes".
Defaults to false.
When systemd-coredump is handling a coredump for a process from a container, if the container's leader
process is a descendant of a cgroup with "CoredumpReceive=yes" and "Delegate=yes", then systemd-coredump
will attempt to forward the coredump to systemd-coredump within the container. Optional. Type boolean.
ExecSearchPath
Takes a colon separated list of absolute paths relative to which the executable used by the "Exec*="
(e.g. "ExecStart", "ExecStop", etc.) properties can be found. "ExecSearchPath" overrides $PATH if $PATH
is not supplied by the user through "Environment", "EnvironmentFile" or "PassEnvironment". Assigning an
empty string removes previous assignments and setting "ExecSearchPath" to a value multiple times will
append to the previous setting. Optional. Type list of uniline.
WorkingDirectory
Takes a directory path relative to the service's root directory specified by "RootDirectory", or the
special value "~". Sets the working directory for executed processes. If set to "~", the home directory
of the user specified in "User" is used. If not set, defaults to the root directory when systemd is
running as a system instance and the respective user's home directory if run as user. If the setting is
prefixed with the "-" character, a missing working directory is not considered fatal. If
"RootDirectory"/"RootImage" is not set, then "WorkingDirectory" is relative to the root of the system
running the service manager. Note that setting this parameter might result in additional dependencies to
be added to the unit (see above). Optional. Type uniline.
RootDirectory
Takes a directory path relative to the host's root directory (i.e. the root of the system running the
service manager). Sets the root directory for executed processes, with the pivot_root(2) or chroot(2)
system call. If this is used, it must be ensured that the process binary and all its auxiliary files are
available in the new root. Note that setting this parameter might result in additional dependencies to be
added to the unit (see above).
The "MountAPIVFS" and "PrivateUsers" settings are particularly useful in conjunction with
"RootDirectory". For details, see below.
If "RootDirectory"/"RootImage" are used together with "NotifyAccess" the notification socket is
automatically mounted from the host into the root environment, to ensure the notification interface can
work correctly.
Note that services using "RootDirectory"/"RootImage" will not be able to log via the syslog or journal
protocols to the host logging infrastructure, unless the relevant sockets are mounted from the host,
specifically:
The host's os-release(5) file will be made available for the service (read-only) as
"/run/host/os-release". It will be updated automatically on soft reboot (see:
systemd-soft-reboot.service(8)), in case the service is configured to survive it. Optional. Type
uniline.
RootImage
Takes a path to a block device node or regular file as argument. This call is similar to "RootDirectory"
however mounts a file system hierarchy from a block device node or loopback file instead of a directory.
The device node or file system image file needs to contain a file system without a partition table, or a
file system within an MBR/MS-DOS or GPT partition table with only a single Linux-compatible partition, or
a set of file systems within a GPT partition table that follows the Discoverable Partitions Specification
<https://uapi-group.org/specifications/specs/discoverable_partitions_specification>.
When "DevicePolicy" is set to "closed" or "strict", or set to "auto" and "DeviceAllow" is set, then this
setting adds "/dev/loop-control" with "rw" mode, "block-loop" and "block-blkext" with "rwm" mode to
"DeviceAllow". See systemd.resource-control(5) for the details about "DevicePolicy" or "DeviceAllow".
Also, see "PrivateDevices" below, as it may change the setting of "DevicePolicy".
Units making use of "RootImage" automatically gain an "After" dependency on "systemd-udevd.service".
The host's os-release(5) file will be made available for the service (read-only) as
"/run/host/os-release". It will be updated automatically on soft reboot (see:
systemd-soft-reboot.service(8)), in case the service is configured to survive it. Optional. Type
uniline.
RootImageOptions
Takes a comma-separated list of mount options that will be used on disk images specified by "RootImage".
Optionally a partition name can be prefixed, followed by colon, in case the image has multiple
partitions, otherwise partition name "root" is implied. Options for multiple partitions can be specified
in a single line with space separators. Assigning an empty string removes previous assignments.
Duplicated options are ignored. For a list of valid mount options, please refer to mount(8).
Valid partition names follow the Discoverable Partitions Specification <https://uapi-
group.org/specifications/specs/discoverable_partitions_specification>: "root", "usr", "home", "srv",
"esp", "xbootldr", "tmp", "var". Optional. Type uniline.
RootEphemeral
Takes a boolean argument. If enabled, executed processes will run in an ephemeral copy of the root
directory or root image. The ephemeral copy is placed in "/var/lib/systemd/ephemeral-trees/" while the
service is active and is cleaned up when the service is stopped or restarted. If "RootDirectory" is used
and the root directory is a subvolume, the ephemeral copy will be created by making a snapshot of the
subvolume.
To make sure making ephemeral copies can be made efficiently, the root directory or root image should be
located on the same filesystem as "/var/lib/systemd/ephemeral-trees/". When using "RootEphemeral" with
root directories, btrfs(5) should be used as the filesystem and the root directory should ideally be a
subvolume which systemd can snapshot to make the ephemeral copy. For root images, a filesystem with
support for reflinks should be used to ensure an efficient ephemeral copy. Optional. Type boolean.
RootHash
Takes a data integrity (dm-verity) root hash specified in hexadecimal, or the path to a file containing a
root hash in ASCII hexadecimal format. This option enables data integrity checks using dm-verity, if the
used image contains the appropriate integrity data (see above) or if "RootVerity" is used. The specified
hash must match the root hash of integrity data, and is usually at least 256 bits (and hence 64 formatted
hexadecimal characters) long (in case of SHA256 for example). If this option is not specified, but the
image file carries the "user.verity.roothash" extended file attribute (see xattr(7)), then the root hash
is read from it, also as formatted hexadecimal characters. If the extended file attribute is not found
(or is not supported by the underlying file system), but a file with the ".roothash" suffix is found next
to the image file, bearing otherwise the same name (except if the image has the ".raw" suffix, in which
case the root hash file must not have it in its name), the root hash is read from it and automatically
used, also as formatted hexadecimal characters.
If the disk image contains a separate "/usr/" partition it may also be Verity protected, in which case
the root hash may configured via an extended attribute "user.verity.usrhash" or a ".usrhash" file
adjacent to the disk image. There's currently no option to configure the root hash for the "/usr/" file
system via the unit file directly. Optional. Type uniline.
RootHashSignature
Takes a PKCS7 signature of the "RootHash" option as a path to a DER-encoded signature file, or as an
ASCII base64 string encoding of a DER-encoded signature prefixed by "base64:". The dm-verity volume will
only be opened if the signature of the root hash is valid and signed by a public key present in the
kernel keyring. If this option is not specified, but a file with the ".roothash.p7s" suffix is found next
to the image file, bearing otherwise the same name (except if the image has the ".raw" suffix, in which
case the signature file must not have it in its name), the signature is read from it and automatically
used.
If the disk image contains a separate "/usr/" partition it may also be Verity protected, in which case
the signature for the root hash may configured via a ".usrhash.p7s" file adjacent to the disk image.
There's currently no option to configure the root hash signature for the "/usr/" via the unit file
directly. Optional. Type uniline.
RootVerity
Takes the path to a data integrity (dm-verity) file. This option enables data integrity checks using dm-
verity, if "RootImage" is used and a root-hash is passed and if the used image itself does not contain
the integrity data. The integrity data must be matched by the root hash. If this option is not specified,
but a file with the ".verity" suffix is found next to the image file, bearing otherwise the same name
(except if the image has the ".raw" suffix, in which case the verity data file must not have it in its
name), the verity data is read from it and automatically used.
This option is supported only for disk images that contain a single file system, without an enveloping
partition table. Images that contain a GPT partition table should instead include both root file system
and matching Verity data in the same image, implementing the Discoverable Partitions Specification
<https://uapi-group.org/specifications/specs/discoverable_partitions_specification>. Optional. Type
uniline.
RootImagePolicy
Takes an image policy string as per systemd.image-policy(7) to use when mounting the disk images (DDI)
specified in "RootImage", "MountImage", "ExtensionImage", respectively. If not specified the following
policy string is the default for "RootImagePolicy" and "MountImagePolicy":
root=verity+signed+encrypted+unprotected+absent: \
usr=verity+signed+encrypted+unprotected+absent: \
home=encrypted+unprotected+absent: \
srv=encrypted+unprotected+absent: \
tmp=encrypted+unprotected+absent: \
var=encrypted+unprotected+absent
The default policy for "ExtensionImagePolicy" is:
root=verity+signed+encrypted+unprotected+absent: \
usr=verity+signed+encrypted+unprotected+absent
. I< Optional. Type uniline. >
MountImagePolicy
Takes an image policy string as per systemd.image-policy(7) to use when mounting the disk images (DDI)
specified in "RootImage", "MountImage", "ExtensionImage", respectively. If not specified the following
policy string is the default for "RootImagePolicy" and "MountImagePolicy":
root=verity+signed+encrypted+unprotected+absent: \
usr=verity+signed+encrypted+unprotected+absent: \
home=encrypted+unprotected+absent: \
srv=encrypted+unprotected+absent: \
tmp=encrypted+unprotected+absent: \
var=encrypted+unprotected+absent
The default policy for "ExtensionImagePolicy" is:
root=verity+signed+encrypted+unprotected+absent: \
usr=verity+signed+encrypted+unprotected+absent
. I< Optional. Type uniline. >
ExtensionImagePolicy
Takes an image policy string as per systemd.image-policy(7) to use when mounting the disk images (DDI)
specified in "RootImage", "MountImage", "ExtensionImage", respectively. If not specified the following
policy string is the default for "RootImagePolicy" and "MountImagePolicy":
root=verity+signed+encrypted+unprotected+absent: \
usr=verity+signed+encrypted+unprotected+absent: \
home=encrypted+unprotected+absent: \
srv=encrypted+unprotected+absent: \
tmp=encrypted+unprotected+absent: \
var=encrypted+unprotected+absent
The default policy for "ExtensionImagePolicy" is:
root=verity+signed+encrypted+unprotected+absent: \
usr=verity+signed+encrypted+unprotected+absent
. I< Optional. Type uniline. >
MountAPIVFS
Takes a boolean argument. If on, a private mount namespace for the unit's processes is created and the
API file systems "/proc/", "/sys/", "/dev/" and "/run/" (as an empty "tmpfs") are mounted inside of it,
unless they are already mounted. Note that this option has no effect unless used in conjunction with
"RootDirectory"/"RootImage" as these four mounts are generally mounted in the host anyway, and unless the
root directory is changed, the private mount namespace will be a 1:1 copy of the host's, and include
these four mounts. Note that the "/dev/" file system of the host is bind mounted if this option is used
without "PrivateDevices". To run the service with a private, minimal version of "/dev/", combine this
option with "PrivateDevices".
In order to allow propagating mounts at runtime in a safe manner, "/run/systemd/propagate/" on the host
will be used to set up new mounts, and "/run/host/incoming/" in the private namespace will be used as an
intermediate step to store them before being moved to the final mount point. Optional. Type boolean.
ProtectProc
Takes one of "noaccess", "invisible", "ptraceable" or "default" (which it defaults to). When set, this
controls the "hidepid=" mount option of the "procfs" instance for the unit that controls which
directories with process metainformation ("/proc/PID") are visible and accessible: when set to "noaccess"
the ability to access most of other users' process metadata in "/proc/" is taken away for processes of
the service. When set to "invisible" processes owned by other users are hidden from "/proc/". If
"ptraceable" all processes that cannot be ptrace()'ed by a process are hidden to it. If "default" no
restrictions on "/proc/" access or visibility are made. For further details see The /proc Filesystem
<https://docs.kernel.org/filesystems/proc.html#mount-options>. It is generally recommended to run most
system services with this option set to "invisible". This option is implemented via file system
namespacing, and thus cannot be used with services that shall be able to install mount points in the host
file system hierarchy. Note that the root user is unaffected by this option, so to be effective it has to
be used together with "User" or "DynamicUser=yes", and also without the "CAP_SYS_PTRACE" capability,
which also allows a process to bypass this feature. It cannot be used for services that need to access
metainformation about other users' processes. This option implies "MountAPIVFS".
If the kernel doesn't support per-mount point "hidepid=" mount options this setting remains without
effect, and the unit's processes will be able to access and see other process as if the option was not
used. Optional. Type enum. choice: 'default', 'invisible', 'noaccess', 'ptraceable'.
ProcSubset
Takes one of "all" (the default) and "pid". If "pid", all files and directories not directly associated
with process management and introspection are made invisible in the "/proc/" file system configured for
the unit's processes. This controls the "subset=" mount option of the "procfs" instance for the unit. For
further details see The /proc Filesystem <https://docs.kernel.org/filesystems/proc.html#mount-options>.
Note that Linux exposes various kernel APIs via "/proc/", which are made unavailable with this setting.
Since these APIs are used frequently this option is useful only in a few, specific cases, and is not
suitable for most non-trivial programs.
Much like "ProtectProc" above, this is implemented via file system mount namespacing, and hence the same
restrictions apply: it is only available to system services, it disables mount propagation to the host
mount table, and it implies "MountAPIVFS". Also, like "ProtectProc" this setting is gracefully disabled
if the used kernel does not support the "subset=" mount option of "procfs". Optional. Type enum. choice:
'all', 'pid'.
BindPaths
Configures unit-specific bind mounts. A bind mount makes a particular file or directory available at an
additional place in the unit's view of the file system. Any bind mounts created with this option are
specific to the unit, and are not visible in the host's mount table. This option expects a whitespace
separated list of bind mount definitions. Each definition consists of a colon-separated triple of source
path, destination path and option string, where the latter two are optional. If only a source path is
specified the source and destination is taken to be the same. The option string may be either "rbind" or
"norbind" for configuring a recursive or non-recursive bind mount. If the destination path is omitted,
the option string must be omitted too. Each bind mount definition may be prefixed with "-", in which
case it will be ignored when its source path does not exist.
"BindPaths" creates regular writable bind mounts (unless the source file system mount is already marked
read-only), while "BindReadOnlyPaths" creates read-only bind mounts. These settings may be used more than
once, each usage appends to the unit's list of bind mounts. If the empty string is assigned to either of
these two options the entire list of bind mounts defined prior to this is reset. Note that in this case
both read-only and regular bind mounts are reset, regardless which of the two settings is used.
Using this option implies that a mount namespace is allocated for the unit, i.e. it implies the effect of
"PrivateMounts" (see below).
This option is particularly useful when "RootDirectory"/"RootImage" is used. In this case the source path
refers to a path on the host file system, while the destination path refers to a path below the root
directory of the unit.
Note that the destination directory must exist or systemd must be able to create it. Thus, it is not
possible to use those options for mount points nested underneath paths specified in "InaccessiblePaths",
or under "/home/" and other protected directories if "ProtectHome=yes" is specified.
"TemporaryFileSystem" with ":ro" or "ProtectHome=tmpfs" should be used instead. Optional. Type list of
uniline.
BindReadOnlyPaths
Configures unit-specific bind mounts. A bind mount makes a particular file or directory available at an
additional place in the unit's view of the file system. Any bind mounts created with this option are
specific to the unit, and are not visible in the host's mount table. This option expects a whitespace
separated list of bind mount definitions. Each definition consists of a colon-separated triple of source
path, destination path and option string, where the latter two are optional. If only a source path is
specified the source and destination is taken to be the same. The option string may be either "rbind" or
"norbind" for configuring a recursive or non-recursive bind mount. If the destination path is omitted,
the option string must be omitted too. Each bind mount definition may be prefixed with "-", in which
case it will be ignored when its source path does not exist.
"BindPaths" creates regular writable bind mounts (unless the source file system mount is already marked
read-only), while "BindReadOnlyPaths" creates read-only bind mounts. These settings may be used more than
once, each usage appends to the unit's list of bind mounts. If the empty string is assigned to either of
these two options the entire list of bind mounts defined prior to this is reset. Note that in this case
both read-only and regular bind mounts are reset, regardless which of the two settings is used.
Using this option implies that a mount namespace is allocated for the unit, i.e. it implies the effect of
"PrivateMounts" (see below).
This option is particularly useful when "RootDirectory"/"RootImage" is used. In this case the source path
refers to a path on the host file system, while the destination path refers to a path below the root
directory of the unit.
Note that the destination directory must exist or systemd must be able to create it. Thus, it is not
possible to use those options for mount points nested underneath paths specified in "InaccessiblePaths",
or under "/home/" and other protected directories if "ProtectHome=yes" is specified.
"TemporaryFileSystem" with ":ro" or "ProtectHome=tmpfs" should be used instead. Optional. Type list of
uniline.
MountImages
This setting is similar to "RootImage" in that it mounts a file system hierarchy from a block device node
or loopback file, but the destination directory can be specified as well as mount options. This option
expects a whitespace separated list of mount definitions. Each definition consists of a colon-separated
tuple of source path and destination definitions, optionally followed by another colon and a list of
mount options.
Mount options may be defined as a single comma-separated list of options, in which case they will be
implicitly applied to the root partition on the image, or a series of colon-separated tuples of partition
name and mount options. Valid partition names and mount options are the same as for "RootImageOptions"
setting described above.
Each mount definition may be prefixed with "-", in which case it will be ignored when its source path
does not exist. The source argument is a path to a block device node or regular file. If source or
destination contain a ":", it needs to be escaped as "\:". The device node or file system image file
needs to follow the same rules as specified for "RootImage". Any mounts created with this option are
specific to the unit, and are not visible in the host's mount table.
These settings may be used more than once, each usage appends to the unit's list of mount paths. If the
empty string is assigned, the entire list of mount paths defined prior to this is reset.
Note that the destination directory must exist or systemd must be able to create it. Thus, it is not
possible to use those options for mount points nested underneath paths specified in "InaccessiblePaths",
or under "/home/" and other protected directories if "ProtectHome=yes" is specified.
When "DevicePolicy" is set to "closed" or "strict", or set to "auto" and "DeviceAllow" is set, then this
setting adds "/dev/loop-control" with "rw" mode, "block-loop" and "block-blkext" with "rwm" mode to
"DeviceAllow". See systemd.resource-control(5) for the details about "DevicePolicy" or "DeviceAllow".
Also, see "PrivateDevices" below, as it may change the setting of "DevicePolicy". Optional. Type list of
uniline.
ExtensionImages
This setting is similar to "MountImages" in that it mounts a file system hierarchy from a block device
node or loopback file, but instead of providing a destination path, an overlay will be set up. This
option expects a whitespace separated list of mount definitions. Each definition consists of a source
path, optionally followed by a colon and a list of mount options.
A read-only OverlayFS will be set up on top of "/usr/" and "/opt/" hierarchies for sysext images and
"/etc/" hierarchy for confext images. The order in which the images are listed will determine the order
in which the overlay is laid down: images specified first to last will result in overlayfs layers bottom
to top.
Mount options may be defined as a single comma-separated list of options, in which case they will be
implicitly applied to the root partition on the image, or a series of colon-separated tuples of partition
name and mount options. Valid partition names and mount options are the same as for "RootImageOptions"
setting described above.
Each mount definition may be prefixed with "-", in which case it will be ignored when its source path
does not exist. The source argument is a path to a block device node or regular file. If the source path
contains a ":", it needs to be escaped as "\:". The device node or file system image file needs to follow
the same rules as specified for "RootImage". Any mounts created with this option are specific to the
unit, and are not visible in the host's mount table.
These settings may be used more than once, each usage appends to the unit's list of image paths. If the
empty string is assigned, the entire list of mount paths defined prior to this is reset.
Each sysext image must carry a "/usr/lib/extension-release.d/extension-release.IMAGE" file while each
confext image must carry a "/etc/extension-release.d/extension-release.IMAGE" file, with the appropriate
metadata which matches "RootImage"/"RootDirectory" or the host. See: os-release(5). To disable the
safety check that the extension-release file name matches the image file name, the
"x-systemd.relax-extension-release-check" mount option may be appended.
When "DevicePolicy" is set to "closed" or "strict", or set to "auto" and "DeviceAllow" is set, then this
setting adds "/dev/loop-control" with "rw" mode, "block-loop" and "block-blkext" with "rwm" mode to
"DeviceAllow". See systemd.resource-control(5) for the details about "DevicePolicy" or "DeviceAllow".
Also, see "PrivateDevices" below, as it may change the setting of "DevicePolicy". Optional. Type list of
uniline.
ExtensionDirectories
This setting is similar to "BindReadOnlyPaths" in that it mounts a file system hierarchy from a
directory, but instead of providing a destination path, an overlay will be set up. This option expects a
whitespace separated list of source directories.
A read-only OverlayFS will be set up on top of "/usr/" and "/opt/" hierarchies for sysext images and
"/etc/" hierarchy for confext images. The order in which the directories are listed will determine the
order in which the overlay is laid down: directories specified first to last will result in overlayfs
layers bottom to top.
Each directory listed in "ExtensionDirectories" may be prefixed with "-", in which case it will be
ignored when its source path does not exist. Any mounts created with this option are specific to the
unit, and are not visible in the host's mount table.
These settings may be used more than once, each usage appends to the unit's list of directories paths. If
the empty string is assigned, the entire list of mount paths defined prior to this is reset.
Each sysext directory must contain a "/usr/lib/extension-release.d/extension-release.IMAGE" file while
each confext directory must carry a "/etc/extension-release.d/extension-release.IMAGE" file, with the
appropriate metadata which matches "RootImage"/"RootDirectory" or the host. See: os-release(5).
Note that usage from user units requires overlayfs support in unprivileged user namespaces, which was
first introduced in kernel v5.11. Optional. Type list of uniline.
User
Set the UNIX user or group that the processes are executed as, respectively. Takes a single user or group
name, or a numeric ID as argument. For system services (services run by the system service manager, i.e.
managed by PID 1) and for user services of the root user (services managed by root's instance of systemd
--user), the default is "root", but "User" may be used to specify a different user. For user services of
any other user, switching user identity is not permitted, hence the only valid setting is the same user
the user's service manager is running as. If no group is set, the default group of the user is used. This
setting does not affect commands whose command line is prefixed with "+".
Note that this enforces only weak restrictions on the user/group name syntax, but will generate warnings
in many cases where user/group names do not adhere to the following rules: the specified name should
consist only of the characters a-z, A-Z, 0-9, "_" and "-", except for the first character which must be
one of a-z, A-Z and "_" (i.e. digits and "-" are not permitted as first character). The user/group name
must have at least one character, and at most 31. These restrictions are made in order to avoid
ambiguities and to ensure user/group names and unit files remain portable among Linux systems. For
further details on the names accepted and the names warned about see User/Group Name Syntax
<https://systemd.io/USER_NAMES>.
When used in conjunction with "DynamicUser" the user/group name specified is dynamically allocated at the
time the service is started, and released at the time the service is stopped — unless it is already
allocated statically (see below). If "DynamicUser" is not used the specified user and group must have
been created statically in the user database no later than the moment the service is started, for example
using the sysusers.d(5) facility, which is applied at boot or package install time. If the user does not
exist by then program invocation will fail.
If the "User" setting is used the supplementary group list is initialized from the specified user's
default group list, as defined in the system's user and group database. Additional groups may be
configured through the "SupplementaryGroups" setting (see below). Optional. Type uniline.
Group
Set the UNIX user or group that the processes are executed as, respectively. Takes a single user or group
name, or a numeric ID as argument. For system services (services run by the system service manager, i.e.
managed by PID 1) and for user services of the root user (services managed by root's instance of systemd
--user), the default is "root", but "User" may be used to specify a different user. For user services of
any other user, switching user identity is not permitted, hence the only valid setting is the same user
the user's service manager is running as. If no group is set, the default group of the user is used. This
setting does not affect commands whose command line is prefixed with "+".
Note that this enforces only weak restrictions on the user/group name syntax, but will generate warnings
in many cases where user/group names do not adhere to the following rules: the specified name should
consist only of the characters a-z, A-Z, 0-9, "_" and "-", except for the first character which must be
one of a-z, A-Z and "_" (i.e. digits and "-" are not permitted as first character). The user/group name
must have at least one character, and at most 31. These restrictions are made in order to avoid
ambiguities and to ensure user/group names and unit files remain portable among Linux systems. For
further details on the names accepted and the names warned about see User/Group Name Syntax
<https://systemd.io/USER_NAMES>.
When used in conjunction with "DynamicUser" the user/group name specified is dynamically allocated at the
time the service is started, and released at the time the service is stopped — unless it is already
allocated statically (see below). If "DynamicUser" is not used the specified user and group must have
been created statically in the user database no later than the moment the service is started, for example
using the sysusers.d(5) facility, which is applied at boot or package install time. If the user does not
exist by then program invocation will fail.
If the "User" setting is used the supplementary group list is initialized from the specified user's
default group list, as defined in the system's user and group database. Additional groups may be
configured through the "SupplementaryGroups" setting (see below). Optional. Type uniline.
DynamicUser
Takes a boolean parameter. If set, a UNIX user and group pair is allocated dynamically when the unit is
started, and released as soon as it is stopped. The user and group will not be added to "/etc/passwd" or
"/etc/group", but are managed transiently during runtime. The nss-systemd(8) glibc NSS module provides
integration of these dynamic users/groups into the system's user and group databases. The user and group
name to use may be configured via "User" and "Group" (see above). If these options are not used and
dynamic user/group allocation is enabled for a unit, the name of the dynamic user/group is implicitly
derived from the unit name. If the unit name without the type suffix qualifies as valid user name it is
used directly, otherwise a name incorporating a hash of it is used. If a statically allocated user or
group of the configured name already exists, it is used and no dynamic user/group is allocated. Note that
if "User" is specified and the static group with the name exists, then it is required that the static
user with the name already exists. Similarly, if "Group" is specified and the static user with the name
exists, then it is required that the static group with the name already exists. Dynamic users/groups are
allocated from the UID/GID range 61184…65519. It is recommended to avoid this range for regular system or
login users. At any point in time each UID/GID from this range is only assigned to zero or one
dynamically allocated users/groups in use. However, UID/GIDs are recycled after a unit is terminated.
Care should be taken that any processes running as part of a unit for which dynamic users/groups are
enabled do not leave files or directories owned by these users/groups around, as a different unit might
get the same UID/GID assigned later on, and thus gain access to these files or directories. If
"DynamicUser" is enabled, "RemoveIPC" and "PrivateTmp" are implied (and cannot be turned off). This
ensures that the lifetime of IPC objects and temporary files created by the executed processes is bound
to the runtime of the service, and hence the lifetime of the dynamic user/group. Since "/tmp/" and
"/var/tmp/" are usually the only world-writable directories on a system this ensures that a unit making
use of dynamic user/group allocation cannot leave files around after unit termination. Furthermore
"NoNewPrivileges" and "RestrictSUIDSGID" are implicitly enabled (and cannot be disabled), to ensure that
processes invoked cannot take benefit or create SUID/SGID files or directories. Moreover
"ProtectSystem=strict" and "ProtectHome=read-only" are implied, thus prohibiting the service to write to
arbitrary file system locations. In order to allow the service to write to certain directories, they have
to be allow-listed using "ReadWritePaths", but care must be taken so that UID/GID recycling doesn't
create security issues involving files created by the service. Use "RuntimeDirectory" (see below) in
order to assign a writable runtime directory to a service, owned by the dynamic user/group and removed
automatically when the unit is terminated. Use "StateDirectory", "CacheDirectory" and "LogsDirectory" in
order to assign a set of writable directories for specific purposes to the service in a way that they are
protected from vulnerabilities due to UID reuse (see below). If this option is enabled, care should be
taken that the unit's processes do not get access to directories outside of these explicitly configured
and managed ones. Specifically, do not use "BindPaths" and be careful with "AF_UNIX" file descriptor
passing for directory file descriptors, as this would permit processes to create files or directories
owned by the dynamic user/group that are not subject to the lifecycle and access guarantees of the
service. Note that this option is currently incompatible with D-Bus policies, thus a service using this
option may currently not allocate a D-Bus service name (note that this does not affect calling into other
D-Bus services). Defaults to off. Optional. Type boolean.
SupplementaryGroups
Sets the supplementary Unix groups the processes are executed as. This takes a space-separated list of
group names or IDs. This option may be specified more than once, in which case all listed groups are set
as supplementary groups. When the empty string is assigned, the list of supplementary groups is reset,
and all assignments prior to this one will have no effect. In any way, this option does not override, but
extends the list of supplementary groups configured in the system group database for the user. This does
not affect commands prefixed with "+". Optional. Type list of uniline.
SetLoginEnvironment
Takes a boolean parameter that controls whether to set the $HOME, $LOGNAME, and $SHELL environment
variables. If not set, this defaults to true if "User", "DynamicUser" or "PAMName" are set, false
otherwise. If set to true, the variables will always be set for system services, i.e. even when the
default user "root" is used. If set to false, the mentioned variables are not set by the service manager,
no matter whether "User", "DynamicUser", or "PAMName" are used or not. This option normally has no effect
on services of the per-user service manager, since in that case these variables are typically inherited
from user manager's own environment anyway. Optional. Type boolean.
PAMName
Sets the PAM service name to set up a session as. If set, the executed process will be registered as a
PAM session under the specified service name. This is only useful in conjunction with the "User" setting,
and is otherwise ignored. If not set, no PAM session will be opened for the executed processes. See
pam(8) for details.
Note that for each unit making use of this option a PAM session handler process will be maintained as
part of the unit and stays around as long as the unit is active, to ensure that appropriate actions can
be taken when the unit and hence the PAM session terminates. This process is named "(sd-pam)" and is an
immediate child process of the unit's main process.
Note that when this option is used for a unit it is very likely (depending on PAM configuration) that the
main unit process will be migrated to its own session scope unit when it is activated. This process will
hence be associated with two units: the unit it was originally started from (and for which "PAMName" was
configured), and the session scope unit. Any child processes of that process will however be associated
with the session scope unit only. This has implications when used in combination with
"NotifyAccess""all", as these child processes will not be able to affect changes in the original unit
through notification messages. These messages will be considered belonging to the session scope unit and
not the original unit. It is hence not recommended to use "PAMName" in combination with
"NotifyAccess""all". Optional. Type uniline.
CapabilityBoundingSet
Controls which capabilities to include in the capability bounding set for the executed process. See
capabilities(7) for details. Takes a whitespace-separated list of capability names, e.g. "CAP_SYS_ADMIN",
"CAP_DAC_OVERRIDE", "CAP_SYS_PTRACE". Capabilities listed will be included in the bounding set, all
others are removed. If the list of capabilities is prefixed with "~", all but the listed capabilities
will be included, the effect of the assignment inverted. Note that this option also affects the
respective capabilities in the effective, permitted and inheritable capability sets. If this option is
not used, the capability bounding set is not modified on process execution, hence no limits on the
capabilities of the process are enforced. This option may appear more than once, in which case the
bounding sets are merged by "OR", or by "AND" if the lines are prefixed with "~" (see below). If the
empty string is assigned to this option, the bounding set is reset to the empty capability set, and all
prior settings have no effect. If set to "~" (without any further argument), the bounding set is reset to
the full set of available capabilities, also undoing any previous settings. This does not affect commands
prefixed with "+".
Use systemd-analyze(1)'s capability command to retrieve a list of capabilities defined on the local
system.
Example: if a unit has the following,
CapabilityBoundingSet=CAP_A CAP_B
CapabilityBoundingSet=CAP_B CAP_C
then "CAP_A", "CAP_B", and "CAP_C" are set. If the second line is prefixed with "~", e.g.,
CapabilityBoundingSet=CAP_A CAP_B
CapabilityBoundingSet=~CAP_B CAP_C
then, only "CAP_A" is set. Optional. Type uniline.
AmbientCapabilities
Controls which capabilities to include in the ambient capability set for the executed process. Takes a
whitespace-separated list of capability names, e.g. "CAP_SYS_ADMIN", "CAP_DAC_OVERRIDE",
"CAP_SYS_PTRACE". This option may appear more than once, in which case the ambient capability sets are
merged (see the above examples in "CapabilityBoundingSet"). If the list of capabilities is prefixed with
"~", all but the listed capabilities will be included, the effect of the assignment inverted. If the
empty string is assigned to this option, the ambient capability set is reset to the empty capability set,
and all prior settings have no effect. If set to "~" (without any further argument), the ambient
capability set is reset to the full set of available capabilities, also undoing any previous settings.
Note that adding capabilities to the ambient capability set adds them to the process's inherited
capability set.
Ambient capability sets are useful if you want to execute a process as a non-privileged user but still
want to give it some capabilities. Note that in this case option "keep-caps" is automatically added to
"SecureBits" to retain the capabilities over the user change. "AmbientCapabilities" does not affect
commands prefixed with "+". Optional. Type uniline.
NoNewPrivileges
Takes a boolean argument. If true, ensures that the service process and all its children can never gain
new privileges through execve() (e.g. via setuid or setgid bits, or filesystem capabilities). This is the
simplest and most effective way to ensure that a process and its children can never elevate privileges
again. Defaults to false. In case the service will be run in a new mount namespace anyway and SELinux is
disabled, all file systems are mounted with "MS_NOSUID" flag. Also see No New Privileges Flag
<https://docs.kernel.org/userspace-api/no_new_privs.html>.
Note that this setting only has an effect on the unit's processes themselves (or any processes directly
or indirectly forked off them). It has no effect on processes potentially invoked on request of them
through tools such as at(1), crontab(1), systemd-run(1), or arbitrary IPC services. Optional. Type
boolean.
SecureBits
Controls the secure bits set for the executed process. Takes a space-separated combination of options
from the following list: "keep-caps", "keep-caps-locked", "no-setuid-fixup", "no-setuid-fixup-locked",
"noroot", and "noroot-locked". This option may appear more than once, in which case the secure bits are
ORed. If the empty string is assigned to this option, the bits are reset to 0. This does not affect
commands prefixed with "+". See capabilities(7) for details. Optional. Type uniline.
SELinuxContext
Set the SELinux security context of the executed process. If set, this will override the automated domain
transition. However, the policy still needs to authorize the transition. This directive is ignored if
SELinux is disabled. If prefixed by "-", failing to set the SELinux security context will be ignored, but
it's still possible that the subsequent execve() may fail if the policy doesn't allow the transition for
the non-overridden context. This does not affect commands prefixed with "+". See setexeccon(3) for
details. Optional. Type uniline.
AppArmorProfile
Takes a profile name as argument. The process executed by the unit will switch to this profile when
started. Profiles must already be loaded in the kernel, or the unit will fail. If prefixed by "-", all
errors will be ignored. This setting has no effect if AppArmor is not enabled. This setting does not
affect commands prefixed with "+". Optional. Type uniline.
SmackProcessLabel
Takes a "SMACK64" security label as argument. The process executed by the unit will be started under this
label and SMACK will decide whether the process is allowed to run or not, based on it. The process will
continue to run under the label specified here unless the executable has its own "SMACK64EXEC" label, in
which case the process will transition to run under that label. When not specified, the label that
systemd is running under is used. This directive is ignored if SMACK is disabled.
The value may be prefixed by "-", in which case all errors will be ignored. An empty value may be
specified to unset previous assignments. This does not affect commands prefixed with "+". Optional. Type
uniline.
LimitCPU
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitFSIZE
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitDATA
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitSTACK
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitCORE
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitRSS
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitNOFILE
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitAS
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitNPROC
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitMEMLOCK
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitLOCKS
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitSIGPENDING
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitMSGQUEUE
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitNICE
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitRTPRIO
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
LimitRTTIME
Set soft and hard limits on various resources for executed processes. See setrlimit(2) for details on the
process resource limit concept. Process resource limits may be specified in two formats: either as single
value to set a specific soft and hard limit to the same value, or as colon-separated pair "soft:hard" to
set both limits individually (e.g. "LimitAS=4G:16G"). Use the string "infinity" to configure no limit on
a specific resource. The multiplicative suffixes K, M, G, T, P and E (to the base 1024) may be used for
resource limits measured in bytes (e.g. "LimitAS=16G"). For the limits referring to time values, the
usual time units ms, s, min, h and so on may be used (see systemd.time(7) for details). Note that if no
time unit is specified for "LimitCPU" the default unit of seconds is implied, while for "LimitRTTIME" the
default unit of microseconds is implied. Also, note that the effective granularity of the limits might
influence their enforcement. For example, time limits specified for "LimitCPU" will be rounded up
implicitly to multiples of 1s. For "LimitNICE" the value may be specified in two syntaxes: if prefixed
with "+" or "-", the value is understood as regular Linux nice value in the range -20…19. If not prefixed
like this the value is understood as raw resource limit parameter in the range 0…40 (with 0 being
equivalent to 1).
Note that most process resource limits configured with these options are per-process, and processes may
fork in order to acquire a new set of resources that are accounted independently of the original process,
and may thus escape limits set. Also note that "LimitRSS" is not implemented on Linux, and setting it has
no effect. Often it is advisable to prefer the resource controls listed in systemd.resource-control(5)
over these per-process limits, as they apply to services as a whole, may be altered dynamically at
runtime, and are generally more expressive. For example, "MemoryMax" is a more powerful (and working)
replacement for "LimitRSS".
Note that "LimitNPROC" will limit the number of processes from one (real) UID and not the number of
processes started (forked) by the service. Therefore the limit is cumulative for all processes running
under the same UID. Please also note that the "LimitNPROC" will not be enforced if the service is running
as root (and not dropping privileges). Due to these limitations, "TasksMax" (see
systemd.resource-control(5)) is typically a better choice than "LimitNPROC".
Resource limits not configured explicitly for a unit default to the value configured in the various
"DefaultLimitCPU", "DefaultLimitFSIZE", … options available in systemd-system.conf(5), and – if not
configured there – the kernel or per-user defaults, as defined by the OS (the latter only for user
services, see below).
For system units these resource limits may be chosen freely. When these settings are configured in a user
service (i.e. a service run by the per-user instance of the service manager) they cannot be used to raise
the limits above those set for the user manager itself when it was first invoked, as the user's service
manager generally lacks the privileges to do so. In user context these configuration options are hence
only useful to lower the limits passed in or to raise the soft limit to the maximum of the hard limit as
configured for the user. To raise the user's limits further, the available configuration mechanisms
differ between operating systems, but typically require privileges. In most cases it is possible to
configure higher per-user resource limits via PAM or by setting limits on the system service
encapsulating the user's service manager, i.e. the user's instance of "user@.service". After making such
changes, make sure to restart the user's service manager. Optional. Type uniline.
UMask
Controls the file mode creation mask. Takes an access mode in octal notation. See umask(2) for details.
Defaults to 0022 for system units. For user units the default value is inherited from the per-user
service manager (whose default is in turn inherited from the system service manager, and thus typically
also is 0022 — unless overridden by a PAM module). In order to change the per-user mask for all user
services, consider setting the "UMask" setting of the user's "user@.service" system service instance. The
per-user umask may also be set via the "umask" field of a user's JSON User Record
<https://systemd.io/USER_RECORD> (for users managed by systemd-homed.service(8) this field may be
controlled via homectl --umask=). It may also be set via a PAM module, such as pam_umask(8). Optional.
Type uniline.
CoredumpFilter
Controls which types of memory mappings will be saved if the process dumps core (using the
"/proc/pid/coredump_filter" file). Takes a whitespace-separated combination of mapping type names or
numbers (with the default base 16). Mapping type names are "private-anonymous", "shared-anonymous",
"private-file-backed", "shared-file-backed", "elf-headers", "private-huge", "shared-huge", "private-dax",
"shared-dax", and the special values "all" (all types) and "default" (the kernel default of
"private-anonymous""shared-anonymous" "elf-headers""private-huge"). See core(5) for the meaning of the
mapping types. When specified multiple times, all specified masks are ORed. When not set, or if the empty
value is assigned, the inherited value is not changed. Optional. Type uniline.
KeyringMode
Controls how the kernel session keyring is set up for the service (see session-keyring(7) for details on
the session keyring). Takes one of "inherit", "private", "shared". If set to "inherit" no special keyring
setup is done, and the kernel's default behaviour is applied. If "private" is used a new session keyring
is allocated when a service process is invoked, and it is not linked up with any user keyring. This is
the recommended setting for system services, as this ensures that multiple services running under the
same system user ID (in particular the root user) do not share their key material among each other. If
"shared" is used a new session keyring is allocated as for "private", but the user keyring of the user
configured with "User" is linked into it, so that keys assigned to the user may be requested by the
unit's processes. In this mode multiple units running processes under the same user ID may share key
material. Unless "inherit" is selected the unique invocation ID for the unit (see below) is added as a
protected key by the name "invocation_id" to the newly created session keyring. Defaults to "private" for
services of the system service manager and to "inherit" for non-service units and for services of the
user service manager. Optional. Type enum. choice: 'inherit', 'private', 'shared'.
OOMScoreAdjust
Sets the adjustment value for the Linux kernel's Out-Of-Memory (OOM) killer score for executed processes.
Takes an integer between -1000 (to disable OOM killing of processes of this unit) and 1000 (to make
killing of processes of this unit under memory pressure very likely). See The /proc Filesystem
<https://docs.kernel.org/filesystems/proc.html> for details. If not specified defaults to the OOM score
adjustment level of the service manager itself, which is normally at 0.
Use the "OOMPolicy" setting of service units to configure how the service manager shall react to the
kernel OOM killer or systemd-oomd terminating a process of the service. See systemd.service(5) for
details. Optional. Type integer.
TimerSlackNSec
Sets the timer slack in nanoseconds for the executed processes. The timer slack controls the accuracy of
wake-ups triggered by timers. See prctl(2) for more information. Note that in contrast to most other time
span definitions this parameter takes an integer value in nano-seconds if no unit is specified. The usual
time units are understood too. Optional. Type uniline.
Personality
Controls which kernel architecture uname(2) shall report, when invoked by unit processes. Takes one of
the architecture identifiers "arm64", "arm64-be", "arm", "arm-be", "x86", "x86-64", "ppc", "ppc-le",
"ppc64", "ppc64-le", "s390" or "s390x". Which personality architectures are supported depends on the
kernel's native architecture. Usually the 64-bit versions of the various system architectures support
their immediate 32-bit personality architecture counterpart, but no others. For example, "x86-64" systems
support the "x86-64" and "x86" personalities but no others. The personality feature is useful when
running 32-bit services on a 64-bit host system. If not specified, the personality is left unmodified and
thus reflects the personality of the host system's kernel. This option is not useful on architectures for
which only one native word width was ever available, such as "m68k" (32-bit only) or "alpha" (64-bit
only). Optional. Type enum. choice: 'arm', 'arm-be', 'arm64', 'arm64-be', 'ppc', 'ppc-le', 'ppc64',
'ppc64-le', 's390', 's390x', 'x86', 'x86-64'.
IgnoreSIGPIPE
Takes a boolean argument. If true, "SIGPIPE" is ignored in the executed process. Defaults to true since
"SIGPIPE" is generally only useful in shell pipelines. Optional. Type boolean.
Nice
Sets the default nice level (scheduling priority) for executed processes. Takes an integer between -20
(highest priority) and 19 (lowest priority). In case of resource contention, smaller values mean more
resources will be made available to the unit's processes, larger values mean less resources will be made
available. See setpriority(2) for details. Optional. Type integer.
CPUSchedulingPolicy
Sets the CPU scheduling policy for executed processes. Takes one of "other", "batch", "idle", "fifo" or
"rr". See sched_setscheduler(2) for details. Optional. Type enum. choice: 'batch', 'fifo', 'idle',
'other', 'rr'.
CPUSchedulingPriority
Sets the CPU scheduling priority for executed processes. The available priority range depends on the
selected CPU scheduling policy (see above). For real-time scheduling policies an integer between 1
(lowest priority) and 99 (highest priority) can be used. In case of CPU resource contention, smaller
values mean less CPU time is made available to the service, larger values mean more. See
sched_setscheduler(2) for details. Optional. Type uniline.
CPUSchedulingResetOnFork
Takes a boolean argument. If true, elevated CPU scheduling priorities and policies will be reset when the
executed processes call fork(2), and can hence not leak into child processes. See sched_setscheduler(2)
for details. Defaults to false. Optional. Type boolean.
CPUAffinity
Controls the CPU affinity of the executed processes. Takes a list of CPU indices or ranges separated by
either whitespace or commas. Alternatively, takes a special "numa" value in which case systemd
automatically derives allowed CPU range based on the value of "NUMAMask" option. CPU ranges are specified
by the lower and upper CPU indices separated by a dash. This option may be specified more than once, in
which case the specified CPU affinity masks are merged. If the empty string is assigned, the mask is
reset, all assignments prior to this will have no effect. See sched_setaffinity(2) for details.
Optional. Type list of uniline.
NUMAPolicy
Controls the NUMA memory policy of the executed processes. Takes a policy type, one of: "default",
"preferred", "bind", "interleave" and "local". A list of NUMA nodes that should be associated with the
policy must be specified in "NUMAMask". For more details on each policy please see, set_mempolicy(2). For
overall overview of NUMA support in Linux see, numa(7). Optional. Type uniline.
NUMAMask
Controls the NUMA node list which will be applied alongside with selected NUMA policy. Takes a list of
NUMA nodes and has the same syntax as a list of CPUs for "CPUAffinity" option or special "all" value
which will include all available NUMA nodes in the mask. Note that the list of NUMA nodes is not required
for "default" and "local" policies and for "preferred" policy we expect a single NUMA node. Optional.
Type uniline.
IOSchedulingClass
Sets the I/O scheduling class for executed processes. Takes one of the strings "realtime", "best-effort"
or "idle". The kernel's default scheduling class is "best-effort" at a priority of 4. If the empty string
is assigned to this option, all prior assignments to both "IOSchedulingClass" and "IOSchedulingPriority"
have no effect. See ioprio_set(2) for details. Optional. Type enum. choice: '0', '1', '2', '3', 'none',
'realtime', 'best-effort', 'idle'.
IOSchedulingPriority
Sets the I/O scheduling priority for executed processes. Takes an integer between 0 (highest priority)
and 7 (lowest priority). In case of I/O contention, smaller values mean more I/O bandwidth is made
available to the unit's processes, larger values mean less bandwidth. The available priorities depend on
the selected I/O scheduling class (see above). If the empty string is assigned to this option, all prior
assignments to both "IOSchedulingClass" and "IOSchedulingPriority" have no effect. For the kernel's
default scheduling class ("best-effort") this defaults to 4. See ioprio_set(2) for details. Optional.
Type integer.
upstream_default value :
4
ProtectSystem
Takes a boolean argument or the special values "full" or "strict". If true, mounts the "/usr/" and the
boot loader directories ("/boot" and "/efi") read-only for processes invoked by this unit. If set to
"full", the "/etc/" directory is mounted read-only, too. If set to "strict" the entire file system
hierarchy is mounted read-only, except for the API file system subtrees "/dev/", "/proc/" and "/sys/"
(protect these directories using "PrivateDevices", "ProtectKernelTunables", "ProtectControlGroups"). This
setting ensures that any modification of the vendor-supplied operating system (and optionally its
configuration, and local mounts) is prohibited for the service. It is recommended to enable this setting
for all long-running services, unless they are involved with system updates or need to modify the
operating system in other ways. If this option is used, "ReadWritePaths" may be used to exclude specific
directories from being made read-only. Similar, "StateDirectory", "LogsDirectory", … and related
directory settings (see below) also exclude the specific directories from the effect of "ProtectSystem".
This setting is implied if "DynamicUser" is set. This setting cannot ensure protection in all cases. In
general it has the same limitations as "ReadOnlyPaths", see below. Defaults to off. Optional. Type enum.
choice: 'full', 'no', 'strict', 'yes'.
ProtectHome
Takes a boolean argument or the special values "read-only" or "tmpfs". If true, the directories "/home/",
"/root", and "/run/user" are made inaccessible and empty for processes invoked by this unit. If set to
"read-only", the three directories are made read-only instead. If set to "tmpfs", temporary file systems
are mounted on the three directories in read-only mode. The value "tmpfs" is useful to hide home
directories not relevant to the processes invoked by the unit, while still allowing necessary directories
to be made visible when listed in "BindPaths" or "BindReadOnlyPaths".
Setting this to "yes" is mostly equivalent to setting the three directories in "InaccessiblePaths".
Similarly, "read-only" is mostly equivalent to "ReadOnlyPaths", and "tmpfs" is mostly equivalent to
"TemporaryFileSystem" with ":ro".
It is recommended to enable this setting for all long-running services (in particular network-facing
ones), to ensure they cannot get access to private user data, unless the services actually require access
to the user's private data. This setting is implied if "DynamicUser" is set. This setting cannot ensure
protection in all cases. In general it has the same limitations as "ReadOnlyPaths", see below. Optional.
Type enum. choice: 'no', 'read-only', 'tmpfs', 'yes'.
RuntimeDirectory
These options take a whitespace-separated list of directory names. The specified directory names must be
relative, and may not include "..". If set, when the unit is started, one or more directories by the
specified names will be created (including their parents) below the locations defined in the following
table. Also, the corresponding environment variable will be defined with the full paths of the
directories. If multiple directories are set, then in the environment variable the paths are concatenated
with colon (":").
In case of "RuntimeDirectory" the innermost subdirectories are removed when the unit is stopped. It is
possible to preserve the specified directories in this case if "RuntimeDirectoryPreserve" is configured
to "restart" or "yes" (see below). The directories specified with "StateDirectory", "CacheDirectory",
"LogsDirectory", "ConfigurationDirectory" are not removed when the unit is stopped.
Except in case of "ConfigurationDirectory", the innermost specified directories will be owned by the user
and group specified in "User" and "Group". If the specified directories already exist and their owning
user or group do not match the configured ones, all files and directories below the specified directories
as well as the directories themselves will have their file ownership recursively changed to match what is
configured. As an optimization, if the specified directories are already owned by the right user and
group, files and directories below of them are left as-is, even if they do not match what is requested.
The innermost specified directories will have their access mode adjusted to the what is specified in
"RuntimeDirectoryMode", "StateDirectoryMode", "CacheDirectoryMode", "LogsDirectoryMode" and
"ConfigurationDirectoryMode".
These options imply "BindPaths" for the specified paths. When combined with "RootDirectory" or
"RootImage" these paths always reside on the host and are mounted from there into the unit's file system
namespace.
If "DynamicUser" is used, the logic for "CacheDirectory", "LogsDirectory" and "StateDirectory" is
slightly altered: the directories are created below "/var/cache/private", "/var/log/private" and
"/var/lib/private", respectively, which are host directories made inaccessible to unprivileged users,
which ensures that access to these directories cannot be gained through dynamic user ID recycling.
Symbolic links are created to hide this difference in behaviour. Both from perspective of the host and
from inside the unit, the relevant directories hence always appear directly below "/var/cache",
"/var/log" and "/var/lib".
Use "RuntimeDirectory" to manage one or more runtime directories for the unit and bind their lifetime to
the daemon runtime. This is particularly useful for unprivileged daemons that cannot create runtime
directories in "/run/" due to lack of privileges, and to make sure the runtime directory is cleaned up
automatically after use. For runtime directories that require more complex or different configuration or
lifetime guarantees, please consider using tmpfiles.d(5).
"RuntimeDirectory", "StateDirectory", "CacheDirectory" and "LogsDirectory" optionally support a second
parameter, separated by ":". The second parameter will be interpreted as a destination path that will be
created as a symlink to the directory. The symlinks will be created after any "BindPaths" or
"TemporaryFileSystem" options have been set up, to make ephemeral symlinking possible. The same source
can have multiple symlinks, by using the same first parameter, but a different second parameter.
The directories defined by these options are always created under the standard paths used by systemd
("/var/", "/run/", "/etc/", …). If the service needs directories in a different location, a different
mechanism has to be used to create them.
tmpfiles.d(5) provides functionality that overlaps with these options. Using these options is
recommended, because the lifetime of the directories is tied directly to the lifetime of the unit, and it
is not necessary to ensure that the "tmpfiles.d" configuration is executed before the unit is started.
To remove any of the directories created by these settings, use the systemctl clean … command on the
relevant units, see systemctl(1) for details.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar baz
the service manager creates "/run/foo" (if it does not exist), "/run/foo/bar", and "/run/baz". The
directories "/run/foo/bar" and "/run/baz" except "/run/foo" are owned by the user and group specified in
"User" and "Group", and removed when the service is stopped.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar
StateDirectory=aaa/bbb ccc
then the environment variable "RUNTIME_DIRECTORY" is set with "/run/foo/bar", and "STATE_DIRECTORY" is
set with "/var/lib/aaa/bbb:/var/lib/ccc".
Example: if a system service unit has the following,
RuntimeDirectory=foo:bar foo:baz
the service manager creates "/run/foo" (if it does not exist), and "/run/bar" plus "/run/baz" as symlinks
to "/run/foo". Optional. Type uniline.
StateDirectory
These options take a whitespace-separated list of directory names. The specified directory names must be
relative, and may not include "..". If set, when the unit is started, one or more directories by the
specified names will be created (including their parents) below the locations defined in the following
table. Also, the corresponding environment variable will be defined with the full paths of the
directories. If multiple directories are set, then in the environment variable the paths are concatenated
with colon (":").
In case of "RuntimeDirectory" the innermost subdirectories are removed when the unit is stopped. It is
possible to preserve the specified directories in this case if "RuntimeDirectoryPreserve" is configured
to "restart" or "yes" (see below). The directories specified with "StateDirectory", "CacheDirectory",
"LogsDirectory", "ConfigurationDirectory" are not removed when the unit is stopped.
Except in case of "ConfigurationDirectory", the innermost specified directories will be owned by the user
and group specified in "User" and "Group". If the specified directories already exist and their owning
user or group do not match the configured ones, all files and directories below the specified directories
as well as the directories themselves will have their file ownership recursively changed to match what is
configured. As an optimization, if the specified directories are already owned by the right user and
group, files and directories below of them are left as-is, even if they do not match what is requested.
The innermost specified directories will have their access mode adjusted to the what is specified in
"RuntimeDirectoryMode", "StateDirectoryMode", "CacheDirectoryMode", "LogsDirectoryMode" and
"ConfigurationDirectoryMode".
These options imply "BindPaths" for the specified paths. When combined with "RootDirectory" or
"RootImage" these paths always reside on the host and are mounted from there into the unit's file system
namespace.
If "DynamicUser" is used, the logic for "CacheDirectory", "LogsDirectory" and "StateDirectory" is
slightly altered: the directories are created below "/var/cache/private", "/var/log/private" and
"/var/lib/private", respectively, which are host directories made inaccessible to unprivileged users,
which ensures that access to these directories cannot be gained through dynamic user ID recycling.
Symbolic links are created to hide this difference in behaviour. Both from perspective of the host and
from inside the unit, the relevant directories hence always appear directly below "/var/cache",
"/var/log" and "/var/lib".
Use "RuntimeDirectory" to manage one or more runtime directories for the unit and bind their lifetime to
the daemon runtime. This is particularly useful for unprivileged daemons that cannot create runtime
directories in "/run/" due to lack of privileges, and to make sure the runtime directory is cleaned up
automatically after use. For runtime directories that require more complex or different configuration or
lifetime guarantees, please consider using tmpfiles.d(5).
"RuntimeDirectory", "StateDirectory", "CacheDirectory" and "LogsDirectory" optionally support a second
parameter, separated by ":". The second parameter will be interpreted as a destination path that will be
created as a symlink to the directory. The symlinks will be created after any "BindPaths" or
"TemporaryFileSystem" options have been set up, to make ephemeral symlinking possible. The same source
can have multiple symlinks, by using the same first parameter, but a different second parameter.
The directories defined by these options are always created under the standard paths used by systemd
("/var/", "/run/", "/etc/", …). If the service needs directories in a different location, a different
mechanism has to be used to create them.
tmpfiles.d(5) provides functionality that overlaps with these options. Using these options is
recommended, because the lifetime of the directories is tied directly to the lifetime of the unit, and it
is not necessary to ensure that the "tmpfiles.d" configuration is executed before the unit is started.
To remove any of the directories created by these settings, use the systemctl clean … command on the
relevant units, see systemctl(1) for details.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar baz
the service manager creates "/run/foo" (if it does not exist), "/run/foo/bar", and "/run/baz". The
directories "/run/foo/bar" and "/run/baz" except "/run/foo" are owned by the user and group specified in
"User" and "Group", and removed when the service is stopped.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar
StateDirectory=aaa/bbb ccc
then the environment variable "RUNTIME_DIRECTORY" is set with "/run/foo/bar", and "STATE_DIRECTORY" is
set with "/var/lib/aaa/bbb:/var/lib/ccc".
Example: if a system service unit has the following,
RuntimeDirectory=foo:bar foo:baz
the service manager creates "/run/foo" (if it does not exist), and "/run/bar" plus "/run/baz" as symlinks
to "/run/foo". Optional. Type uniline.
CacheDirectory
These options take a whitespace-separated list of directory names. The specified directory names must be
relative, and may not include "..". If set, when the unit is started, one or more directories by the
specified names will be created (including their parents) below the locations defined in the following
table. Also, the corresponding environment variable will be defined with the full paths of the
directories. If multiple directories are set, then in the environment variable the paths are concatenated
with colon (":").
In case of "RuntimeDirectory" the innermost subdirectories are removed when the unit is stopped. It is
possible to preserve the specified directories in this case if "RuntimeDirectoryPreserve" is configured
to "restart" or "yes" (see below). The directories specified with "StateDirectory", "CacheDirectory",
"LogsDirectory", "ConfigurationDirectory" are not removed when the unit is stopped.
Except in case of "ConfigurationDirectory", the innermost specified directories will be owned by the user
and group specified in "User" and "Group". If the specified directories already exist and their owning
user or group do not match the configured ones, all files and directories below the specified directories
as well as the directories themselves will have their file ownership recursively changed to match what is
configured. As an optimization, if the specified directories are already owned by the right user and
group, files and directories below of them are left as-is, even if they do not match what is requested.
The innermost specified directories will have their access mode adjusted to the what is specified in
"RuntimeDirectoryMode", "StateDirectoryMode", "CacheDirectoryMode", "LogsDirectoryMode" and
"ConfigurationDirectoryMode".
These options imply "BindPaths" for the specified paths. When combined with "RootDirectory" or
"RootImage" these paths always reside on the host and are mounted from there into the unit's file system
namespace.
If "DynamicUser" is used, the logic for "CacheDirectory", "LogsDirectory" and "StateDirectory" is
slightly altered: the directories are created below "/var/cache/private", "/var/log/private" and
"/var/lib/private", respectively, which are host directories made inaccessible to unprivileged users,
which ensures that access to these directories cannot be gained through dynamic user ID recycling.
Symbolic links are created to hide this difference in behaviour. Both from perspective of the host and
from inside the unit, the relevant directories hence always appear directly below "/var/cache",
"/var/log" and "/var/lib".
Use "RuntimeDirectory" to manage one or more runtime directories for the unit and bind their lifetime to
the daemon runtime. This is particularly useful for unprivileged daemons that cannot create runtime
directories in "/run/" due to lack of privileges, and to make sure the runtime directory is cleaned up
automatically after use. For runtime directories that require more complex or different configuration or
lifetime guarantees, please consider using tmpfiles.d(5).
"RuntimeDirectory", "StateDirectory", "CacheDirectory" and "LogsDirectory" optionally support a second
parameter, separated by ":". The second parameter will be interpreted as a destination path that will be
created as a symlink to the directory. The symlinks will be created after any "BindPaths" or
"TemporaryFileSystem" options have been set up, to make ephemeral symlinking possible. The same source
can have multiple symlinks, by using the same first parameter, but a different second parameter.
The directories defined by these options are always created under the standard paths used by systemd
("/var/", "/run/", "/etc/", …). If the service needs directories in a different location, a different
mechanism has to be used to create them.
tmpfiles.d(5) provides functionality that overlaps with these options. Using these options is
recommended, because the lifetime of the directories is tied directly to the lifetime of the unit, and it
is not necessary to ensure that the "tmpfiles.d" configuration is executed before the unit is started.
To remove any of the directories created by these settings, use the systemctl clean … command on the
relevant units, see systemctl(1) for details.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar baz
the service manager creates "/run/foo" (if it does not exist), "/run/foo/bar", and "/run/baz". The
directories "/run/foo/bar" and "/run/baz" except "/run/foo" are owned by the user and group specified in
"User" and "Group", and removed when the service is stopped.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar
StateDirectory=aaa/bbb ccc
then the environment variable "RUNTIME_DIRECTORY" is set with "/run/foo/bar", and "STATE_DIRECTORY" is
set with "/var/lib/aaa/bbb:/var/lib/ccc".
Example: if a system service unit has the following,
RuntimeDirectory=foo:bar foo:baz
the service manager creates "/run/foo" (if it does not exist), and "/run/bar" plus "/run/baz" as symlinks
to "/run/foo". Optional. Type uniline.
LogsDirectory
These options take a whitespace-separated list of directory names. The specified directory names must be
relative, and may not include "..". If set, when the unit is started, one or more directories by the
specified names will be created (including their parents) below the locations defined in the following
table. Also, the corresponding environment variable will be defined with the full paths of the
directories. If multiple directories are set, then in the environment variable the paths are concatenated
with colon (":").
In case of "RuntimeDirectory" the innermost subdirectories are removed when the unit is stopped. It is
possible to preserve the specified directories in this case if "RuntimeDirectoryPreserve" is configured
to "restart" or "yes" (see below). The directories specified with "StateDirectory", "CacheDirectory",
"LogsDirectory", "ConfigurationDirectory" are not removed when the unit is stopped.
Except in case of "ConfigurationDirectory", the innermost specified directories will be owned by the user
and group specified in "User" and "Group". If the specified directories already exist and their owning
user or group do not match the configured ones, all files and directories below the specified directories
as well as the directories themselves will have their file ownership recursively changed to match what is
configured. As an optimization, if the specified directories are already owned by the right user and
group, files and directories below of them are left as-is, even if they do not match what is requested.
The innermost specified directories will have their access mode adjusted to the what is specified in
"RuntimeDirectoryMode", "StateDirectoryMode", "CacheDirectoryMode", "LogsDirectoryMode" and
"ConfigurationDirectoryMode".
These options imply "BindPaths" for the specified paths. When combined with "RootDirectory" or
"RootImage" these paths always reside on the host and are mounted from there into the unit's file system
namespace.
If "DynamicUser" is used, the logic for "CacheDirectory", "LogsDirectory" and "StateDirectory" is
slightly altered: the directories are created below "/var/cache/private", "/var/log/private" and
"/var/lib/private", respectively, which are host directories made inaccessible to unprivileged users,
which ensures that access to these directories cannot be gained through dynamic user ID recycling.
Symbolic links are created to hide this difference in behaviour. Both from perspective of the host and
from inside the unit, the relevant directories hence always appear directly below "/var/cache",
"/var/log" and "/var/lib".
Use "RuntimeDirectory" to manage one or more runtime directories for the unit and bind their lifetime to
the daemon runtime. This is particularly useful for unprivileged daemons that cannot create runtime
directories in "/run/" due to lack of privileges, and to make sure the runtime directory is cleaned up
automatically after use. For runtime directories that require more complex or different configuration or
lifetime guarantees, please consider using tmpfiles.d(5).
"RuntimeDirectory", "StateDirectory", "CacheDirectory" and "LogsDirectory" optionally support a second
parameter, separated by ":". The second parameter will be interpreted as a destination path that will be
created as a symlink to the directory. The symlinks will be created after any "BindPaths" or
"TemporaryFileSystem" options have been set up, to make ephemeral symlinking possible. The same source
can have multiple symlinks, by using the same first parameter, but a different second parameter.
The directories defined by these options are always created under the standard paths used by systemd
("/var/", "/run/", "/etc/", …). If the service needs directories in a different location, a different
mechanism has to be used to create them.
tmpfiles.d(5) provides functionality that overlaps with these options. Using these options is
recommended, because the lifetime of the directories is tied directly to the lifetime of the unit, and it
is not necessary to ensure that the "tmpfiles.d" configuration is executed before the unit is started.
To remove any of the directories created by these settings, use the systemctl clean … command on the
relevant units, see systemctl(1) for details.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar baz
the service manager creates "/run/foo" (if it does not exist), "/run/foo/bar", and "/run/baz". The
directories "/run/foo/bar" and "/run/baz" except "/run/foo" are owned by the user and group specified in
"User" and "Group", and removed when the service is stopped.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar
StateDirectory=aaa/bbb ccc
then the environment variable "RUNTIME_DIRECTORY" is set with "/run/foo/bar", and "STATE_DIRECTORY" is
set with "/var/lib/aaa/bbb:/var/lib/ccc".
Example: if a system service unit has the following,
RuntimeDirectory=foo:bar foo:baz
the service manager creates "/run/foo" (if it does not exist), and "/run/bar" plus "/run/baz" as symlinks
to "/run/foo". Optional. Type uniline.
ConfigurationDirectory
These options take a whitespace-separated list of directory names. The specified directory names must be
relative, and may not include "..". If set, when the unit is started, one or more directories by the
specified names will be created (including their parents) below the locations defined in the following
table. Also, the corresponding environment variable will be defined with the full paths of the
directories. If multiple directories are set, then in the environment variable the paths are concatenated
with colon (":").
In case of "RuntimeDirectory" the innermost subdirectories are removed when the unit is stopped. It is
possible to preserve the specified directories in this case if "RuntimeDirectoryPreserve" is configured
to "restart" or "yes" (see below). The directories specified with "StateDirectory", "CacheDirectory",
"LogsDirectory", "ConfigurationDirectory" are not removed when the unit is stopped.
Except in case of "ConfigurationDirectory", the innermost specified directories will be owned by the user
and group specified in "User" and "Group". If the specified directories already exist and their owning
user or group do not match the configured ones, all files and directories below the specified directories
as well as the directories themselves will have their file ownership recursively changed to match what is
configured. As an optimization, if the specified directories are already owned by the right user and
group, files and directories below of them are left as-is, even if they do not match what is requested.
The innermost specified directories will have their access mode adjusted to the what is specified in
"RuntimeDirectoryMode", "StateDirectoryMode", "CacheDirectoryMode", "LogsDirectoryMode" and
"ConfigurationDirectoryMode".
These options imply "BindPaths" for the specified paths. When combined with "RootDirectory" or
"RootImage" these paths always reside on the host and are mounted from there into the unit's file system
namespace.
If "DynamicUser" is used, the logic for "CacheDirectory", "LogsDirectory" and "StateDirectory" is
slightly altered: the directories are created below "/var/cache/private", "/var/log/private" and
"/var/lib/private", respectively, which are host directories made inaccessible to unprivileged users,
which ensures that access to these directories cannot be gained through dynamic user ID recycling.
Symbolic links are created to hide this difference in behaviour. Both from perspective of the host and
from inside the unit, the relevant directories hence always appear directly below "/var/cache",
"/var/log" and "/var/lib".
Use "RuntimeDirectory" to manage one or more runtime directories for the unit and bind their lifetime to
the daemon runtime. This is particularly useful for unprivileged daemons that cannot create runtime
directories in "/run/" due to lack of privileges, and to make sure the runtime directory is cleaned up
automatically after use. For runtime directories that require more complex or different configuration or
lifetime guarantees, please consider using tmpfiles.d(5).
"RuntimeDirectory", "StateDirectory", "CacheDirectory" and "LogsDirectory" optionally support a second
parameter, separated by ":". The second parameter will be interpreted as a destination path that will be
created as a symlink to the directory. The symlinks will be created after any "BindPaths" or
"TemporaryFileSystem" options have been set up, to make ephemeral symlinking possible. The same source
can have multiple symlinks, by using the same first parameter, but a different second parameter.
The directories defined by these options are always created under the standard paths used by systemd
("/var/", "/run/", "/etc/", …). If the service needs directories in a different location, a different
mechanism has to be used to create them.
tmpfiles.d(5) provides functionality that overlaps with these options. Using these options is
recommended, because the lifetime of the directories is tied directly to the lifetime of the unit, and it
is not necessary to ensure that the "tmpfiles.d" configuration is executed before the unit is started.
To remove any of the directories created by these settings, use the systemctl clean … command on the
relevant units, see systemctl(1) for details.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar baz
the service manager creates "/run/foo" (if it does not exist), "/run/foo/bar", and "/run/baz". The
directories "/run/foo/bar" and "/run/baz" except "/run/foo" are owned by the user and group specified in
"User" and "Group", and removed when the service is stopped.
Example: if a system service unit has the following,
RuntimeDirectory=foo/bar
StateDirectory=aaa/bbb ccc
then the environment variable "RUNTIME_DIRECTORY" is set with "/run/foo/bar", and "STATE_DIRECTORY" is
set with "/var/lib/aaa/bbb:/var/lib/ccc".
Example: if a system service unit has the following,
RuntimeDirectory=foo:bar foo:baz
the service manager creates "/run/foo" (if it does not exist), and "/run/bar" plus "/run/baz" as symlinks
to "/run/foo". Optional. Type uniline.
RuntimeDirectoryMode
Specifies the access mode of the directories specified in "RuntimeDirectory", "StateDirectory",
"CacheDirectory", "LogsDirectory", or "ConfigurationDirectory", respectively, as an octal number.
Defaults to 0755. See "Permissions" in path_resolution(7) for a discussion of the meaning of permission
bits. Optional. Type uniline.
StateDirectoryMode
Specifies the access mode of the directories specified in "RuntimeDirectory", "StateDirectory",
"CacheDirectory", "LogsDirectory", or "ConfigurationDirectory", respectively, as an octal number.
Defaults to 0755. See "Permissions" in path_resolution(7) for a discussion of the meaning of permission
bits. Optional. Type uniline.
CacheDirectoryMode
Specifies the access mode of the directories specified in "RuntimeDirectory", "StateDirectory",
"CacheDirectory", "LogsDirectory", or "ConfigurationDirectory", respectively, as an octal number.
Defaults to 0755. See "Permissions" in path_resolution(7) for a discussion of the meaning of permission
bits. Optional. Type uniline.
LogsDirectoryMode
Specifies the access mode of the directories specified in "RuntimeDirectory", "StateDirectory",
"CacheDirectory", "LogsDirectory", or "ConfigurationDirectory", respectively, as an octal number.
Defaults to 0755. See "Permissions" in path_resolution(7) for a discussion of the meaning of permission
bits. Optional. Type uniline.
ConfigurationDirectoryMode
Specifies the access mode of the directories specified in "RuntimeDirectory", "StateDirectory",
"CacheDirectory", "LogsDirectory", or "ConfigurationDirectory", respectively, as an octal number.
Defaults to 0755. See "Permissions" in path_resolution(7) for a discussion of the meaning of permission
bits. Optional. Type uniline.
RuntimeDirectoryPreserve
Takes a boolean argument or "restart". If set to "no" (the default), the directories specified in
"RuntimeDirectory" are always removed when the service stops. If set to "restart" the directories are
preserved when the service is both automatically and manually restarted. Here, the automatic restart
means the operation specified in "Restart", and manual restart means the one triggered by systemctl
restart foo.service. If set to "yes", then the directories are not removed when the service is stopped.
Note that since the runtime directory "/run/" is a mount point of "tmpfs", then for system services the
directories specified in "RuntimeDirectory" are removed when the system is rebooted. Optional. Type
enum. choice: 'no', 'restart', 'yes'.
TimeoutCleanSec
Configures a timeout on the clean-up operation requested through systemctl clean …, see systemctl(1) for
details. Takes the usual time values and defaults to "infinity", i.e. by default no timeout is applied.
If a timeout is configured the clean operation will be aborted forcibly when the timeout is reached,
potentially leaving resources on disk. Optional. Type uniline.
ReadWritePaths
Sets up a new file system namespace for executed processes. These options may be used to limit access a
process has to the file system. Each setting takes a space-separated list of paths relative to the host's
root directory (i.e. the system running the service manager). Note that if paths contain symlinks, they
are resolved relative to the root directory set with "RootDirectory"/"RootImage".
Paths listed in "ReadWritePaths" are accessible from within the namespace with the same access modes as
from outside of it. Paths listed in "ReadOnlyPaths" are accessible for reading only, writing will be
refused even if the usual file access controls would permit this. Nest "ReadWritePaths" inside of
"ReadOnlyPaths" in order to provide writable subdirectories within read-only directories. Use
"ReadWritePaths" in order to allow-list specific paths for write access if "ProtectSystem=strict" is
used. Note that "ReadWritePaths" cannot be used to gain write access to a file system whose superblock is
mounted read-only. On Linux, for each mount point write access is granted only if the mount point itself
and the file system superblock backing it are not marked read-only. "ReadWritePaths" only controls the
former, not the latter, hence a read-only file system superblock remains protected.
Paths listed in "InaccessiblePaths" will be made inaccessible for processes inside the namespace along
with everything below them in the file system hierarchy. This may be more restrictive than desired,
because it is not possible to nest "ReadWritePaths", "ReadOnlyPaths", "BindPaths", or "BindReadOnlyPaths"
inside it. For a more flexible option, see "TemporaryFileSystem".
Content in paths listed in "NoExecPaths" are not executable even if the usual file access controls would
permit this. Nest "ExecPaths" inside of "NoExecPaths" in order to provide executable content within non-
executable directories.
Non-directory paths may be specified as well. These options may be specified more than once, in which
case all paths listed will have limited access from within the namespace. If the empty string is assigned
to this option, the specific list is reset, and all prior assignments have no effect.
Paths in "ReadWritePaths", "ReadOnlyPaths", "InaccessiblePaths", "ExecPaths" and "NoExecPaths" may be
prefixed with "-", in which case they will be ignored when they do not exist. If prefixed with "+" the
paths are taken relative to the root directory of the unit, as configured with
"RootDirectory"/"RootImage", instead of relative to the root directory of the host (see above). When
combining "-" and "+" on the same path make sure to specify "-" first, and "+" second.
Note that these settings will disconnect propagation of mounts from the unit's processes to the host.
This means that this setting may not be used for services which shall be able to install mount points in
the main mount namespace. For "ReadWritePaths" and "ReadOnlyPaths", propagation in the other direction is
not affected, i.e. mounts created on the host generally appear in the unit processes' namespace, and
mounts removed on the host also disappear there too. In particular, note that mount propagation from host
to unit will result in unmodified mounts to be created in the unit's namespace, i.e. writable mounts
appearing on the host will be writable in the unit's namespace too, even when propagated below a path
marked with "ReadOnlyPaths"! Restricting access with these options hence does not extend to submounts of
a directory that are created later on. This means the lock-down offered by that setting is not complete,
and does not offer full protection.
Note that the effect of these settings may be undone by privileged processes. In order to set up an
effective sandboxed environment for a unit it is thus recommended to combine these settings with either
"CapabilityBoundingSet=~CAP_SYS_ADMIN" or "SystemCallFilter=~@mount".
Please be extra careful when applying these options to API file systems (a list of them could be found in
"MountAPIVPS"), since they may be required for basic system functionalities. Moreover, "/run/" needs to
be writable for setting up mount namespace and propagation.
Simple allow-list example using these directives:
[Service]
ReadOnlyPaths=/
ReadWritePaths=/var /run
InaccessiblePaths=-/lost+found
NoExecPaths=/
ExecPaths=/usr/sbin/my_daemon /usr/lib /usr/lib64
. I< Optional. Type list of uniline. >
ReadOnlyPaths
Sets up a new file system namespace for executed processes. These options may be used to limit access a
process has to the file system. Each setting takes a space-separated list of paths relative to the host's
root directory (i.e. the system running the service manager). Note that if paths contain symlinks, they
are resolved relative to the root directory set with "RootDirectory"/"RootImage".
Paths listed in "ReadWritePaths" are accessible from within the namespace with the same access modes as
from outside of it. Paths listed in "ReadOnlyPaths" are accessible for reading only, writing will be
refused even if the usual file access controls would permit this. Nest "ReadWritePaths" inside of
"ReadOnlyPaths" in order to provide writable subdirectories within read-only directories. Use
"ReadWritePaths" in order to allow-list specific paths for write access if "ProtectSystem=strict" is
used. Note that "ReadWritePaths" cannot be used to gain write access to a file system whose superblock is
mounted read-only. On Linux, for each mount point write access is granted only if the mount point itself
and the file system superblock backing it are not marked read-only. "ReadWritePaths" only controls the
former, not the latter, hence a read-only file system superblock remains protected.
Paths listed in "InaccessiblePaths" will be made inaccessible for processes inside the namespace along
with everything below them in the file system hierarchy. This may be more restrictive than desired,
because it is not possible to nest "ReadWritePaths", "ReadOnlyPaths", "BindPaths", or "BindReadOnlyPaths"
inside it. For a more flexible option, see "TemporaryFileSystem".
Content in paths listed in "NoExecPaths" are not executable even if the usual file access controls would
permit this. Nest "ExecPaths" inside of "NoExecPaths" in order to provide executable content within non-
executable directories.
Non-directory paths may be specified as well. These options may be specified more than once, in which
case all paths listed will have limited access from within the namespace. If the empty string is assigned
to this option, the specific list is reset, and all prior assignments have no effect.
Paths in "ReadWritePaths", "ReadOnlyPaths", "InaccessiblePaths", "ExecPaths" and "NoExecPaths" may be
prefixed with "-", in which case they will be ignored when they do not exist. If prefixed with "+" the
paths are taken relative to the root directory of the unit, as configured with
"RootDirectory"/"RootImage", instead of relative to the root directory of the host (see above). When
combining "-" and "+" on the same path make sure to specify "-" first, and "+" second.
Note that these settings will disconnect propagation of mounts from the unit's processes to the host.
This means that this setting may not be used for services which shall be able to install mount points in
the main mount namespace. For "ReadWritePaths" and "ReadOnlyPaths", propagation in the other direction is
not affected, i.e. mounts created on the host generally appear in the unit processes' namespace, and
mounts removed on the host also disappear there too. In particular, note that mount propagation from host
to unit will result in unmodified mounts to be created in the unit's namespace, i.e. writable mounts
appearing on the host will be writable in the unit's namespace too, even when propagated below a path
marked with "ReadOnlyPaths"! Restricting access with these options hence does not extend to submounts of
a directory that are created later on. This means the lock-down offered by that setting is not complete,
and does not offer full protection.
Note that the effect of these settings may be undone by privileged processes. In order to set up an
effective sandboxed environment for a unit it is thus recommended to combine these settings with either
"CapabilityBoundingSet=~CAP_SYS_ADMIN" or "SystemCallFilter=~@mount".
Please be extra careful when applying these options to API file systems (a list of them could be found in
"MountAPIVPS"), since they may be required for basic system functionalities. Moreover, "/run/" needs to
be writable for setting up mount namespace and propagation.
Simple allow-list example using these directives:
[Service]
ReadOnlyPaths=/
ReadWritePaths=/var /run
InaccessiblePaths=-/lost+found
NoExecPaths=/
ExecPaths=/usr/sbin/my_daemon /usr/lib /usr/lib64
. I< Optional. Type list of uniline. >
InaccessiblePaths
Sets up a new file system namespace for executed processes. These options may be used to limit access a
process has to the file system. Each setting takes a space-separated list of paths relative to the host's
root directory (i.e. the system running the service manager). Note that if paths contain symlinks, they
are resolved relative to the root directory set with "RootDirectory"/"RootImage".
Paths listed in "ReadWritePaths" are accessible from within the namespace with the same access modes as
from outside of it. Paths listed in "ReadOnlyPaths" are accessible for reading only, writing will be
refused even if the usual file access controls would permit this. Nest "ReadWritePaths" inside of
"ReadOnlyPaths" in order to provide writable subdirectories within read-only directories. Use
"ReadWritePaths" in order to allow-list specific paths for write access if "ProtectSystem=strict" is
used. Note that "ReadWritePaths" cannot be used to gain write access to a file system whose superblock is
mounted read-only. On Linux, for each mount point write access is granted only if the mount point itself
and the file system superblock backing it are not marked read-only. "ReadWritePaths" only controls the
former, not the latter, hence a read-only file system superblock remains protected.
Paths listed in "InaccessiblePaths" will be made inaccessible for processes inside the namespace along
with everything below them in the file system hierarchy. This may be more restrictive than desired,
because it is not possible to nest "ReadWritePaths", "ReadOnlyPaths", "BindPaths", or "BindReadOnlyPaths"
inside it. For a more flexible option, see "TemporaryFileSystem".
Content in paths listed in "NoExecPaths" are not executable even if the usual file access controls would
permit this. Nest "ExecPaths" inside of "NoExecPaths" in order to provide executable content within non-
executable directories.
Non-directory paths may be specified as well. These options may be specified more than once, in which
case all paths listed will have limited access from within the namespace. If the empty string is assigned
to this option, the specific list is reset, and all prior assignments have no effect.
Paths in "ReadWritePaths", "ReadOnlyPaths", "InaccessiblePaths", "ExecPaths" and "NoExecPaths" may be
prefixed with "-", in which case they will be ignored when they do not exist. If prefixed with "+" the
paths are taken relative to the root directory of the unit, as configured with
"RootDirectory"/"RootImage", instead of relative to the root directory of the host (see above). When
combining "-" and "+" on the same path make sure to specify "-" first, and "+" second.
Note that these settings will disconnect propagation of mounts from the unit's processes to the host.
This means that this setting may not be used for services which shall be able to install mount points in
the main mount namespace. For "ReadWritePaths" and "ReadOnlyPaths", propagation in the other direction is
not affected, i.e. mounts created on the host generally appear in the unit processes' namespace, and
mounts removed on the host also disappear there too. In particular, note that mount propagation from host
to unit will result in unmodified mounts to be created in the unit's namespace, i.e. writable mounts
appearing on the host will be writable in the unit's namespace too, even when propagated below a path
marked with "ReadOnlyPaths"! Restricting access with these options hence does not extend to submounts of
a directory that are created later on. This means the lock-down offered by that setting is not complete,
and does not offer full protection.
Note that the effect of these settings may be undone by privileged processes. In order to set up an
effective sandboxed environment for a unit it is thus recommended to combine these settings with either
"CapabilityBoundingSet=~CAP_SYS_ADMIN" or "SystemCallFilter=~@mount".
Please be extra careful when applying these options to API file systems (a list of them could be found in
"MountAPIVPS"), since they may be required for basic system functionalities. Moreover, "/run/" needs to
be writable for setting up mount namespace and propagation.
Simple allow-list example using these directives:
[Service]
ReadOnlyPaths=/
ReadWritePaths=/var /run
InaccessiblePaths=-/lost+found
NoExecPaths=/
ExecPaths=/usr/sbin/my_daemon /usr/lib /usr/lib64
. I< Optional. Type list of uniline. >
ExecPaths
Sets up a new file system namespace for executed processes. These options may be used to limit access a
process has to the file system. Each setting takes a space-separated list of paths relative to the host's
root directory (i.e. the system running the service manager). Note that if paths contain symlinks, they
are resolved relative to the root directory set with "RootDirectory"/"RootImage".
Paths listed in "ReadWritePaths" are accessible from within the namespace with the same access modes as
from outside of it. Paths listed in "ReadOnlyPaths" are accessible for reading only, writing will be
refused even if the usual file access controls would permit this. Nest "ReadWritePaths" inside of
"ReadOnlyPaths" in order to provide writable subdirectories within read-only directories. Use
"ReadWritePaths" in order to allow-list specific paths for write access if "ProtectSystem=strict" is
used. Note that "ReadWritePaths" cannot be used to gain write access to a file system whose superblock is
mounted read-only. On Linux, for each mount point write access is granted only if the mount point itself
and the file system superblock backing it are not marked read-only. "ReadWritePaths" only controls the
former, not the latter, hence a read-only file system superblock remains protected.
Paths listed in "InaccessiblePaths" will be made inaccessible for processes inside the namespace along
with everything below them in the file system hierarchy. This may be more restrictive than desired,
because it is not possible to nest "ReadWritePaths", "ReadOnlyPaths", "BindPaths", or "BindReadOnlyPaths"
inside it. For a more flexible option, see "TemporaryFileSystem".
Content in paths listed in "NoExecPaths" are not executable even if the usual file access controls would
permit this. Nest "ExecPaths" inside of "NoExecPaths" in order to provide executable content within non-
executable directories.
Non-directory paths may be specified as well. These options may be specified more than once, in which
case all paths listed will have limited access from within the namespace. If the empty string is assigned
to this option, the specific list is reset, and all prior assignments have no effect.
Paths in "ReadWritePaths", "ReadOnlyPaths", "InaccessiblePaths", "ExecPaths" and "NoExecPaths" may be
prefixed with "-", in which case they will be ignored when they do not exist. If prefixed with "+" the
paths are taken relative to the root directory of the unit, as configured with
"RootDirectory"/"RootImage", instead of relative to the root directory of the host (see above). When
combining "-" and "+" on the same path make sure to specify "-" first, and "+" second.
Note that these settings will disconnect propagation of mounts from the unit's processes to the host.
This means that this setting may not be used for services which shall be able to install mount points in
the main mount namespace. For "ReadWritePaths" and "ReadOnlyPaths", propagation in the other direction is
not affected, i.e. mounts created on the host generally appear in the unit processes' namespace, and
mounts removed on the host also disappear there too. In particular, note that mount propagation from host
to unit will result in unmodified mounts to be created in the unit's namespace, i.e. writable mounts
appearing on the host will be writable in the unit's namespace too, even when propagated below a path
marked with "ReadOnlyPaths"! Restricting access with these options hence does not extend to submounts of
a directory that are created later on. This means the lock-down offered by that setting is not complete,
and does not offer full protection.
Note that the effect of these settings may be undone by privileged processes. In order to set up an
effective sandboxed environment for a unit it is thus recommended to combine these settings with either
"CapabilityBoundingSet=~CAP_SYS_ADMIN" or "SystemCallFilter=~@mount".
Please be extra careful when applying these options to API file systems (a list of them could be found in
"MountAPIVPS"), since they may be required for basic system functionalities. Moreover, "/run/" needs to
be writable for setting up mount namespace and propagation.
Simple allow-list example using these directives:
[Service]
ReadOnlyPaths=/
ReadWritePaths=/var /run
InaccessiblePaths=-/lost+found
NoExecPaths=/
ExecPaths=/usr/sbin/my_daemon /usr/lib /usr/lib64
. I< Optional. Type list of uniline. >
NoExecPaths
Sets up a new file system namespace for executed processes. These options may be used to limit access a
process has to the file system. Each setting takes a space-separated list of paths relative to the host's
root directory (i.e. the system running the service manager). Note that if paths contain symlinks, they
are resolved relative to the root directory set with "RootDirectory"/"RootImage".
Paths listed in "ReadWritePaths" are accessible from within the namespace with the same access modes as
from outside of it. Paths listed in "ReadOnlyPaths" are accessible for reading only, writing will be
refused even if the usual file access controls would permit this. Nest "ReadWritePaths" inside of
"ReadOnlyPaths" in order to provide writable subdirectories within read-only directories. Use
"ReadWritePaths" in order to allow-list specific paths for write access if "ProtectSystem=strict" is
used. Note that "ReadWritePaths" cannot be used to gain write access to a file system whose superblock is
mounted read-only. On Linux, for each mount point write access is granted only if the mount point itself
and the file system superblock backing it are not marked read-only. "ReadWritePaths" only controls the
former, not the latter, hence a read-only file system superblock remains protected.
Paths listed in "InaccessiblePaths" will be made inaccessible for processes inside the namespace along
with everything below them in the file system hierarchy. This may be more restrictive than desired,
because it is not possible to nest "ReadWritePaths", "ReadOnlyPaths", "BindPaths", or "BindReadOnlyPaths"
inside it. For a more flexible option, see "TemporaryFileSystem".
Content in paths listed in "NoExecPaths" are not executable even if the usual file access controls would
permit this. Nest "ExecPaths" inside of "NoExecPaths" in order to provide executable content within non-
executable directories.
Non-directory paths may be specified as well. These options may be specified more than once, in which
case all paths listed will have limited access from within the namespace. If the empty string is assigned
to this option, the specific list is reset, and all prior assignments have no effect.
Paths in "ReadWritePaths", "ReadOnlyPaths", "InaccessiblePaths", "ExecPaths" and "NoExecPaths" may be
prefixed with "-", in which case they will be ignored when they do not exist. If prefixed with "+" the
paths are taken relative to the root directory of the unit, as configured with
"RootDirectory"/"RootImage", instead of relative to the root directory of the host (see above). When
combining "-" and "+" on the same path make sure to specify "-" first, and "+" second.
Note that these settings will disconnect propagation of mounts from the unit's processes to the host.
This means that this setting may not be used for services which shall be able to install mount points in
the main mount namespace. For "ReadWritePaths" and "ReadOnlyPaths", propagation in the other direction is
not affected, i.e. mounts created on the host generally appear in the unit processes' namespace, and
mounts removed on the host also disappear there too. In particular, note that mount propagation from host
to unit will result in unmodified mounts to be created in the unit's namespace, i.e. writable mounts
appearing on the host will be writable in the unit's namespace too, even when propagated below a path
marked with "ReadOnlyPaths"! Restricting access with these options hence does not extend to submounts of
a directory that are created later on. This means the lock-down offered by that setting is not complete,
and does not offer full protection.
Note that the effect of these settings may be undone by privileged processes. In order to set up an
effective sandboxed environment for a unit it is thus recommended to combine these settings with either
"CapabilityBoundingSet=~CAP_SYS_ADMIN" or "SystemCallFilter=~@mount".
Please be extra careful when applying these options to API file systems (a list of them could be found in
"MountAPIVPS"), since they may be required for basic system functionalities. Moreover, "/run/" needs to
be writable for setting up mount namespace and propagation.
Simple allow-list example using these directives:
[Service]
ReadOnlyPaths=/
ReadWritePaths=/var /run
InaccessiblePaths=-/lost+found
NoExecPaths=/
ExecPaths=/usr/sbin/my_daemon /usr/lib /usr/lib64
. I< Optional. Type list of uniline. >
TemporaryFileSystem
Takes a space-separated list of mount points for temporary file systems (tmpfs). If set, a new file
system namespace is set up for executed processes, and a temporary file system is mounted on each mount
point. This option may be specified more than once, in which case temporary file systems are mounted on
all listed mount points. If the empty string is assigned to this option, the list is reset, and all prior
assignments have no effect. Each mount point may optionally be suffixed with a colon (":") and mount
options such as "size=10%" or "ro". By default, each temporary file system is mounted with
"nodev,strictatime,mode=0755". These can be disabled by explicitly specifying the corresponding mount
options, e.g., "dev" or "nostrictatime".
This is useful to hide files or directories not relevant to the processes invoked by the unit, while
necessary files or directories can be still accessed by combining with "BindPaths" or
"BindReadOnlyPaths":
Example: if a unit has the following,
TemporaryFileSystem=/var:ro
BindReadOnlyPaths=/var/lib/systemd
then the invoked processes by the unit cannot see any files or directories under "/var/" except for
"/var/lib/systemd" or its contents. Optional. Type list of uniline.
PrivateTmp
Takes a boolean argument. If true, sets up a new file system namespace for the executed processes and
mounts private "/tmp/" and "/var/tmp/" directories inside it that are not shared by processes outside of
the namespace. This is useful to secure access to temporary files of the process, but makes sharing
between processes via "/tmp/" or "/var/tmp/" impossible. If true, all temporary files created by a
service in these directories will be removed after the service is stopped. Defaults to false. It is
possible to run two or more units within the same private "/tmp/" and "/var/tmp/" namespace by using the
"JoinsNamespaceOf" directive, see systemd.unit(5) for details. This setting is implied if "DynamicUser"
is set. For this setting, the same restrictions regarding mount propagation and privileges apply as for
"ReadOnlyPaths" and related calls, see above. Enabling this setting has the side effect of adding
"Requires" and "After" dependencies on all mount units necessary to access "/tmp/" and "/var/tmp/".
Moreover an implicitly "After" ordering on systemd-tmpfiles-setup.service(8) is added.
Note that the implementation of this setting might be impossible (for example if mount namespaces are not
available), and the unit should be written in a way that does not solely rely on this setting for
security. Optional. Type boolean.
PrivateDevices
Takes a boolean argument. If true, sets up a new "/dev/" mount for the executed processes and only adds
API pseudo devices such as "/dev/null", "/dev/zero" or "/dev/random" (as well as the pseudo TTY
subsystem) to it, but no physical devices such as "/dev/sda", system memory "/dev/mem", system ports
"/dev/port" and others. This is useful to turn off physical device access by the executed process.
Defaults to false.
Enabling this option will install a system call filter to block low-level I/O system calls that are
grouped in the "@raw-io" set, remove "CAP_MKNOD" and "CAP_SYS_RAWIO" from the capability bounding set for
the unit, and set "DevicePolicy=closed" (see systemd.resource-control(5) for details). Note that using
this setting will disconnect propagation of mounts from the service to the host (propagation in the
opposite direction continues to work). This means that this setting may not be used for services which
shall be able to install mount points in the main mount namespace. The new "/dev/" will be mounted read-
only and 'noexec'. The latter may break old programs which try to set up executable memory by using
mmap(2) of "/dev/zero" instead of using "MAP_ANON". For this setting the same restrictions regarding
mount propagation and privileges apply as for "ReadOnlyPaths" and related calls, see above.
Note that the implementation of this setting might be impossible (for example if mount namespaces are not
available), and the unit should be written in a way that does not solely rely on this setting for
security.
When access to some but not all devices must be possible, the "DeviceAllow" setting might be used
instead. See systemd.resource-control(5). Optional. Type boolean.
PrivateNetwork
Takes a boolean argument. If true, sets up a new network namespace for the executed processes and
configures only the loopback network device "lo" inside it. No other network devices will be available to
the executed process. This is useful to turn off network access by the executed process. Defaults to
false. It is possible to run two or more units within the same private network namespace by using the
"JoinsNamespaceOf" directive, see systemd.unit(5) for details. Note that this option will disconnect all
socket families from the host, including "AF_NETLINK" and "AF_UNIX". Effectively, for "AF_NETLINK" this
means that device configuration events received from systemd-udevd.service(8) are not delivered to the
unit's processes. And for "AF_UNIX" this has the effect that "AF_UNIX" sockets in the abstract socket
namespace of the host will become unavailable to the unit's processes (however, those located in the file
system will continue to be accessible).
Note that the implementation of this setting might be impossible (for example if network namespaces are
not available), and the unit should be written in a way that does not solely rely on this setting for
security.
When this option is enabled, "PrivateMounts" is implied unless it is explicitly disabled, and "/sys" will
be remounted to associate it with the new network namespace.
When this option is used on a socket unit any sockets bound on behalf of this unit will be bound within a
private network namespace. This may be combined with "JoinsNamespaceOf" to listen on sockets inside of
network namespaces of other services. Optional. Type boolean.
NetworkNamespacePath
Takes an absolute file system path referring to a Linux network namespace pseudo-file (i.e. a file like
"/proc/$PID/ns/net" or a bind mount or symlink to one). When set the invoked processes are added to the
network namespace referenced by that path. The path has to point to a valid namespace file at the moment
the processes are forked off. If this option is used "PrivateNetwork" has no effect. If this option is
used together with "JoinsNamespaceOf" then it only has an effect if this unit is started before any of
the listed units that have "PrivateNetwork" or "NetworkNamespacePath" configured, as otherwise the
network namespace of those units is reused.
When this option is enabled, "PrivateMounts" is implied unless it is explicitly disabled, and "/sys" will
be remounted to associate it with the new network namespace.
When this option is used on a socket unit any sockets bound on behalf of this unit will be bound within
the specified network namespace. Optional. Type uniline.
PrivateIPC
Takes a boolean argument. If true, sets up a new IPC namespace for the executed processes. Each IPC
namespace has its own set of System V IPC identifiers and its own POSIX message queue file system. This
is useful to avoid name clash of IPC identifiers. Defaults to false. It is possible to run two or more
units within the same private IPC namespace by using the "JoinsNamespaceOf" directive, see
systemd.unit(5) for details.
Note that IPC namespacing does not have an effect on "AF_UNIX" sockets, which are the most common form of
IPC used on Linux. Instead, "AF_UNIX" sockets in the file system are subject to mount namespacing, and
those in the abstract namespace are subject to network namespacing. IPC namespacing only has an effect
on SysV IPC (which is mostly legacy) as well as POSIX message queues (for which
"AF_UNIX"/"SOCK_SEQPACKET" sockets are typically a better replacement). IPC namespacing also has no
effect on POSIX shared memory (which is subject to mount namespacing) either. See ipc_namespaces(7) for
the details.
Note that the implementation of this setting might be impossible (for example if IPC namespaces are not
available), and the unit should be written in a way that does not solely rely on this setting for
security. Optional. Type boolean.
IPCNamespacePath
Takes an absolute file system path referring to a Linux IPC namespace pseudo-file (i.e. a file like
"/proc/$PID/ns/ipc" or a bind mount or symlink to one). When set the invoked processes are added to the
network namespace referenced by that path. The path has to point to a valid namespace file at the moment
the processes are forked off. If this option is used "PrivateIPC" has no effect. If this option is used
together with "JoinsNamespaceOf" then it only has an effect if this unit is started before any of the
listed units that have "PrivateIPC" or "IPCNamespacePath" configured, as otherwise the network namespace
of those units is reused. Optional. Type uniline.
MemoryKSM
Takes a boolean argument. When set, it enables KSM (kernel samepage merging) for the processes. KSM is a
memory-saving de-duplication feature. Anonymous memory pages with identical content can be replaced by a
single write-protected page. This feature should only be enabled for jobs that share the same security
domain. For details, see Kernel Samepage Merging <https://docs.kernel.org/admin-guide/mm/ksm.html> in the
kernel documentation.
Note that this functionality might not be available, for example if KSM is disabled in the kernel, or the
kernel doesn't support controlling KSM at the process level through prctl(2). Optional. Type boolean.
PrivateUsers
Takes a boolean argument. If true, sets up a new user namespace for the executed processes and configures
a minimal user and group mapping, that maps the "root" user and group as well as the unit's own user and
group to themselves and everything else to the "nobody" user and group. This is useful to securely detach
the user and group databases used by the unit from the rest of the system, and thus to create an
effective sandbox environment. All files, directories, processes, IPC objects and other resources owned
by users/groups not equaling "root" or the unit's own will stay visible from within the unit but appear
owned by the "nobody" user and group. If this mode is enabled, all unit processes are run without
privileges in the host user namespace (regardless if the unit's own user/group is "root" or not).
Specifically this means that the process will have zero process capabilities on the host's user
namespace, but full capabilities within the service's user namespace. Settings such as
"CapabilityBoundingSet" will affect only the latter, and there's no way to acquire additional
capabilities in the host's user namespace. Defaults to off.
When this setting is set up by a per-user instance of the service manager, the mapping of the "root" user
and group to itself is omitted (unless the user manager is root). Additionally, in the per-user instance
manager case, the user namespace will be set up before most other namespaces. This means that combining
"PrivateUsers""true" with other namespaces will enable use of features not normally supported by the per-
user instances of the service manager.
This setting is particularly useful in conjunction with "RootDirectory"/"RootImage", as the need to
synchronize the user and group databases in the root directory and on the host is reduced, as the only
users and groups who need to be matched are "root", "nobody" and the unit's own user and group.
Note that the implementation of this setting might be impossible (for example if user namespaces are not
available), and the unit should be written in a way that does not solely rely on this setting for
security. Optional. Type boolean.
ProtectHostname
Takes a boolean argument. When set, sets up a new UTS namespace for the executed processes. In addition,
changing hostname or domainname is prevented. Defaults to off.
Note that the implementation of this setting might be impossible (for example if UTS namespaces are not
available), and the unit should be written in a way that does not solely rely on this setting for
security.
Note that when this option is enabled for a service hostname changes no longer propagate from the system
into the service, it is hence not suitable for services that need to take notice of system hostname
changes dynamically. Optional. Type boolean.
ProtectClock
Takes a boolean argument. If set, writes to the hardware clock or system clock will be denied. Defaults
to off. Enabling this option removes "CAP_SYS_TIME" and "CAP_WAKE_ALARM" from the capability bounding set
for this unit, installs a system call filter to block calls that can set the clock, and
"DeviceAllow=char-rtc r" is implied. Note that the system calls are blocked altogether, the filter does
not take into account that some of the calls can be used to read the clock state with some parameter
combinations. Effectively, "/dev/rtc0", "/dev/rtc1", etc. are made read-only to the service. See
systemd.resource-control(5) for the details about "DeviceAllow".
It is recommended to turn this on for most services that do not need modify the clock or check its state.
Optional. Type boolean.
ProtectKernelTunables
Takes a boolean argument. If true, kernel variables accessible through "/proc/sys/", "/sys/",
"/proc/sysrq-trigger", "/proc/latency_stats", "/proc/acpi", "/proc/timer_stats", "/proc/fs" and
"/proc/irq" will be made read-only and "/proc/kallsyms" as well as "/proc/kcore" will be inaccessible to
all processes of the unit. Usually, tunable kernel variables should be initialized only at boot-time,
for example with the sysctl.d(5) mechanism. Few services need to write to these at runtime; it is hence
recommended to turn this on for most services. For this setting the same restrictions regarding mount
propagation and privileges apply as for "ReadOnlyPaths" and related calls, see above. Defaults to off.
Note that this option does not prevent indirect changes to kernel tunables effected by IPC calls to other
processes. However, "InaccessiblePaths" may be used to make relevant IPC file system objects
inaccessible. If "ProtectKernelTunables" is set, "MountAPIVFS=yes" is implied. Optional. Type boolean.
ProtectKernelModules
Takes a boolean argument. If true, explicit module loading will be denied. This allows module load and
unload operations to be turned off on modular kernels. It is recommended to turn this on for most
services that do not need special file systems or extra kernel modules to work. Defaults to off. Enabling
this option removes "CAP_SYS_MODULE" from the capability bounding set for the unit, and installs a system
call filter to block module system calls, also "/usr/lib/modules" is made inaccessible. For this setting
the same restrictions regarding mount propagation and privileges apply as for "ReadOnlyPaths" and related
calls, see above. Note that limited automatic module loading due to user configuration or kernel mapping
tables might still happen as side effect of requested user operations, both privileged and unprivileged.
To disable module auto-load feature please see sysctl.d(5)"kernel.modules_disabled" mechanism and
"/proc/sys/kernel/modules_disabled" documentation. Optional. Type boolean.
ProtectKernelLogs
Takes a boolean argument. If true, access to the kernel log ring buffer will be denied. It is recommended
to turn this on for most services that do not need to read from or write to the kernel log ring buffer.
Enabling this option removes "CAP_SYSLOG" from the capability bounding set for this unit, and installs a
system call filter to block the syslog(2) system call (not to be confused with the libc API syslog(3) for
userspace logging). The kernel exposes its log buffer to userspace via "/dev/kmsg" and "/proc/kmsg". If
enabled, these are made inaccessible to all the processes in the unit. Optional. Type boolean.
ProtectControlGroups
Takes a boolean argument. If true, the Linux Control Groups (cgroups(7)) hierarchies accessible through
"/sys/fs/cgroup/" will be made read-only to all processes of the unit. Except for container managers no
services should require write access to the control groups hierarchies; it is hence recommended to turn
this on for most services. For this setting the same restrictions regarding mount propagation and
privileges apply as for "ReadOnlyPaths" and related calls, see above. Defaults to off. If
"ProtectControlGroups" is set, "MountAPIVFS=yes" is implied. Optional. Type boolean.
RestrictAddressFamilies
Restricts the set of socket address families accessible to the processes of this unit. Takes "none", or a
space-separated list of address family names to allow-list, such as "AF_UNIX", "AF_INET" or "AF_INET6".
When "none" is specified, then all address families will be denied. When prefixed with "~" the listed
address families will be applied as deny list, otherwise as allow list. Note that this restricts access
to the socket(2) system call only. Sockets passed into the process by other means (for example, by using
socket activation with socket units, see systemd.socket(5)) are unaffected. Also, sockets created with
socketpair() (which creates connected AF_UNIX sockets only) are unaffected. Note that this option has no
effect on 32-bit x86, s390, s390x, mips, mips-le, ppc, ppc-le, ppc64, ppc64-le and is ignored (but works
correctly on other ABIs, including x86-64). Note that on systems supporting multiple ABIs (such as
x86/x86-64) it is recommended to turn off alternative ABIs for services, so that they cannot be used to
circumvent the restrictions of this option. Specifically, it is recommended to combine this option with
"SystemCallArchitectures=native" or similar. By default, no restrictions apply, all address families are
accessible to processes. If assigned the empty string, any previous address family restriction changes
are undone. This setting does not affect commands prefixed with "+".
Use this option to limit exposure of processes to remote access, in particular via exotic and sensitive
network protocols, such as "AF_PACKET". Note that in most cases, the local "AF_UNIX" address family
should be included in the configured allow list as it is frequently used for local communication,
including for syslog(2) logging. Optional. Type uniline.
RestrictFileSystems
Restricts the set of filesystems processes of this unit can open files on. Takes a space-separated list
of filesystem names. Any filesystem listed is made accessible to the unit's processes, access to
filesystem types not listed is prohibited (allow-listing). If the first character of the list is "~", the
effect is inverted: access to the filesystems listed is prohibited (deny-listing). If the empty string is
assigned, access to filesystems is not restricted.
If you specify both types of this option (i.e. allow-listing and deny-listing), the first encountered
will take precedence and will dictate the default action (allow access to the filesystem or deny it).
Then the next occurrences of this option will add or delete the listed filesystems from the set of the
restricted filesystems, depending on its type and the default action.
Example: if a unit has the following,
RestrictFileSystems=ext4 tmpfs
RestrictFileSystems=ext2 ext4
then access to "ext4", "tmpfs", and "ext2" is allowed and access to other filesystems is denied.
Example: if a unit has the following,
RestrictFileSystems=ext4 tmpfs
RestrictFileSystems=~ext4
then only access "tmpfs" is allowed.
Example: if a unit has the following,
RestrictFileSystems=~ext4 tmpfs
RestrictFileSystems=ext4
then only access to "tmpfs" is denied.
As the number of possible filesystems is large, predefined sets of filesystems are provided. A set starts
with "@" character, followed by name of the set.
Use systemd-analyze(1)'s filesystems command to retrieve a list of filesystems defined on the local
system.
Note that this setting might not be supported on some systems (for example if the LSM eBPF hook is not
enabled in the underlying kernel or if not using the unified control group hierarchy). In that case this
setting has no effect. Optional. Type uniline.
RestrictNamespaces
Restricts access to Linux namespace functionality for the processes of this unit. For details about Linux
namespaces, see namespaces(7). Either takes a boolean argument, or a space-separated list of namespace
type identifiers. If false (the default), no restrictions on namespace creation and switching are made.
If true, access to any kind of namespacing is prohibited. Otherwise, a space-separated list of namespace
type identifiers must be specified, consisting of any combination of: "cgroup", "ipc", "net", "mnt",
"pid", "user" and "uts". Any namespace type listed is made accessible to the unit's processes, access to
namespace types not listed is prohibited (allow-listing). By prepending the list with a single tilde
character ("~") the effect may be inverted: only the listed namespace types will be made inaccessible,
all unlisted ones are permitted (deny-listing). If the empty string is assigned, the default namespace
restrictions are applied, which is equivalent to false. This option may appear more than once, in which
case the namespace types are merged by "OR", or by "AND" if the lines are prefixed with "~" (see examples
below). Internally, this setting limits access to the unshare(2), clone(2) and setns(2) system calls,
taking the specified flags parameters into account. Note that — if this option is used — in addition to
restricting creation and switching of the specified types of namespaces (or all of them, if true) access
to the setns() system call with a zero flags parameter is prohibited. This setting is only supported on
x86, x86-64, mips, mips-le, mips64, mips64-le, mips64-n32, mips64-le-n32, ppc64, ppc64-le, s390 and
s390x, and enforces no restrictions on other architectures.
Example: if a unit has the following,
RestrictNamespaces=cgroup ipc
RestrictNamespaces=cgroup net
then "cgroup", "ipc", and "net" are set. If the second line is prefixed with "~", e.g.,
RestrictNamespaces=cgroup ipc
RestrictNamespaces=~cgroup net
then, only "ipc" is set. Optional. Type uniline.
LockPersonality
Takes a boolean argument. If set, locks down the personality(2) system call so that the kernel execution
domain may not be changed from the default or the personality selected with "Personality" directive. This
may be useful to improve security, because odd personality emulations may be poorly tested and source of
vulnerabilities. Optional. Type boolean.
MemoryDenyWriteExecute
Takes a boolean argument. If set, attempts to create memory mappings that are writable and executable at
the same time, or to change existing memory mappings to become executable, or mapping shared memory
segments as executable, are prohibited. Specifically, a system call filter is added (or preferably, an
equivalent kernel check is enabled with prctl(2)) that rejects mmap(2) system calls with both "PROT_EXEC"
and "PROT_WRITE" set, mprotect(2) or pkey_mprotect(2) system calls with "PROT_EXEC" set and shmat(2)
system calls with "SHM_EXEC" set. Note that this option is incompatible with programs and libraries that
generate program code dynamically at runtime, including JIT execution engines, executable stacks, and
code "trampoline" feature of various C compilers. This option improves service security, as it makes
harder for software exploits to change running code dynamically. However, the protection can be
circumvented, if the service can write to a filesystem, which is not mounted with "noexec" (such as
"/dev/shm"), or it can use memfd_create(). This can be prevented by making such file systems inaccessible
to the service (e.g. "InaccessiblePaths=/dev/shm") and installing further system call filters
("SystemCallFilter=~memfd_create"). Note that this feature is fully available on x86-64, and partially on
x86. Specifically, the shmat() protection is not available on x86. Note that on systems supporting
multiple ABIs (such as x86/x86-64) it is recommended to turn off alternative ABIs for services, so that
they cannot be used to circumvent the restrictions of this option. Specifically, it is recommended to
combine this option with "SystemCallArchitectures=native" or similar. Optional. Type boolean.
RestrictRealtime
Takes a boolean argument. If set, any attempts to enable realtime scheduling in a process of the unit are
refused. This restricts access to realtime task scheduling policies such as "SCHED_FIFO", "SCHED_RR" or
"SCHED_DEADLINE". See sched(7) for details about these scheduling policies. Realtime scheduling policies
may be used to monopolize CPU time for longer periods of time, and may hence be used to lock up or
otherwise trigger Denial-of-Service situations on the system. It is hence recommended to restrict access
to realtime scheduling to the few programs that actually require them. Defaults to off. Optional. Type
boolean.
RestrictSUIDSGID
Takes a boolean argument. If set, any attempts to set the set-user-ID (SUID) or set-group-ID (SGID) bits
on files or directories will be denied (for details on these bits see inode(7)). As the SUID/SGID bits
are mechanisms to elevate privileges, and allow users to acquire the identity of other users, it is
recommended to restrict creation of SUID/SGID files to the few programs that actually require them. Note
that this restricts marking of any type of file system object with these bits, including both regular
files and directories (where the SGID is a different meaning than for files, see documentation). This
option is implied if "DynamicUser" is enabled. Defaults to off. Optional. Type boolean.
RemoveIPC
Takes a boolean parameter. If set, all System V and POSIX IPC objects owned by the user and group the
processes of this unit are run as are removed when the unit is stopped. This setting only has an effect
if at least one of "User", "Group" and "DynamicUser" are used. It has no effect on IPC objects owned by
the root user. Specifically, this removes System V semaphores, as well as System V and POSIX shared
memory segments and message queues. If multiple units use the same user or group the IPC objects are
removed when the last of these units is stopped. This setting is implied if "DynamicUser" is set.
Optional. Type boolean.
PrivateMounts
Takes a boolean parameter. If set, the processes of this unit will be run in their own private file
system (mount) namespace with all mount propagation from the processes towards the host's main file
system namespace turned off. This means any file system mount points established or removed by the unit's
processes will be private to them and not be visible to the host. However, file system mount points
established or removed on the host will be propagated to the unit's processes. See mount_namespaces(7)
for details on file system namespaces. Defaults to off.
When turned on, this executes three operations for each invoked process: a new "CLONE_NEWNS" namespace is
created, after which all existing mounts are remounted to "MS_SLAVE" to disable propagation from the
unit's processes to the host (but leaving propagation in the opposite direction in effect). Finally, the
mounts are remounted again to the propagation mode configured with "MountFlags", see below.
File system namespaces are set up individually for each process forked off by the service manager. Mounts
established in the namespace of the process created by "ExecStartPre" will hence be cleaned up
automatically as soon as that process exits and will not be available to subsequent processes forked off
for "ExecStart" (and similar applies to the various other commands configured for units). Similarly,
"JoinsNamespaceOf" does not permit sharing kernel mount namespaces between units, it only enables sharing
of the "/tmp/" and "/var/tmp/" directories.
Other file system namespace unit settings — "PrivateTmp", "PrivateDevices", "ProtectSystem",
"ProtectHome", "ReadOnlyPaths", "InaccessiblePaths", "ReadWritePaths", "BindPaths", "BindReadOnlyPaths",
… — also enable file system namespacing in a fashion equivalent to this option. Hence it is primarily
useful to explicitly request this behaviour if none of the other settings are used. Optional. Type
boolean.
MountFlags
Takes a mount propagation setting: "shared", "slave" or "private", which controls whether file system
mount points in the file system namespaces set up for this unit's processes will receive or propagate
mounts and unmounts from other file system namespaces. See mount(2) for details on mount propagation, and
the three propagation flags in particular.
This setting only controls the final propagation setting in effect on all mount points of the file system
namespace created for each process of this unit. Other file system namespacing unit settings (see the
discussion in "PrivateMounts" above) will implicitly disable mount and unmount propagation from the
unit's processes towards the host by changing the propagation setting of all mount points in the unit's
file system namespace to "slave" first. Setting this option to "shared" does not reestablish propagation
in that case.
If not set – but file system namespaces are enabled through another file system namespace unit setting –
"shared" mount propagation is used, but — as mentioned — as "slave" is applied first, propagation from
the unit's processes to the host is still turned off.
It is not recommended to use "private" mount propagation for units, as this means temporary mounts (such
as removable media) of the host will stay mounted and thus indefinitely busy in forked off processes, as
unmount propagation events won't be received by the file system namespace of the unit.
Usually, it is best to leave this setting unmodified, and use higher level file system namespacing
options instead, in particular "PrivateMounts", see above. Optional. Type uniline.
SystemCallFilter
Takes a space-separated list of system call names. If this setting is used, all system calls executed by
the unit processes except for the listed ones will result in immediate process termination with the
"SIGSYS" signal (allow-listing). (See "SystemCallErrorNumber" below for changing the default action). If
the first character of the list is "~", the effect is inverted: only the listed system calls will result
in immediate process termination (deny-listing). Deny-listed system calls and system call groups may
optionally be suffixed with a colon (":") and "errno" error number (between 0 and 4095) or errno name
such as "EPERM", "EACCES" or "EUCLEAN" (see errno(3) for a full list). This value will be returned when a
deny-listed system call is triggered, instead of terminating the processes immediately. Special setting
"kill" can be used to explicitly specify killing. This value takes precedence over the one given in
"SystemCallErrorNumber", see below. This feature makes use of the Secure Computing Mode 2 interfaces of
the kernel ('seccomp filtering') and is useful for enforcing a minimal sandboxing environment. Note that
the execve(), exit(), exit_group(), getrlimit(), rt_sigreturn(), sigreturn() system calls and the system
calls for querying time and sleeping are implicitly allow-listed and do not need to be listed explicitly.
This option may be specified more than once, in which case the filter masks are merged. If the empty
string is assigned, the filter is reset, all prior assignments will have no effect. This does not affect
commands prefixed with "+".
Note that on systems supporting multiple ABIs (such as x86/x86-64) it is recommended to turn off
alternative ABIs for services, so that they cannot be used to circumvent the restrictions of this option.
Specifically, it is recommended to combine this option with "SystemCallArchitectures=native" or similar.
Note that strict system call filters may impact execution and error handling code paths of the service
invocation. Specifically, access to the execve() system call is required for the execution of the service
binary — if it is blocked service invocation will necessarily fail. Also, if execution of the service
binary fails for some reason (for example: missing service executable), the error handling logic might
require access to an additional set of system calls in order to process and log this failure correctly.
It might be necessary to temporarily disable system call filters in order to simplify debugging of such
failures.
If you specify both types of this option (i.e. allow-listing and deny-listing), the first encountered
will take precedence and will dictate the default action (termination or approval of a system call). Then
the next occurrences of this option will add or delete the listed system calls from the set of the
filtered system calls, depending of its type and the default action. (For example, if you have started
with an allow list rule for read() and write(), and right after it add a deny list rule for write(), then
write() will be removed from the set.)
As the number of possible system calls is large, predefined sets of system calls are provided. A set
starts with "@" character, followed by name of the set. Currently predefined system call
setsSetDescription@aioAsynchronous I/O (io_setup(2), io_submit(2), and related calls)@basic-ioSystem
calls for basic I/O: reading, writing, seeking, file descriptor duplication and closing (read(2),
write(2), and related calls)@chownChanging file ownership (chown(2), fchownat(2), and related
calls)@clockSystem calls for changing the system clock (adjtimex(2), settimeofday(2), and related
calls)@cpu-emulationSystem calls for CPU emulation functionality (vm86(2) and related
calls)@debugDebugging, performance monitoring and tracing functionality (ptrace(2), perf_event_open(2)
and related calls)@file-systemFile system operations: opening, creating files and directories for read
and write, renaming and removing them, reading file properties, or creating hard and symbolic
links@io-eventEvent loop system calls (poll(2), select(2), epoll(7), eventfd(2) and related
calls)@ipcPipes, SysV IPC, POSIX Message Queues and other IPC (mq_overview(7), svipc(7))@keyringKernel
keyring access (keyctl(2) and related calls)@memlockLocking of memory in RAM (mlock(2), mlockall(2) and
related calls)@moduleLoading and unloading of kernel modules (init_module(2), delete_module(2) and
related calls)@mountMounting and unmounting of file systems (mount(2), chroot(2), and related
calls)@network-ioSocket I/O (including local AF_UNIX): socket(7), unix(7)@obsoleteUnusual, obsolete or
unimplemented (create_module(2), gtty(2), …)@pkeySystem calls that deal with memory protection keys
(pkeys(7))@privilegedAll system calls which need super-user capabilities (capabilities(7))@processProcess
control, execution, namespacing operations (clone(2), kill(2), namespaces(7), …)@raw-ioRaw I/O port
access (ioperm(2), iopl(2), pciconfig_read(), …)@rebootSystem calls for rebooting and reboot preparation
(reboot(2), kexec(), …)@resourcesSystem calls for changing resource limits, memory and scheduling
parameters (setrlimit(2), setpriority(2), …)@sandboxSystem calls for sandboxing programs (seccomp(2),
Landlock system calls, …)@setuidSystem calls for changing user ID and group ID credentials, (setuid(2),
setgid(2), setresuid(2), …)@signalSystem calls for manipulating and handling process signals (signal(2),
sigprocmask(2), …)@swapSystem calls for enabling/disabling swap devices (swapon(2),
swapoff(2))@syncSynchronizing files and memory to disk (fsync(2), msync(2), and related
calls)@system-serviceA reasonable set of system calls used by common system services, excluding any
special purpose calls. This is the recommended starting point for allow-listing system calls for system
services, as it contains what is typically needed by system services, but excludes overly specific
interfaces. For example, the following APIs are excluded: @clock, @mount, @swap, @reboot.@timerSystem
calls for scheduling operations by time (alarm(2), timer_create(2), …)@knownAll system calls defined by
the kernel. This list is defined statically in systemd based on a kernel version that was available when
this systemd version was released. It will become progressively more out-of-date as the kernel is
updated. Note, that as new system calls are added to the kernel, additional system calls might be added
to the groups above. Contents of the sets may also change between systemd versions. In addition, the list
of system calls depends on the kernel version and architecture for which systemd was compiled. Use
systemd-analyze syscall-filter to list the actual list of system calls in each filter.
Generally, allow-listing system calls (rather than deny-listing) is the safer mode of operation. It is
recommended to enforce system call allow lists for all long-running system services. Specifically, the
following lines are a relatively safe basic choice for the majority of system services:
[Service]
SystemCallFilter=@system-service
SystemCallErrorNumber=EPERM
Note that various kernel system calls are defined redundantly: there are multiple system calls for
executing the same operation. For example, the pidfd_send_signal() system call may be used to execute
operations similar to what can be done with the older kill() system call, hence blocking the latter
without the former only provides weak protection. Since new system calls are added regularly to the
kernel as development progresses, keeping system call deny lists comprehensive requires constant work. It
is thus recommended to use allow-listing instead, which offers the benefit that new system calls are by
default implicitly blocked until the allow list is updated.
Also note that a number of system calls are required to be accessible for the dynamic linker to work. The
dynamic linker is required for running most regular programs (specifically: all dynamic ELF binaries,
which is how most distributions build packaged programs). This means that blocking these system calls
(which include open(), openat() or mmap()) will make most programs typically shipped with generic
distributions unusable.
It is recommended to combine the file system namespacing related options with "SystemCallFilter=~@mount",
in order to prohibit the unit's processes to undo the mappings. Specifically these are the options
"PrivateTmp", "PrivateDevices", "ProtectSystem", "ProtectHome", "ProtectKernelTunables",
"ProtectControlGroups", "ProtectKernelLogs", "ProtectClock", "ReadOnlyPaths", "InaccessiblePaths" and
"ReadWritePaths". Optional. Type list of uniline.
SystemCallErrorNumber
Takes an "errno" error number (between 1 and 4095) or errno name such as "EPERM", "EACCES" or "EUCLEAN",
to return when the system call filter configured with "SystemCallFilter" is triggered, instead of
terminating the process immediately. See errno(3) for a full list of error codes. When this setting is
not used, or when the empty string or the special setting "kill" is assigned, the process will be
terminated immediately when the filter is triggered. Optional. Type uniline.
SystemCallArchitectures
Takes a space-separated list of architecture identifiers to include in the system call filter. The known
architecture identifiers are the same as for "ConditionArchitecture" described in systemd.unit(5), as
well as "x32", "mips64-n32", "mips64-le-n32", and the special identifier "native". The special identifier
"native" implicitly maps to the native architecture of the system (or more precisely: to the architecture
the system manager is compiled for). By default, this option is set to the empty list, i.e. no filtering
is applied.
If this setting is used, processes of this unit will only be permitted to call native system calls, and
system calls of the specified architectures. For the purposes of this option, the x32 architecture is
treated as including x86-64 system calls. However, this setting still fulfills its purpose, as explained
below, on x32.
System call filtering is not equally effective on all architectures. For example, on x86 filtering of
network socket-related calls is not possible, due to ABI limitations — a limitation that x86-64 does not
have, however. On systems supporting multiple ABIs at the same time — such as x86/x86-64 — it is hence
recommended to limit the set of permitted system call architectures so that secondary ABIs may not be
used to circumvent the restrictions applied to the native ABI of the system. In particular, setting
"SystemCallArchitectures=native" is a good choice for disabling non-native ABIs.
System call architectures may also be restricted system-wide via the "SystemCallArchitectures" option in
the global configuration. See systemd-system.conf(5) for details. Optional. Type uniline.
SystemCallLog
Takes a space-separated list of system call names. If this setting is used, all system calls executed by
the unit processes for the listed ones will be logged. If the first character of the list is "~", the
effect is inverted: all system calls except the listed system calls will be logged. This feature makes
use of the Secure Computing Mode 2 interfaces of the kernel ('seccomp filtering') and is useful for
auditing or setting up a minimal sandboxing environment. This option may be specified more than once, in
which case the filter masks are merged. If the empty string is assigned, the filter is reset, all prior
assignments will have no effect. This does not affect commands prefixed with "+". Optional. Type list
of uniline.
Environment
Sets environment variables for executed processes. Each line is unquoted using the rules described in
"Quoting" section in systemd.syntax(7) and becomes a list of variable assignments. If you need to assign
a value containing spaces or the equals sign to a variable, put quotes around the whole assignment.
Variable expansion is not performed inside the strings and the "$" character has no special meaning.
Specifier expansion is performed, see the "Specifiers" section in systemd.unit(5).
This option may be specified more than once, in which case all listed variables will be set. If the same
variable is listed twice, the later setting will override the earlier setting. If the empty string is
assigned to this option, the list of environment variables is reset, all prior assignments have no
effect.
The names of the variables can contain ASCII letters, digits, and the underscore character. Variable
names cannot be empty or start with a digit. In variable values, most characters are allowed, but non-
printable characters are currently rejected.
Example:
Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"
gives three variables "VAR1", "VAR2", "VAR3" with the values "word1 word2", "word3", "$word 5 6".
See environ(7) for details about environment variables.
Note that environment variables are not suitable for passing secrets (such as passwords, key material, …)
to service processes. Environment variables set for a unit are exposed to unprivileged clients via D-Bus
IPC, and generally not understood as being data that requires protection. Moreover, environment variables
are propagated down the process tree, including across security boundaries (such as setuid/setgid
executables), and hence might leak to processes that should not have access to the secret data. Use
"LoadCredential", "LoadCredentialEncrypted" or "SetCredentialEncrypted" (see below) to pass data to unit
processes securely. Optional. Type list of uniline.
EnvironmentFile
Similar to "Environment", but reads the environment variables from a text file. The text file should
contain newline-separated variable assignments. Empty lines, lines without an "=" separator, or lines
starting with ";" or "#" will be ignored, which may be used for commenting. The file must be encoded with
UTF-8. Valid characters are unicode scalar values
<https://www.unicode.org/glossary/#unicode_scalar_value> other than unicode noncharacters
<https://www.unicode.org/glossary/#noncharacter>, "U+0000" "NUL", and "U+FEFF"unicode byte order mark
<https://www.unicode.org/glossary/#byte_order_mark>. Control codes other than "NUL" are allowed.
In the file, an unquoted value after the "=" is parsed with the same backslash-escape rules as POSIX
shell unquoted text
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_01>, but unlike in a
shell, interior whitespace is preserved and quotes after the first non-whitespace character are
preserved. Leading and trailing whitespace (space, tab, carriage return) is discarded, but interior
whitespace within the line is preserved verbatim. A line ending with a backslash will be continued to the
following one, with the newline itself discarded. A backslash "\" followed by any character other than
newline will preserve the following character, so that "\\" will become the value "\".
In the file, a "'"-quoted value after the "=" can span multiple lines and contain any character verbatim
other than single quote, like POSIX shell single-quoted text
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_02>. No backslash-
escape sequences are recognized. Leading and trailing whitespace outside of the single quotes is
discarded.
In the file, a """-quoted value after the "=" can span multiple lines, and the same escape sequences are
recognized as in POSIX shell double-quoted text
<https://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_02_03>. Backslash
("\") followed by any of ""\`$" will preserve that character. A backslash followed by newline is a line
continuation, and the newline itself is discarded. A backslash followed by any other character is
ignored; both the backslash and the following character are preserved verbatim. Leading and trailing
whitespace outside of the double quotes is discarded.
The argument passed should be an absolute filename or wildcard expression, optionally prefixed with "-",
which indicates that if the file does not exist, it will not be read and no error or warning message is
logged. This option may be specified more than once in which case all specified files are read. If the
empty string is assigned to this option, the list of file to read is reset, all prior assignments have no
effect.
The files listed with this directive will be read shortly before the process is executed (more
specifically, after all processes from a previous unit state terminated. This means you can generate
these files in one unit state, and read it with this option in the next. The files are read from the file
system of the service manager, before any file system changes like bind mounts take place).
Settings from these files override settings made with "Environment". If the same variable is set twice
from these files, the files will be read in the order they are specified and the later setting will
override the earlier setting. Optional. Type list of uniline.
PassEnvironment
Pass environment variables set for the system service manager to executed processes. Takes a space-
separated list of variable names. This option may be specified more than once, in which case all listed
variables will be passed. If the empty string is assigned to this option, the list of environment
variables to pass is reset, all prior assignments have no effect. Variables specified that are not set
for the system manager will not be passed and will be silently ignored. Note that this option is only
relevant for the system service manager, as system services by default do not automatically inherit any
environment variables set for the service manager itself. However, in case of the user service manager
all environment variables are passed to the executed processes anyway, hence this option is without
effect for the user service manager.
Variables set for invoked processes due to this setting are subject to being overridden by those
configured with "Environment" or "EnvironmentFile".
Example:
PassEnvironment=VAR1 VAR2 VAR3
passes three variables "VAR1", "VAR2", "VAR3" with the values set for those variables in PID1.
See environ(7) for details about environment variables. Optional. Type list of uniline.
UnsetEnvironment
Explicitly unset environment variable assignments that would normally be passed from the service manager
to invoked processes of this unit. Takes a space-separated list of variable names or variable
assignments. This option may be specified more than once, in which case all listed variables/assignments
will be unset. If the empty string is assigned to this option, the list of environment
variables/assignments to unset is reset. If a variable assignment is specified (that is: a variable name,
followed by "=", followed by its value), then any environment variable matching this precise assignment
is removed. If a variable name is specified (that is a variable name without any following "=" or value),
then any assignment matching the variable name, regardless of its value is removed. Note that the effect
of "UnsetEnvironment" is applied as final step when the environment list passed to executed processes is
compiled. That means it may undo assignments from any configuration source, including assignments made
through "Environment" or "EnvironmentFile", inherited from the system manager's global set of environment
variables, inherited via "PassEnvironment", set by the service manager itself (such as $NOTIFY_SOCKET and
such), or set by a PAM module (in case "PAMName" is used).
See "Environment Variables in Spawned Processes" below for a description of how those settings combine to
form the inherited environment. See environ(7) for general information about environment variables.
Optional. Type list of uniline.
StandardInput
Controls where file descriptor 0 (STDIN) of the executed processes is connected to. Takes one of "null",
"tty", "tty-force", "tty-fail", "data", "file:path", "socket" or "fd:name".
If "null" is selected, standard input will be connected to "/dev/null", i.e. all read attempts by the
process will result in immediate EOF.
If "tty" is selected, standard input is connected to a TTY (as configured by "TTYPath", see below) and
the executed process becomes the controlling process of the terminal. If the terminal is already being
controlled by another process, the executed process waits until the current controlling process releases
the terminal.
"tty-force" is similar to "tty", but the executed process is forcefully and immediately made the
controlling process of the terminal, potentially removing previous controlling processes from the
terminal.
"tty-fail" is similar to "tty", but if the terminal already has a controlling process start-up of the
executed process fails.
The "data" option may be used to configure arbitrary textual or binary data to pass via standard input to
the executed process. The data to pass is configured via "StandardInputText"/"StandardInputData" (see
below). Note that the actual file descriptor type passed (memory file, regular file, UNIX pipe, …) might
depend on the kernel and available privileges. In any case, the file descriptor is read-only, and when
read returns the specified data followed by EOF.
The "file:path" option may be used to connect a specific file system object to standard input. An
absolute path following the ":" character is expected, which may refer to a regular file, a FIFO or
special file. If an "AF_UNIX" socket in the file system is specified, a stream socket is connected to it.
The latter is useful for connecting standard input of processes to arbitrary system services.
The "socket" option is valid in socket-activated services only, and requires the relevant socket unit
file (see systemd.socket(5) for details) to have "Accept=yes" set, or to specify a single socket only. If
this option is set, standard input will be connected to the socket the service was activated from, which
is primarily useful for compatibility with daemons designed for use with the traditional inetd(8) socket
activation daemon ($LISTEN_FDS (and related) environment variables are not passed when "socket" value is
configured).
The "fd:name" option connects standard input to a specific, named file descriptor provided by a socket
unit. The name may be specified as part of this option, following a ":" character (e.g. "fd:foobar"). If
no name is specified, the name "stdin" is implied (i.e. "fd" is equivalent to "fd:stdin"). At least one
socket unit defining the specified name must be provided via the "Sockets" option, and the file
descriptor name may differ from the name of its containing socket unit. If multiple matches are found,
the first one will be used. See "FileDescriptorName" in systemd.socket(5) for more details about named
file descriptors and their ordering.
This setting defaults to "null", unless "StandardInputText"/"StandardInputData" are set, in which case it
defaults to "data". Optional. Type enum. choice: 'data', 'null', 'socket', 'tty', 'tty-fail',
'tty-force'.
StandardOutput
Controls where file descriptor 1 (stdout) of the executed processes is connected to. Takes one of
"inherit", "null", "tty", "journal", "kmsg", "journal+console", "kmsg+console", "file:path",
"append:path", "truncate:path", "socket" or "fd:name".
"inherit" duplicates the file descriptor of standard input for standard output.
"null" connects standard output to "/dev/null", i.e. everything written to it will be lost.
"tty" connects standard output to a tty (as configured via "TTYPath", see below). If the TTY is used for
output only, the executed process will not become the controlling process of the terminal, and will not
fail or wait for other processes to release the terminal.
"journal" connects standard output with the journal, which is accessible via journalctl(1). Note that
everything that is written to kmsg (see below) is implicitly stored in the journal as well, the specific
option listed below is hence a superset of this one. (Also note that any external, additional syslog
daemons receive their log data from the journal, too, hence this is the option to use when logging shall
be processed with such a daemon.)
"kmsg" connects standard output with the kernel log buffer which is accessible via dmesg(1), in addition
to the journal. The journal daemon might be configured to send all logs to kmsg anyway, in which case
this option is no different from "journal".
"journal+console" and "kmsg+console" work in a similar way as the two options above but copy the output
to the system console as well.
The "file:path" option may be used to connect a specific file system object to standard output. The
semantics are similar to the same option of "StandardInput", see above. If path refers to a regular file
on the filesystem, it is opened (created if it doesn't exist yet using privileges of the user executing
the systemd process) for writing at the beginning of the file, but without truncating it. If standard
input and output are directed to the same file path, it is opened only once — for reading as well as
writing — and duplicated. This is particularly useful when the specified path refers to an "AF_UNIX"
socket in the file system, as in that case only a single stream connection is created for both input and
output.
"append:path" is similar to "file:path" above, but it opens the file in append mode.
"truncate:path" is similar to "file:path" above, but it truncates the file when opening it. For units
with multiple command lines, e.g. "Type=oneshot" services with multiple "ExecStart", or services with
"ExecCondition", "ExecStartPre" or "ExecStartPost", the output file is reopened and therefore re-
truncated for each command line. If the output file is truncated while another process still has the file
open, e.g. by an "ExecReload" running concurrently with an "ExecStart", and the other process continues
writing to the file without adjusting its offset, then the space between the file pointers of the two
processes may be filled with "NUL" bytes, producing a sparse file. Thus, "truncate:path" is typically
only useful for units where only one process runs at a time, such as services with a single "ExecStart"
and no "ExecStartPost", "ExecReload", "ExecStop" or similar.
"socket" connects standard output to a socket acquired via socket activation. The semantics are similar
to the same option of "StandardInput", see above.
The "fd:name" option connects standard output to a specific, named file descriptor provided by a socket
unit. A name may be specified as part of this option, following a ":" character (e.g. "fd:foobar"). If no
name is specified, the name "stdout" is implied (i.e. "fd" is equivalent to "fd:stdout"). At least one
socket unit defining the specified name must be provided via the "Sockets" option, and the file
descriptor name may differ from the name of its containing socket unit. If multiple matches are found,
the first one will be used. See "FileDescriptorName" in systemd.socket(5) for more details about named
descriptors and their ordering.
If the standard output (or error output, see below) of a unit is connected to the journal or the kernel
log buffer, the unit will implicitly gain a dependency of type "After" on "systemd-journald.socket" (also
see the "Implicit Dependencies" section above). Also note that in this case stdout (or stderr, see below)
will be an "AF_UNIX" stream socket, and not a pipe or FIFO that can be reopened. This means when
executing shell scripts the construct echo "hello" > /dev/stderr for writing text to stderr will not
work. To mitigate this use the construct echo "hello" >&2 instead, which is mostly equivalent and avoids
this pitfall.
If "StandardInput" is set to one of "tty", "tty-force", "tty-fail", "socket", or "fd:name", this setting
defaults to "inherit".
In other cases, this setting defaults to the value set with "DefaultStandardOutput" in
systemd-system.conf(5), which defaults to "journal". Note that setting this parameter might result in
additional dependencies to be added to the unit (see above). Optional. Type enum. choice: 'inherit',
'journal', 'journal+console', 'kmsg', 'kmsg+console', 'null', 'socket', 'tty'.
StandardError
Controls where file descriptor 2 (stderr) of the executed processes is connected to. The available
options are identical to those of "StandardOutput", with some exceptions: if set to "inherit" the file
descriptor used for standard output is duplicated for standard error, while "fd:name" will use a default
file descriptor name of "stderr".
This setting defaults to the value set with "DefaultStandardError" in systemd-system.conf(5), which
defaults to "inherit". Note that setting this parameter might result in additional dependencies to be
added to the unit (see above). Optional. Type uniline.
StandardInputText
Configures arbitrary textual or binary data to pass via file descriptor 0 (STDIN) to the executed
processes. These settings have no effect unless "StandardInput" is set to "data" (which is the default if
"StandardInput" is not set otherwise, but "StandardInputText"/"StandardInputData" is). Use this option to
embed process input data directly in the unit file.
"StandardInputText" accepts arbitrary textual data. C-style escapes for special characters as well as the
usual "%"-specifiers are resolved. Each time this setting is used the specified text is appended to the
per-unit data buffer, followed by a newline character (thus every use appends a new line to the end of
the buffer). Note that leading and trailing whitespace of lines configured with this option is removed.
If an empty line is specified the buffer is cleared (hence, in order to insert an empty line, add an
additional "\n" to the end or beginning of a line).
"StandardInputData" accepts arbitrary binary data, encoded in Base64
<https://tools.ietf.org/html/rfc2045#section-6.8>. No escape sequences or specifiers are resolved. Any
whitespace in the encoded version is ignored during decoding.
Note that "StandardInputText" and "StandardInputData" operate on the same data buffer, and may be mixed
in order to configure both binary and textual data for the same input stream. The textual or binary data
is joined strictly in the order the settings appear in the unit file. Assigning an empty string to either
will reset the data buffer.
Please keep in mind that in order to maintain readability long unit file settings may be split into
multiple lines, by suffixing each line (except for the last) with a "\" character (see systemd.unit(5)
for details). This is particularly useful for large data configured with these two options. Example:
…
StandardInput=data
StandardInputData=V2XigLJyZSBubyBzdHJhbmdlcnMgdG8gbG92ZQpZb3Uga25vdyB0aGUgcnVsZXMgYW5kIHNvIGRv \
IEkKQSBmdWxsIGNvbW1pdG1lbnQncyB3aGF0IEnigLJtIHRoaW5raW5nIG9mCllvdSB3b3VsZG4n \
dCBnZXQgdGhpcyBmcm9tIGFueSBvdGhlciBndXkKSSBqdXN0IHdhbm5hIHRlbGwgeW91IGhvdyBJ \
J20gZmVlbGluZwpHb3R0YSBtYWtlIHlvdSB1bmRlcnN0YW5kCgpOZXZlciBnb25uYSBnaXZlIHlv \
dSB1cApOZXZlciBnb25uYSBsZXQgeW91IGRvd24KTmV2ZXIgZ29ubmEgcnVuIGFyb3VuZCBhbmQg \
ZGVzZXJ0IHlvdQpOZXZlciBnb25uYSBtYWtlIHlvdSBjcnkKTmV2ZXIgZ29ubmEgc2F5IGdvb2Ri \
eWUKTmV2ZXIgZ29ubmEgdGVsbCBhIGxpZSBhbmQgaHVydCB5b3UK
…
I< Optional. Type uniline. >
StandardInputData
Configures arbitrary textual or binary data to pass via file descriptor 0 (STDIN) to the executed
processes. These settings have no effect unless "StandardInput" is set to "data" (which is the default if
"StandardInput" is not set otherwise, but "StandardInputText"/"StandardInputData" is). Use this option to
embed process input data directly in the unit file.
"StandardInputText" accepts arbitrary textual data. C-style escapes for special characters as well as the
usual "%"-specifiers are resolved. Each time this setting is used the specified text is appended to the
per-unit data buffer, followed by a newline character (thus every use appends a new line to the end of
the buffer). Note that leading and trailing whitespace of lines configured with this option is removed.
If an empty line is specified the buffer is cleared (hence, in order to insert an empty line, add an
additional "\n" to the end or beginning of a line).
"StandardInputData" accepts arbitrary binary data, encoded in Base64
<https://tools.ietf.org/html/rfc2045#section-6.8>. No escape sequences or specifiers are resolved. Any
whitespace in the encoded version is ignored during decoding.
Note that "StandardInputText" and "StandardInputData" operate on the same data buffer, and may be mixed
in order to configure both binary and textual data for the same input stream. The textual or binary data
is joined strictly in the order the settings appear in the unit file. Assigning an empty string to either
will reset the data buffer.
Please keep in mind that in order to maintain readability long unit file settings may be split into
multiple lines, by suffixing each line (except for the last) with a "\" character (see systemd.unit(5)
for details). This is particularly useful for large data configured with these two options. Example:
…
StandardInput=data
StandardInputData=V2XigLJyZSBubyBzdHJhbmdlcnMgdG8gbG92ZQpZb3Uga25vdyB0aGUgcnVsZXMgYW5kIHNvIGRv \
IEkKQSBmdWxsIGNvbW1pdG1lbnQncyB3aGF0IEnigLJtIHRoaW5raW5nIG9mCllvdSB3b3VsZG4n \
dCBnZXQgdGhpcyBmcm9tIGFueSBvdGhlciBndXkKSSBqdXN0IHdhbm5hIHRlbGwgeW91IGhvdyBJ \
J20gZmVlbGluZwpHb3R0YSBtYWtlIHlvdSB1bmRlcnN0YW5kCgpOZXZlciBnb25uYSBnaXZlIHlv \
dSB1cApOZXZlciBnb25uYSBsZXQgeW91IGRvd24KTmV2ZXIgZ29ubmEgcnVuIGFyb3VuZCBhbmQg \
ZGVzZXJ0IHlvdQpOZXZlciBnb25uYSBtYWtlIHlvdSBjcnkKTmV2ZXIgZ29ubmEgc2F5IGdvb2Ri \
eWUKTmV2ZXIgZ29ubmEgdGVsbCBhIGxpZSBhbmQgaHVydCB5b3UK
…
I< Optional. Type uniline. >
LogLevelMax
Configures filtering by log level of log messages generated by this unit. Takes a syslog log level, one
of "emerg" (lowest log level, only highest priority messages), "alert", "crit", "err", "warning",
"notice", "info", "debug" (highest log level, also lowest priority messages). See syslog(3) for details.
By default no filtering is applied (i.e. the default maximum log level is "debug"). Use this option to
configure the logging system to drop log messages of a specific service above the specified level. For
example, set "LogLevelMax""info" in order to turn off debug logging of a particularly chatty unit. Note
that the configured level is applied to any log messages written by any of the processes belonging to
this unit, as well as any log messages written by the system manager process (PID 1) in reference to this
unit, sent via any supported logging protocol. The filtering is applied early in the logging pipeline,
before any kind of further processing is done. Moreover, messages which pass through this filter
successfully might still be dropped by filters applied at a later stage in the logging subsystem. For
example, "MaxLevelStore" configured in journald.conf(5) might prohibit messages of higher log levels to
be stored on disk, even though the per-unit "LogLevelMax" permitted it to be processed. Optional. Type
uniline.
LogExtraFields
Configures additional log metadata fields to include in all log records generated by processes associated
with this unit, including systemd. This setting takes one or more journal field assignments in the format
"FIELD=VALUE" separated by whitespace. See systemd.journal-fields(7) for details on the journal field
concept. Even though the underlying journal implementation permits binary field values, this setting
accepts only valid UTF-8 values. To include space characters in a journal field value, enclose the
assignment in double quotes ("). The usual specifiers are expanded in all assignments (see below). Note
that this setting is not only useful for attaching additional metadata to log records of a unit, but
given that all fields and values are indexed may also be used to implement cross-unit log record
matching. Assign an empty string to reset the list.
Note that this functionality is currently only available in system services, not in per-user services.
Optional. Type uniline.
LogRateLimitIntervalSec
Configures the rate limiting that is applied to log messages generated by this unit. If, in the time
interval defined by "LogRateLimitIntervalSec", more messages than specified in "LogRateLimitBurst" are
logged by a service, all further messages within the interval are dropped until the interval is over. A
message about the number of dropped messages is generated. The time specification for
"LogRateLimitIntervalSec" may be specified in the following units: "s", "min", "h", "ms", "us". See
systemd.time(7) for details. The default settings are set by "RateLimitIntervalSec" and "RateLimitBurst"
configured in journald.conf(5). Note that this only applies to log messages that are processed by the
logging subsystem, i.e. by systemd-journald.service(8). This means that if you connect a service's
stderr directly to a file via "StandardOutput=file:…" or a similar setting, the rate limiting will not be
applied to messages written that way (but it will be enforced for messages generated via syslog(3) and
similar functions). Optional. Type uniline.
LogRateLimitBurst
Configures the rate limiting that is applied to log messages generated by this unit. If, in the time
interval defined by "LogRateLimitIntervalSec", more messages than specified in "LogRateLimitBurst" are
logged by a service, all further messages within the interval are dropped until the interval is over. A
message about the number of dropped messages is generated. The time specification for
"LogRateLimitIntervalSec" may be specified in the following units: "s", "min", "h", "ms", "us". See
systemd.time(7) for details. The default settings are set by "RateLimitIntervalSec" and "RateLimitBurst"
configured in journald.conf(5). Note that this only applies to log messages that are processed by the
logging subsystem, i.e. by systemd-journald.service(8). This means that if you connect a service's
stderr directly to a file via "StandardOutput=file:…" or a similar setting, the rate limiting will not be
applied to messages written that way (but it will be enforced for messages generated via syslog(3) and
similar functions). Optional. Type uniline.
LogFilterPatterns
Define an extended regular expression to filter log messages based on the "MESSAGE" field of the
structured message. If the first character of the pattern is "~", log entries matching the pattern should
be discarded. This option takes a single pattern as an argument but can be used multiple times to create
a list of allowed and denied patterns. If the empty string is assigned, the filter is reset, and all
prior assignments will have no effect.
Because the "~" character is used to define denied patterns, it must be replaced with "\x7e" to allow a
message starting with "~". For example, "~foobar" would add a pattern matching "foobar" to the deny list,
while "\x7efoobar" would add a pattern matching "~foobar" to the allow list.
Log messages are tested against denied patterns (if any), then against allowed patterns (if any). If a
log message matches any of the denied patterns, it is discarded immediately without considering allowed
patterns. Remaining log messages are tested against allowed patterns. Messages matching against none of
the allowed pattern are discarded. If no allowed patterns are defined, then all messages are processed
directly after going through denied filters.
Filtering is based on the unit for which "LogFilterPatterns" is defined, meaning log messages coming from
systemd(1) about the unit are not taken into account. Filtered log messages won't be forwarded to
traditional syslog daemons, the kernel log buffer (kmsg), the systemd console, or sent as wall messages
to all logged-in users.
Note that this functionality is currently only available in system services, not in per-user services.
Optional. Type uniline.
LogNamespace
Run the unit's processes in the specified journal namespace. Expects a short user-defined string
identifying the namespace. If not used the processes of the service are run in the default journal
namespace, i.e. their log stream is collected and processed by "systemd-journald.service". If this option
is used any log data generated by processes of this unit (regardless if via the syslog(), journal native
logging or stdout/stderr logging) is collected and processed by an instance of the
"systemd-journald@.service" template unit, which manages the specified namespace. The log data is stored
in a data store independent from the default log namespace's data store. See systemd-journald.service(8)
for details about journal namespaces.
Internally, journal namespaces are implemented through Linux mount namespacing and over-mounting the
directory that contains the relevant "AF_UNIX" sockets used for logging in the unit's mount namespace.
Since mount namespaces are used this setting disconnects propagation of mounts from the unit's processes
to the host, similarly to how "ReadOnlyPaths" and similar settings describe above work. Journal
namespaces may hence not be used for services that need to establish mount points on the host.
When this option is used the unit will automatically gain ordering and requirement dependencies on the
two socket units associated with the "systemd-journald@.service" instance so that they are automatically
established prior to the unit starting up. Note that when this option is used log output of this service
does not appear in the regular journalctl(1) output, unless the "--namespace=" option is used. Optional.
Type uniline.
SyslogIdentifier
Sets the process name ("syslog tag") to prefix log lines sent to the logging system or the kernel log
buffer with. If not set, defaults to the process name of the executed process. This option is only useful
when "StandardOutput" or "StandardError" are set to "journal" or "kmsg" (or to the same settings in
combination with "+console") and only applies to log messages written to stdout or stderr. Optional.
Type uniline.
SyslogFacility
Sets the syslog facility identifier to use when logging. One of "kern", "user", "mail", "daemon", "auth",
"syslog", "lpr", "news", "uucp", "cron", "authpriv", "ftp", "local0", "local1", "local2", "local3",
"local4", "local5", "local6" or "local7". See syslog(3) for details. This option is only useful when
"StandardOutput" or "StandardError" are set to "journal" or "kmsg" (or to the same settings in
combination with "+console"), and only applies to log messages written to stdout or stderr. Defaults to
"daemon". Optional. Type uniline.
SyslogLevel
The default syslog log level to use when logging to the logging system or the kernel log buffer. One of
"emerg", "alert", "crit", "err", "warning", "notice", "info", "debug". See syslog(3) for details. This
option is only useful when "StandardOutput" or "StandardError" are set to "journal" or "kmsg" (or to the
same settings in combination with "+console"), and only applies to log messages written to stdout or
stderr. Note that individual lines output by executed processes may be prefixed with a different log
level which can be used to override the default log level specified here. The interpretation of these
prefixes may be disabled with "SyslogLevelPrefix", see below. For details, see sd-daemon(3). Defaults to
"info". Optional. Type uniline.
SyslogLevelPrefix
Takes a boolean argument. If true and "StandardOutput" or "StandardError" are set to "journal" or "kmsg"
(or to the same settings in combination with "+console"), log lines written by the executed process that
are prefixed with a log level will be processed with this log level set but the prefix removed. If set to
false, the interpretation of these prefixes is disabled and the logged lines are passed on as-is. This
only applies to log messages written to stdout or stderr. For details about this prefixing see
sd-daemon(3). Defaults to true. Optional. Type boolean.
TTYPath
Sets the terminal device node to use if standard input, output, or error are connected to a TTY (see
above). Defaults to "/dev/console". Optional. Type uniline.
TTYReset
Reset the terminal device specified with "TTYPath" before and after execution. Defaults to "no".
Optional. Type uniline.
TTYVHangup
Disconnect all clients which have opened the terminal device specified with "TTYPath" before and after
execution. Defaults to "no". Optional. Type uniline.
TTYRows
Configure the size of the TTY specified with "TTYPath". If unset or set to the empty string, the kernel
default is used. Optional. Type uniline.
TTYColumns
Configure the size of the TTY specified with "TTYPath". If unset or set to the empty string, the kernel
default is used. Optional. Type uniline.
TTYVTDisallocate
If the terminal device specified with "TTYPath" is a virtual console terminal, try to deallocate the TTY
before and after execution. This ensures that the screen and scrollback buffer is cleared. Defaults to
"no". Optional. Type uniline.
LoadCredential
Pass a credential to the unit. Credentials are limited-size binary or textual objects that may be passed
to unit processes. They are primarily used for passing cryptographic keys (both public and private) or
certificates, user account information or identity information from host to services. The data is
accessible from the unit's processes via the file system, at a read-only location that (if possible and
permitted) is backed by non-swappable memory. The data is only accessible to the user associated with the
unit, via the "User"/"DynamicUser" settings (as well as the superuser). When available, the location of
credentials is exported as the $CREDENTIALS_DIRECTORY environment variable to the unit's processes.
The "LoadCredential" setting takes a textual ID to use as name for a credential plus a file system path,
separated by a colon. The ID must be a short ASCII string suitable as filename in the filesystem, and may
be chosen freely by the user. If the specified path is absolute it is opened as regular file and the
credential data is read from it. If the absolute path refers to an "AF_UNIX" stream socket in the file
system a connection is made to it (only once at unit start-up) and the credential data read from the
connection, providing an easy IPC integration point for dynamically transferring credentials from other
services.
If the specified path is not absolute and itself qualifies as valid credential identifier it is attempted
to find a credential that the service manager itself received under the specified name — which may be
used to propagate credentials from an invoking environment (e.g. a container manager that invoked the
service manager) into a service. If no matching system credential is found, the directories
"/etc/credstore/", "/run/credstore/" and "/usr/lib/credstore/" are searched for files under the
credential's name — which hence are recommended locations for credential data on disk. If
"LoadCredentialEncrypted" is used "/run/credstore.encrypted/", "/etc/credstore.encrypted/", and
"/usr/lib/credstore.encrypted/" are searched as well.
If the file system path is omitted it is chosen identical to the credential name, i.e. this is a terse
way to declare credentials to inherit from the service manager into a service. This option may be used
multiple times, each time defining an additional credential to pass to the unit.
Note that if the path is not specified or a valid credential identifier is given, i.e. in the above two
cases, a missing credential is not considered fatal.
If an absolute path referring to a directory is specified, every file in that directory (recursively)
will be loaded as a separate credential. The ID for each credential will be the provided ID suffixed with
"_$FILENAME" (e.g., "Key_file1"). When loading from a directory, symlinks will be ignored.
The contents of the file/socket may be arbitrary binary or textual data, including newline characters and
"NUL" bytes.
The "LoadCredentialEncrypted" setting is identical to "LoadCredential", except that the credential data
is decrypted and authenticated before being passed on to the executed processes. Specifically, the
referenced path should refer to a file or socket with an encrypted credential, as implemented by
systemd-creds(1). This credential is loaded, decrypted, authenticated and then passed to the application
in plaintext form, in the same way a regular credential specified via "LoadCredential" would be. A
credential configured this way may be symmetrically encrypted/authenticated with a secret key derived
from the system's TPM2 security chip, or with a secret key stored in
"/var/lib/systemd/credentials.secret", or with both. Using encrypted and authenticated credentials
improves security as credentials are not stored in plaintext and only authenticated and decrypted into
plaintext the moment a service requiring them is started. Moreover, credentials may be bound to the local
hardware and installations, so that they cannot easily be analyzed offline, or be generated externally.
When "DevicePolicy" is set to "closed" or "strict", or set to "auto" and "DeviceAllow" is set, or
"PrivateDevices" is set, then this setting adds "/dev/tpmrm0" with "rw" mode to "DeviceAllow". See
systemd.resource-control(5) for the details about "DevicePolicy" or "DeviceAllow".
Note that encrypted credentials targeted for services of the per-user service manager must be encrypted
with systemd-creds encrypt --user, and those for the system service manager without the "--user" switch.
Encrypted credentials are always targeted to a specific user or the system as a whole, and it is ensured
that per-user service managers cannot decrypt secrets intended for the system or for other users.
The credential files/IPC sockets must be accessible to the service manager, but don't have to be directly
accessible to the unit's processes: the credential data is read and copied into separate, read-only
copies for the unit that are accessible to appropriately privileged processes. This is particularly
useful in combination with "DynamicUser" as this way privileged data can be made available to processes
running under a dynamic UID (i.e. not a previously known one) without having to open up access to all
users.
In order to reference the path a credential may be read from within a "ExecStart" command line use
"${CREDENTIALS_DIRECTORY}/mycred", e.g. "ExecStart=cat ${CREDENTIALS_DIRECTORY}/mycred". In order to
reference the path a credential may be read from within a "Environment" line use "%d/mycred", e.g.
"Environment=MYCREDPATH=%d/mycred". For system services the path may also be referenced as
"/run/credentials/UNITNAME" in cases where no interpolation is possible, e.g. configuration files of
software that does not yet support credentials natively. $CREDENTIALS_DIRECTORY is considered the primary
interface to look for credentials, though, since it also works for user services.
Currently, an accumulated credential size limit of 1 MB per unit is enforced.
The service manager itself may receive system credentials that can be propagated to services from a
hosting container manager or VM hypervisor. See the Container Interface
<https://systemd.io/CONTAINER_INTERFACE> documentation for details about the former. For the latter, pass
DMI/SMBIOS <https://www.dmtf.org/standards/smbios> OEM string table entries (field type 11) with a prefix
of "io.systemd.credential:" or "io.systemd.credential.binary:". In both cases a key/value pair separated
by "=" is expected, in the latter case the right-hand side is Base64 decoded when parsed (thus permitting
binary data to be passed in). Example qemu <https://www.qemu.org/docs/master/system/index.html> switch:
"-smbios type=11,value=io.systemd.credential:xx=yy", or "-smbios
type=11,value=io.systemd.credential.binary:rick=TmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXA=". Alternatively, use the
qemu "fw_cfg" node "opt/io.systemd.credentials/". Example qemu switch: "-fw_cfg
name=opt/io.systemd.credentials/mycred,string=supersecret". They may also be passed from the UEFI
firmware environment via systemd-stub(7), from the initrd (see systemd(1)), or be specified on the kernel
command line using the "systemd.set_credential=" and "systemd.set_credential_binary=" switches (see
systemd(1) – this is not recommended since unprivileged userspace can read the kernel command line).
If referencing an "AF_UNIX" stream socket to connect to, the connection will originate from an abstract
namespace socket, that includes information about the unit and the credential ID in its socket name. Use
getpeername(2) to query this information. The returned socket name is formatted as "NUL"RANDOM "/unit/"
UNIT"/" ID, i.e. a "NUL" byte (as required for abstract namespace socket names), followed by a random
string (consisting of alphadecimal characters), followed by the literal string "/unit/", followed by the
requesting unit name, followed by the literal character "/", followed by the textual credential ID
requested. Example: "\0adf9d86b6eda275e/unit/foobar.service/credx" in case the credential "credx" is
requested for a unit "foobar.service". This functionality is useful for using a single listening socket
to serve credentials to multiple consumers.
For further information see System and Service Credentials <https://systemd.io/CREDENTIALS>
documentation. Optional. Type uniline.
LoadCredentialEncrypted
Pass a credential to the unit. Credentials are limited-size binary or textual objects that may be passed
to unit processes. They are primarily used for passing cryptographic keys (both public and private) or
certificates, user account information or identity information from host to services. The data is
accessible from the unit's processes via the file system, at a read-only location that (if possible and
permitted) is backed by non-swappable memory. The data is only accessible to the user associated with the
unit, via the "User"/"DynamicUser" settings (as well as the superuser). When available, the location of
credentials is exported as the $CREDENTIALS_DIRECTORY environment variable to the unit's processes.
The "LoadCredential" setting takes a textual ID to use as name for a credential plus a file system path,
separated by a colon. The ID must be a short ASCII string suitable as filename in the filesystem, and may
be chosen freely by the user. If the specified path is absolute it is opened as regular file and the
credential data is read from it. If the absolute path refers to an "AF_UNIX" stream socket in the file
system a connection is made to it (only once at unit start-up) and the credential data read from the
connection, providing an easy IPC integration point for dynamically transferring credentials from other
services.
If the specified path is not absolute and itself qualifies as valid credential identifier it is attempted
to find a credential that the service manager itself received under the specified name — which may be
used to propagate credentials from an invoking environment (e.g. a container manager that invoked the
service manager) into a service. If no matching system credential is found, the directories
"/etc/credstore/", "/run/credstore/" and "/usr/lib/credstore/" are searched for files under the
credential's name — which hence are recommended locations for credential data on disk. If
"LoadCredentialEncrypted" is used "/run/credstore.encrypted/", "/etc/credstore.encrypted/", and
"/usr/lib/credstore.encrypted/" are searched as well.
If the file system path is omitted it is chosen identical to the credential name, i.e. this is a terse
way to declare credentials to inherit from the service manager into a service. This option may be used
multiple times, each time defining an additional credential to pass to the unit.
Note that if the path is not specified or a valid credential identifier is given, i.e. in the above two
cases, a missing credential is not considered fatal.
If an absolute path referring to a directory is specified, every file in that directory (recursively)
will be loaded as a separate credential. The ID for each credential will be the provided ID suffixed with
"_$FILENAME" (e.g., "Key_file1"). When loading from a directory, symlinks will be ignored.
The contents of the file/socket may be arbitrary binary or textual data, including newline characters and
"NUL" bytes.
The "LoadCredentialEncrypted" setting is identical to "LoadCredential", except that the credential data
is decrypted and authenticated before being passed on to the executed processes. Specifically, the
referenced path should refer to a file or socket with an encrypted credential, as implemented by
systemd-creds(1). This credential is loaded, decrypted, authenticated and then passed to the application
in plaintext form, in the same way a regular credential specified via "LoadCredential" would be. A
credential configured this way may be symmetrically encrypted/authenticated with a secret key derived
from the system's TPM2 security chip, or with a secret key stored in
"/var/lib/systemd/credentials.secret", or with both. Using encrypted and authenticated credentials
improves security as credentials are not stored in plaintext and only authenticated and decrypted into
plaintext the moment a service requiring them is started. Moreover, credentials may be bound to the local
hardware and installations, so that they cannot easily be analyzed offline, or be generated externally.
When "DevicePolicy" is set to "closed" or "strict", or set to "auto" and "DeviceAllow" is set, or
"PrivateDevices" is set, then this setting adds "/dev/tpmrm0" with "rw" mode to "DeviceAllow". See
systemd.resource-control(5) for the details about "DevicePolicy" or "DeviceAllow".
Note that encrypted credentials targeted for services of the per-user service manager must be encrypted
with systemd-creds encrypt --user, and those for the system service manager without the "--user" switch.
Encrypted credentials are always targeted to a specific user or the system as a whole, and it is ensured
that per-user service managers cannot decrypt secrets intended for the system or for other users.
The credential files/IPC sockets must be accessible to the service manager, but don't have to be directly
accessible to the unit's processes: the credential data is read and copied into separate, read-only
copies for the unit that are accessible to appropriately privileged processes. This is particularly
useful in combination with "DynamicUser" as this way privileged data can be made available to processes
running under a dynamic UID (i.e. not a previously known one) without having to open up access to all
users.
In order to reference the path a credential may be read from within a "ExecStart" command line use
"${CREDENTIALS_DIRECTORY}/mycred", e.g. "ExecStart=cat ${CREDENTIALS_DIRECTORY}/mycred". In order to
reference the path a credential may be read from within a "Environment" line use "%d/mycred", e.g.
"Environment=MYCREDPATH=%d/mycred". For system services the path may also be referenced as
"/run/credentials/UNITNAME" in cases where no interpolation is possible, e.g. configuration files of
software that does not yet support credentials natively. $CREDENTIALS_DIRECTORY is considered the primary
interface to look for credentials, though, since it also works for user services.
Currently, an accumulated credential size limit of 1 MB per unit is enforced.
The service manager itself may receive system credentials that can be propagated to services from a
hosting container manager or VM hypervisor. See the Container Interface
<https://systemd.io/CONTAINER_INTERFACE> documentation for details about the former. For the latter, pass
DMI/SMBIOS <https://www.dmtf.org/standards/smbios> OEM string table entries (field type 11) with a prefix
of "io.systemd.credential:" or "io.systemd.credential.binary:". In both cases a key/value pair separated
by "=" is expected, in the latter case the right-hand side is Base64 decoded when parsed (thus permitting
binary data to be passed in). Example qemu <https://www.qemu.org/docs/master/system/index.html> switch:
"-smbios type=11,value=io.systemd.credential:xx=yy", or "-smbios
type=11,value=io.systemd.credential.binary:rick=TmV2ZXIgR29ubmEgR2l2ZSBZb3UgVXA=". Alternatively, use the
qemu "fw_cfg" node "opt/io.systemd.credentials/". Example qemu switch: "-fw_cfg
name=opt/io.systemd.credentials/mycred,string=supersecret". They may also be passed from the UEFI
firmware environment via systemd-stub(7), from the initrd (see systemd(1)), or be specified on the kernel
command line using the "systemd.set_credential=" and "systemd.set_credential_binary=" switches (see
systemd(1) – this is not recommended since unprivileged userspace can read the kernel command line).
If referencing an "AF_UNIX" stream socket to connect to, the connection will originate from an abstract
namespace socket, that includes information about the unit and the credential ID in its socket name. Use
getpeername(2) to query this information. The returned socket name is formatted as "NUL"RANDOM "/unit/"
UNIT"/" ID, i.e. a "NUL" byte (as required for abstract namespace socket names), followed by a random
string (consisting of alphadecimal characters), followed by the literal string "/unit/", followed by the
requesting unit name, followed by the literal character "/", followed by the textual credential ID
requested. Example: "\0adf9d86b6eda275e/unit/foobar.service/credx" in case the credential "credx" is
requested for a unit "foobar.service". This functionality is useful for using a single listening socket
to serve credentials to multiple consumers.
For further information see System and Service Credentials <https://systemd.io/CREDENTIALS>
documentation. Optional. Type uniline.
ImportCredential
Pass one or more credentials to the unit. Takes a credential name for which we'll attempt to find a
credential that the service manager itself received under the specified name — which may be used to
propagate credentials from an invoking environment (e.g. a container manager that invoked the service
manager) into a service. If the credential name is a glob, all credentials matching the glob are passed
to the unit. Matching credentials are searched for in the system credentials, the encrypted system
credentials, and under "/etc/credstore/", "/run/credstore/", "/usr/lib/credstore/",
"/run/credstore.encrypted/", "/etc/credstore.encrypted/", and "/usr/lib/credstore.encrypted/" in that
order. When multiple credentials of the same name are found, the first one found is used.
The globbing expression implements a restrictive subset of glob(7): only a single trailing "*" wildcard
may be specified. Both "?" and "[]" wildcards are not permitted, nor are "*" wildcards anywhere except at
the end of the glob expression.
When multiple credentials of the same name are found, credentials found by "LoadCredential" and
"LoadCredentialEncrypted" take priority over credentials found by "ImportCredential". Optional. Type
uniline.
SetCredential
The "SetCredential" setting is similar to "LoadCredential" but accepts a literal value to use as data for
the credential, instead of a file system path to read the data from. Do not use this option for data that
is supposed to be secret, as it is accessible to unprivileged processes via IPC. It's only safe to use
this for user IDs, public key material and similar non-sensitive data. For everything else use
"LoadCredential". In order to embed binary data into the credential data use C-style escaping (i.e. "\n"
to embed a newline, or "\x00" to embed a "NUL" byte).
The "SetCredentialEncrypted" setting is identical to "SetCredential" but expects an encrypted credential
in literal form as value. This allows embedding confidential credentials securely directly in unit files.
Use systemd-creds(1)' "-p" switch to generate suitable "SetCredentialEncrypted" lines directly from
plaintext credentials. For further details see "LoadCredentialEncrypted" above.
When multiple credentials of the same name are found, credentials found by "LoadCredential",
"LoadCredentialEncrypted" and "ImportCredential" take priority over credentials found by "SetCredential".
As such, "SetCredential" will act as default if no credentials are found by any of the former. In this
case not being able to retrieve the credential from the path specified in "LoadCredential" or
"LoadCredentialEncrypted" is not considered fatal. Optional. Type uniline.
SetCredentialEncrypted
The "SetCredential" setting is similar to "LoadCredential" but accepts a literal value to use as data for
the credential, instead of a file system path to read the data from. Do not use this option for data that
is supposed to be secret, as it is accessible to unprivileged processes via IPC. It's only safe to use
this for user IDs, public key material and similar non-sensitive data. For everything else use
"LoadCredential". In order to embed binary data into the credential data use C-style escaping (i.e. "\n"
to embed a newline, or "\x00" to embed a "NUL" byte).
The "SetCredentialEncrypted" setting is identical to "SetCredential" but expects an encrypted credential
in literal form as value. This allows embedding confidential credentials securely directly in unit files.
Use systemd-creds(1)' "-p" switch to generate suitable "SetCredentialEncrypted" lines directly from
plaintext credentials. For further details see "LoadCredentialEncrypted" above.
When multiple credentials of the same name are found, credentials found by "LoadCredential",
"LoadCredentialEncrypted" and "ImportCredential" take priority over credentials found by "SetCredential".
As such, "SetCredential" will act as default if no credentials are found by any of the former. In this
case not being able to retrieve the credential from the path specified in "LoadCredential" or
"LoadCredentialEncrypted" is not considered fatal. Optional. Type uniline.
UtmpIdentifier
Takes a four character identifier string for an utmp(5) and wtmp entry for this service. This should only
be set for services such as getty implementations (such as agetty(8)) where utmp/wtmp entries must be
created and cleared before and after execution, or for services that shall be executed as if they were
run by a getty process (see below). If the configured string is longer than four characters, it is
truncated and the terminal four characters are used. This setting interprets %I style string
replacements. This setting is unset by default, i.e. no utmp/wtmp entries are created or cleaned up for
this service. Optional. Type uniline.
UtmpMode
Takes one of "init", "login" or "user". If "UtmpIdentifier" is set, controls which type of utmp(5)/wtmp
entries for this service are generated. This setting has no effect unless "UtmpIdentifier" is set too. If
"init" is set, only an "INIT_PROCESS" entry is generated and the invoked process must implement a getty-
compatible utmp/wtmp logic. If "login" is set, first an "INIT_PROCESS" entry, followed by a
"LOGIN_PROCESS" entry is generated. In this case, the invoked process must implement a
login(1)-compatible utmp/wtmp logic. If "user" is set, first an "INIT_PROCESS" entry, then a
"LOGIN_PROCESS" entry and finally a "USER_PROCESS" entry is generated. In this case, the invoked process
may be any process that is suitable to be run as session leader. Defaults to "init". Optional. Type
enum. choice: 'init', 'login', 'user'.
KillMode
Specifies how processes of this unit shall be killed. One of "control-group", "mixed", "process", "none".
If set to "control-group", all remaining processes in the control group of this unit will be killed on
unit stop (for services: after the stop command is executed, as configured with "ExecStop"). If set to
"mixed", the "SIGTERM" signal (see below) is sent to the main process while the subsequent "SIGKILL"
signal (see below) is sent to all remaining processes of the unit's control group. If set to "process",
only the main process itself is killed (not recommended!). If set to "none", no process is killed
(strongly recommended against!). In this case, only the stop command will be executed on unit stop, but
no process will be killed otherwise. Processes remaining alive after stop are left in their control
group and the control group continues to exist after stop unless empty.
Note that it is not recommended to set "KillMode" to "process" or even "none", as this allows processes
to escape the service manager's lifecycle and resource management, and to remain running even while their
service is considered stopped and is assumed to not consume any resources.
Processes will first be terminated via "SIGTERM" (unless the signal to send is changed via "KillSignal"
or "RestartKillSignal"). Optionally, this is immediately followed by a "SIGHUP" (if enabled with
"SendSIGHUP"). If processes still remain after: the main process of a unit has exited (applies to
"KillMode": "mixed")the delay configured via the "TimeoutStopSec" has passed (applies to "KillMode":
"control-group", "mixed", "process") the termination request is repeated with the "SIGKILL" signal or the
signal specified via "FinalKillSignal" (unless this is disabled via the "SendSIGKILL" option). See
kill(2) for more information.
Defaults to "control-group". Optional. Type uniline.
KillSignal
Specifies which signal to use when stopping a service. This controls the signal that is sent as first
step of shutting down a unit (see above), and is usually followed by "SIGKILL" (see above and below). For
a list of valid signals, see signal(7). Defaults to "SIGTERM".
Note that, right after sending the signal specified in this setting, systemd will always send "SIGCONT",
to ensure that even suspended tasks can be terminated cleanly. Optional. Type uniline.
RestartKillSignal
Specifies which signal to use when restarting a service. The same as "KillSignal" described above, with
the exception that this setting is used in a restart job. Not set by default, and the value of
"KillSignal" is used. Optional. Type uniline.
SendSIGHUP
Specifies whether to send "SIGHUP" to remaining processes immediately after sending the signal configured
with "KillSignal". This is useful to indicate to shells and shell-like programs that their connection has
been severed. Takes a boolean value. Defaults to "no". Optional. Type boolean.
SendSIGKILL
Specifies whether to send "SIGKILL" (or the signal specified by "FinalKillSignal") to remaining processes
after a timeout, if the normal shutdown procedure left processes of the service around. When disabled, a
"KillMode" of "control-group" or "mixed" service will not restart if processes from prior services exist
within the control group. Takes a boolean value. Defaults to "yes". Optional. Type boolean.
FinalKillSignal
Specifies which signal to send to remaining processes after a timeout if "SendSIGKILL" is enabled. The
signal configured here should be one that is not typically caught and processed by services ("SIGTERM" is
not suitable). Developers can find it useful to use this to generate a coredump to troubleshoot why a
service did not terminate upon receiving the initial "SIGTERM" signal. This can be achieved by
configuring "LimitCORE" and setting "FinalKillSignal" to either "SIGQUIT" or "SIGABRT". Defaults to
"SIGKILL". Optional. Type uniline.
WatchdogSignal
Specifies which signal to use to terminate the service when the watchdog timeout expires (enabled through
"WatchdogSec"). Defaults to "SIGABRT". Optional. Type uniline.
Type
Configures the mechanism via which the service notifies the manager that the service start-up has
finished. One of "simple", "exec", "forking", "oneshot", "dbus", "notify", "notify-reload", or "idle":
It is recommended to use "Type""exec" for long-running services, as it ensures that process setup errors
(e.g. errors such as a missing service executable, or missing user) are properly tracked. However, as
this service type won't propagate the failures in the service's own startup code (as opposed to failures
in the preparatory steps the service manager executes before execve()) and doesn't allow ordering of
other units against completion of initialization of the service code itself (which for example is useful
if clients need to connect to the service through some form of IPC, and the IPC channel is only
established by the service itself — in contrast to doing this ahead of time through socket or bus
activation or similar), it might not be sufficient for many cases. If so, "notify", "notify-reload", or
"dbus" (the latter only in case the service provides a D-Bus interface) are the preferred options as they
allow service program code to precisely schedule when to consider the service started up successfully and
when to proceed with follow-up units. The "notify"/"notify-reload" service types require explicit support
in the service codebase (as sd_notify() or an equivalent API needs to be invoked by the service at the
appropriate time) — if it's not supported, then "forking" is an alternative: it supports the traditional
heavy-weight UNIX service start-up protocol. Note that using any type other than "simple" possibly delays
the boot process, as the service manager needs to wait for at least some service initialization to
complete. (Also note it is generally not recommended to use "idle" or "oneshot" for long-running
services.)
Note that various service settings (e.g. "User", "Group" through libc NSS) might result in "hidden"
blocking IPC calls to other services when used. Sometimes it might be advisable to use the "simple"
service type to ensure that the service manager's transaction logic is not affected by such potentially
slow operations and hidden dependencies, as this is the only service type where the service manager will
not wait for such service execution setup operations to complete before proceeding. Optional. Type
uniline.
ExitType
Specifies when the manager should consider the service to be finished. One of "main" or "cgroup":
It is generally recommended to use "ExitType""main" when a service has a known forking model and a main
process can reliably be determined. "ExitType""cgroup" is meant for applications whose forking model is
not known ahead of time and which might not have a specific main process. It is well suited for transient
or automatically generated services, such as graphical applications inside of a desktop environment.
Optional. Type uniline.
RemainAfterExit
Takes a boolean value that specifies whether the service shall be considered active even when all its
processes exited. Defaults to "no". Optional. Type boolean.
GuessMainPID
Takes a boolean value that specifies whether systemd should try to guess the main PID of a service if it
cannot be determined reliably. This option is ignored unless "Type=forking" is set and "PIDFile" is unset
because for the other types or with an explicitly configured PID file, the main PID is always known. The
guessing algorithm might come to incorrect conclusions if a daemon consists of more than one process. If
the main PID cannot be determined, failure detection and automatic restarting of a service will not work
reliably. Defaults to "yes". Optional. Type boolean.
PIDFile
Takes a path referring to the PID file of the service. Usage of this option is recommended for services
where "Type" is set to "forking". The path specified typically points to a file below "/run/". If a
relative path is specified it is hence prefixed with "/run/". The service manager will read the PID of
the main process of the service from this file after start-up of the service. The service manager will
not write to the file configured here, although it will remove the file after the service has shut down
if it still exists. The PID file does not need to be owned by a privileged user, but if it is owned by an
unprivileged user additional safety restrictions are enforced: the file may not be a symlink to a file
owned by a different user (neither directly nor indirectly), and the PID file must refer to a process
already belonging to the service.
Note that PID files should be avoided in modern projects. Use "Type=notify", "Type=notify-reload" or
"Type=simple" where possible, which does not require use of PID files to determine the main process of a
service and avoids needless forking. Optional. Type uniline.
BusName
Takes a D-Bus destination name that this service shall use. This option is mandatory for services where
"Type" is set to "dbus". It is recommended to always set this property if known to make it easy to map
the service name to the D-Bus destination. In particular, systemctl service-log-level/service-log-target
verbs make use of this. Optional. Type uniline.
ExecStart
Commands that are executed when this service is started. The value is split into zero or more command
lines according to the rules described in the section "Command Lines" below.
Unless "Type" is "oneshot", exactly one command must be given. When "Type=oneshot" is used, zero or more
commands may be specified. Commands may be specified by providing multiple command lines in the same
directive, or alternatively, this directive may be specified more than once with the same effect. If the
empty string is assigned to this option, the list of commands to start is reset, prior assignments of
this option will have no effect. If no "ExecStart" is specified, then the service must have
"RemainAfterExit=yes" and at least one "ExecStop" line set. (Services lacking both "ExecStart" and
"ExecStop" are not valid.)
If more than one command is specified, the commands are invoked sequentially in the order they appear in
the unit file. If one of the commands fails (and is not prefixed with "-"), other lines are not executed,
and the unit is considered failed.
Unless "Type=forking" is set, the process started via this command line will be considered the main
process of the daemon. Optional. Type list of uniline.
ExecStartPre
Additional commands that are executed before or after the command in "ExecStart", respectively. Syntax is
the same as for "ExecStart", except that multiple command lines are allowed and the commands are executed
one after the other, serially.
If any of those commands (not prefixed with "-") fail, the rest are not executed and the unit is
considered failed.
"ExecStart" commands are only run after all "ExecStartPre" commands that were not prefixed with a "-"
exit successfully.
"ExecStartPost" commands are only run after the commands specified in "ExecStart" have been invoked
successfully, as determined by "Type" (i.e. the process has been started for "Type=simple" or
"Type=idle", the last "ExecStart" process exited successfully for "Type=oneshot", the initial process
exited successfully for "Type=forking", "READY=1" is sent for "Type=notify"/"Type=notify-reload", or the
"BusName" has been taken for "Type=dbus").
Note that "ExecStartPre" may not be used to start long-running processes. All processes forked off by
processes invoked via "ExecStartPre" will be killed before the next service process is run.
Note that if any of the commands specified in "ExecStartPre", "ExecStart", or "ExecStartPost" fail (and
are not prefixed with "-", see above) or time out before the service is fully up, execution continues
with commands specified in "ExecStopPost", the commands in "ExecStop" are skipped.
Note that the execution of "ExecStartPost" is taken into account for the purpose of "Before"/"After"
ordering constraints. Optional. Type list of uniline.
ExecStartPost
Additional commands that are executed before or after the command in "ExecStart", respectively. Syntax is
the same as for "ExecStart", except that multiple command lines are allowed and the commands are executed
one after the other, serially.
If any of those commands (not prefixed with "-") fail, the rest are not executed and the unit is
considered failed.
"ExecStart" commands are only run after all "ExecStartPre" commands that were not prefixed with a "-"
exit successfully.
"ExecStartPost" commands are only run after the commands specified in "ExecStart" have been invoked
successfully, as determined by "Type" (i.e. the process has been started for "Type=simple" or
"Type=idle", the last "ExecStart" process exited successfully for "Type=oneshot", the initial process
exited successfully for "Type=forking", "READY=1" is sent for "Type=notify"/"Type=notify-reload", or the
"BusName" has been taken for "Type=dbus").
Note that "ExecStartPre" may not be used to start long-running processes. All processes forked off by
processes invoked via "ExecStartPre" will be killed before the next service process is run.
Note that if any of the commands specified in "ExecStartPre", "ExecStart", or "ExecStartPost" fail (and
are not prefixed with "-", see above) or time out before the service is fully up, execution continues
with commands specified in "ExecStopPost", the commands in "ExecStop" are skipped.
Note that the execution of "ExecStartPost" is taken into account for the purpose of "Before"/"After"
ordering constraints. Optional. Type list of uniline.
ExecCondition
Optional commands that are executed before the commands in "ExecStartPre". Syntax is the same as for
"ExecStart", except that multiple command lines are allowed and the commands are executed one after the
other, serially.
The behavior is like an "ExecStartPre" and condition check hybrid: when an "ExecCondition" command exits
with exit code 1 through 254 (inclusive), the remaining commands are skipped and the unit is not marked
as failed. However, if an "ExecCondition" command exits with 255 or abnormally (e.g. timeout, killed by a
signal, etc.), the unit will be considered failed (and remaining commands will be skipped). Exit code of
0 or those matching "SuccessExitStatus" will continue execution to the next commands.
The same recommendations about not running long-running processes in "ExecStartPre" also applies to
"ExecCondition". "ExecCondition" will also run the commands in "ExecStopPost", as part of stopping the
service, in the case of any non-zero or abnormal exits, like the ones described above. Optional. Type
list of uniline.
ExecReload
Commands to execute to trigger a configuration reload in the service. This argument takes multiple
command lines, following the same scheme as described for "ExecStart" above. Use of this setting is
optional. Specifier and environment variable substitution is supported here following the same scheme as
for "ExecStart".
One additional, special environment variable is set: if known, $MAINPID is set to the main process of the
daemon, and may be used for command lines like the following:
ExecReload=kill -HUP $MAINPID
Note however that reloading a daemon by enqueuing a signal (as with the example line above) is usually
not a good choice, because this is an asynchronous operation and hence not suitable when ordering reloads
of multiple services against each other. It is thus strongly recommended to either use
"Type""notify-reload" in place of "ExecReload", or to set "ExecReload" to a command that not only
triggers a configuration reload of the daemon, but also synchronously waits for it to complete. For
example, dbus-broker(1) uses the following:
ExecReload=busctl call org.freedesktop.DBus \
/org/freedesktop/DBus org.freedesktop.DBus \
ReloadConfig
. I< Optional. Type list of uniline. >
ExecStop
Commands to execute to stop the service started via "ExecStart". This argument takes multiple command
lines, following the same scheme as described for "ExecStart" above. Use of this setting is optional.
After the commands configured in this option are run, it is implied that the service is stopped, and any
processes remaining for it are terminated according to the "KillMode" setting (see systemd.kill(5)). If
this option is not specified, the process is terminated by sending the signal specified in "KillSignal"
or "RestartKillSignal" when service stop is requested. Specifier and environment variable substitution is
supported (including $MAINPID, see above).
Note that it is usually not sufficient to specify a command for this setting that only asks the service
to terminate (for example, by sending some form of termination signal to it), but does not wait for it to
do so. Since the remaining processes of the services are killed according to "KillMode" and "KillSignal"
or "RestartKillSignal" as described above immediately after the command exited, this may not result in a
clean stop. The specified command should hence be a synchronous operation, not an asynchronous one.
Note that the commands specified in "ExecStop" are only executed when the service started successfully
first. They are not invoked if the service was never started at all, or in case its start-up failed, for
example because any of the commands specified in "ExecStart", "ExecStartPre" or "ExecStartPost" failed
(and weren't prefixed with "-", see above) or timed out. Use "ExecStopPost" to invoke commands when a
service failed to start up correctly and is shut down again. Also note that the stop operation is always
performed if the service started successfully, even if the processes in the service terminated on their
own or were killed. The stop commands must be prepared to deal with that case. $MAINPID will be unset if
systemd knows that the main process exited by the time the stop commands are called.
Service restart requests are implemented as stop operations followed by start operations. This means that
"ExecStop" and "ExecStopPost" are executed during a service restart operation.
It is recommended to use this setting for commands that communicate with the service requesting clean
termination. For post-mortem clean-up steps use "ExecStopPost" instead. Optional. Type list of uniline.
ExecStopPost
Additional commands that are executed after the service is stopped. This includes cases where the
commands configured in "ExecStop" were used, where the service does not have any "ExecStop" defined, or
where the service exited unexpectedly. This argument takes multiple command lines, following the same
scheme as described for "ExecStart". Use of these settings is optional. Specifier and environment
variable substitution is supported. Note that – unlike "ExecStop" – commands specified with this setting
are invoked when a service failed to start up correctly and is shut down again.
It is recommended to use this setting for clean-up operations that shall be executed even when the
service failed to start up correctly. Commands configured with this setting need to be able to operate
even if the service failed starting up half-way and left incompletely initialized data around. As the
service's processes have been terminated already when the commands specified with this setting are
executed they should not attempt to communicate with them.
Note that all commands that are configured with this setting are invoked with the result code of the
service, as well as the main process' exit code and status, set in the $SERVICE_RESULT, $EXIT_CODE and
$EXIT_STATUS environment variables, see systemd.exec(5) for details.
Note that the execution of "ExecStopPost" is taken into account for the purpose of "Before"/"After"
ordering constraints. Optional. Type list of uniline.
RestartSec
Configures the time to sleep before restarting a service (as configured with "Restart"). Takes a unit-
less value in seconds, or a time span value such as "5min 20s". Defaults to 100ms. Optional. Type
uniline.
RestartSteps
Configures the number of steps to take to increase the interval of auto-restarts from "RestartSec" to
"RestartMaxDelaySec". Takes a positive integer or 0 to disable it. Defaults to 0.
This setting is effective only if "RestartMaxDelaySec" is also set. Optional. Type uniline.
RestartMaxDelaySec
Configures the longest time to sleep before restarting a service as the interval goes up with
"RestartSteps". Takes a value in the same format as "RestartSec", or "infinity" to disable the setting.
Defaults to "infinity".
This setting is effective only if "RestartSteps" is also set. Optional. Type uniline.
TimeoutStartSec
Configures the time to wait for start-up. If a daemon service does not signal start-up completion within
the configured time, the service will be considered failed and will be shut down again. The precise
action depends on the "TimeoutStartFailureMode" option. Takes a unit-less value in seconds, or a time
span value such as "5min 20s". Pass "infinity" to disable the timeout logic. Defaults to
"DefaultTimeoutStartSec" set in the manager, except when "Type=oneshot" is used, in which case the
timeout is disabled by default (see systemd-system.conf(5)).
If a service of "Type=notify"/"Type=notify-reload" sends "EXTEND_TIMEOUT_USEC=…", this may cause the
start time to be extended beyond "TimeoutStartSec". The first receipt of this message must occur before
"TimeoutStartSec" is exceeded, and once the start time has extended beyond "TimeoutStartSec", the service
manager will allow the service to continue to start, provided the service repeats "EXTEND_TIMEOUT_USEC=…"
within the interval specified until the service startup status is finished by "READY=1". (see
sd_notify(3)).
Note that the start timeout is also applied to service reloads, regardless if implemented through
"ExecReload" or via the reload logic enabled via "Type=notify-reload". If the reload does not complete
within the configured time, the reload will be considered failed and the service will continue running
with the old configuration. This will not affect the running service, but will be logged and will cause
e.g. systemctl reload to fail. Optional. Type uniline.
TimeoutStopSec
This option serves two purposes. First, it configures the time to wait for each "ExecStop" command. If
any of them times out, subsequent "ExecStop" commands are skipped and the service will be terminated by
"SIGTERM". If no "ExecStop" commands are specified, the service gets the "SIGTERM" immediately. This
default behavior can be changed by the "TimeoutStopFailureMode" option. Second, it configures the time to
wait for the service itself to stop. If it doesn't terminate in the specified time, it will be forcibly
terminated by "SIGKILL" (see "KillMode" in systemd.kill(5)). Takes a unit-less value in seconds, or a
time span value such as "5min 20s". Pass "infinity" to disable the timeout logic. Defaults to
"DefaultTimeoutStopSec" from the manager configuration file (see systemd-system.conf(5)).
If a service of "Type=notify"/"Type=notify-reload" sends "EXTEND_TIMEOUT_USEC=…", this may cause the stop
time to be extended beyond "TimeoutStopSec". The first receipt of this message must occur before
"TimeoutStopSec" is exceeded, and once the stop time has extended beyond "TimeoutStopSec", the service
manager will allow the service to continue to stop, provided the service repeats "EXTEND_TIMEOUT_USEC=…"
within the interval specified, or terminates itself (see sd_notify(3)). Optional. Type uniline.
TimeoutAbortSec
This option configures the time to wait for the service to terminate when it was aborted due to a
watchdog timeout (see "WatchdogSec"). If the service has a short "TimeoutStopSec" this option can be used
to give the system more time to write a core dump of the service. Upon expiration the service will be
forcibly terminated by "SIGKILL" (see "KillMode" in systemd.kill(5)). The core file will be truncated in
this case. Use "TimeoutAbortSec" to set a sensible timeout for the core dumping per service that is large
enough to write all expected data while also being short enough to handle the service failure in due
time.
Takes a unit-less value in seconds, or a time span value such as "5min 20s". Pass an empty value to skip
the dedicated watchdog abort timeout handling and fall back "TimeoutStopSec". Pass "infinity" to disable
the timeout logic. Defaults to "DefaultTimeoutAbortSec" from the manager configuration file (see
systemd-system.conf(5)).
If a service of "Type=notify"/"Type=notify-reload" handles "SIGABRT" itself (instead of relying on the
kernel to write a core dump) it can send "EXTEND_TIMEOUT_USEC=…" to extended the abort time beyond
"TimeoutAbortSec". The first receipt of this message must occur before "TimeoutAbortSec" is exceeded, and
once the abort time has extended beyond "TimeoutAbortSec", the service manager will allow the service to
continue to abort, provided the service repeats "EXTEND_TIMEOUT_USEC=…" within the interval specified, or
terminates itself (see sd_notify(3)). Optional. Type uniline.
TimeoutSec
A shorthand for configuring both "TimeoutStartSec" and "TimeoutStopSec" to the specified value.
Optional. Type uniline.
TimeoutStartFailureMode
These options configure the action that is taken in case a daemon service does not signal start-up within
its configured "TimeoutStartSec", respectively if it does not stop within "TimeoutStopSec". Takes one of
"terminate", "abort" and "kill". Both options default to "terminate".
If "terminate" is set the service will be gracefully terminated by sending the signal specified in
"KillSignal" (defaults to "SIGTERM", see systemd.kill(5)). If the service does not terminate the
"FinalKillSignal" is sent after "TimeoutStopSec". If "abort" is set, "WatchdogSignal" is sent instead and
"TimeoutAbortSec" applies before sending "FinalKillSignal". This setting may be used to analyze services
that fail to start-up or shut-down intermittently. By using "kill" the service is immediately terminated
by sending "FinalKillSignal" without any further timeout. This setting can be used to expedite the
shutdown of failing services. Optional. Type enum. choice: 'abort', 'kill', 'terminate'.
TimeoutStopFailureMode
These options configure the action that is taken in case a daemon service does not signal start-up within
its configured "TimeoutStartSec", respectively if it does not stop within "TimeoutStopSec". Takes one of
"terminate", "abort" and "kill". Both options default to "terminate".
If "terminate" is set the service will be gracefully terminated by sending the signal specified in
"KillSignal" (defaults to "SIGTERM", see systemd.kill(5)). If the service does not terminate the
"FinalKillSignal" is sent after "TimeoutStopSec". If "abort" is set, "WatchdogSignal" is sent instead and
"TimeoutAbortSec" applies before sending "FinalKillSignal". This setting may be used to analyze services
that fail to start-up or shut-down intermittently. By using "kill" the service is immediately terminated
by sending "FinalKillSignal" without any further timeout. This setting can be used to expedite the
shutdown of failing services. Optional. Type enum. choice: 'abort', 'kill', 'terminate'.
RuntimeMaxSec
Configures a maximum time for the service to run. If this is used and the service has been active for
longer than the specified time it is terminated and put into a failure state. Note that this setting does
not have any effect on "Type=oneshot" services, as they terminate immediately after activation completed
(use "TimeoutStartSec" to limit their activation). Pass "infinity" (the default) to configure no runtime
limit.
If a service of "Type=notify"/"Type=notify-reload" sends "EXTEND_TIMEOUT_USEC=…", this may cause the
runtime to be extended beyond "RuntimeMaxSec". The first receipt of this message must occur before
"RuntimeMaxSec" is exceeded, and once the runtime has extended beyond "RuntimeMaxSec", the service
manager will allow the service to continue to run, provided the service repeats "EXTEND_TIMEOUT_USEC=…"
within the interval specified until the service shutdown is achieved by "STOPPING=1" (or termination).
(see sd_notify(3)). Optional. Type uniline.
RuntimeRandomizedExtraSec
This option modifies "RuntimeMaxSec" by increasing the maximum runtime by an evenly distributed duration
between 0 and the specified value (in seconds). If "RuntimeMaxSec" is unspecified, then this feature will
be disabled. Optional. Type uniline.
WatchdogSec
Configures the watchdog timeout for a service. The watchdog is activated when the start-up is completed.
The service must call sd_notify(3) regularly with "WATCHDOG=1" (i.e. the "keep-alive ping"). If the time
between two such calls is larger than the configured time, then the service is placed in a failed state
and it will be terminated with "SIGABRT" (or the signal specified by "WatchdogSignal"). By setting
"Restart" to "on-failure", "on-watchdog", "on-abnormal" or "always", the service will be automatically
restarted. The time configured here will be passed to the executed service process in the "WATCHDOG_USEC"
environment variable. This allows daemons to automatically enable the keep-alive pinging logic if
watchdog support is enabled for the service. If this option is used, "NotifyAccess" (see below) should be
set to open access to the notification socket provided by systemd. If "NotifyAccess" is not set, it will
be implicitly set to "main". Defaults to 0, which disables this feature. The service can check whether
the service manager expects watchdog keep-alive notifications. See sd_watchdog_enabled(3) for details.
sd_event_set_watchdog(3) may be used to enable automatic watchdog notification support. Optional. Type
uniline.
Restart
Configures whether the service shall be restarted when the service process exits, is killed, or a timeout
is reached. The service process may be the main service process, but it may also be one of the processes
specified with "ExecStartPre", "ExecStartPost", "ExecStop", "ExecStopPost", or "ExecReload". When the
death of the process is a result of systemd operation (e.g. service stop or restart), the service will
not be restarted. Timeouts include missing the watchdog "keep-alive ping" deadline and a service start,
reload, and stop operation timeouts.
Takes one of "no", "on-success", "on-failure", "on-abnormal", "on-watchdog", "on-abort", or "always". If
set to "no" (the default), the service will not be restarted. If set to "on-success", it will be
restarted only when the service process exits cleanly. In this context, a clean exit means any of the
following: exit code of 0;for types other than "Type=oneshot", one of the signals "SIGHUP", "SIGINT",
"SIGTERM", or "SIGPIPE"; exit statuses and signals specified in "SuccessExitStatus". If set to
"on-failure", the service will be restarted when the process exits with a non-zero exit code, is
terminated by a signal (including on core dump, but excluding the aforementioned four signals), when an
operation (such as service reload) times out, and when the configured watchdog timeout is triggered. If
set to "on-abnormal", the service will be restarted when the process is terminated by a signal (including
on core dump, excluding the aforementioned four signals), when an operation times out, or when the
watchdog timeout is triggered. If set to "on-abort", the service will be restarted only if the service
process exits due to an uncaught signal not specified as a clean exit status. If set to "on-watchdog",
the service will be restarted only if the watchdog timeout for the service expires. If set to "always",
the service will be restarted regardless of whether it exited cleanly or not, got terminated abnormally
by a signal, or hit a timeout. Note that "Type=oneshot" services will never be restarted on a clean exit
status, i.e. "always" and "on-success" are rejected for them.
As exceptions to the setting above, the service will not be restarted if the exit code or signal is
specified in "RestartPreventExitStatus" (see below) or the service is stopped with systemctl stop or an
equivalent operation. Also, the services will always be restarted if the exit code or signal is specified
in "RestartForceExitStatus" (see below).
Note that service restart is subject to unit start rate limiting configured with "StartLimitIntervalSec"
and "StartLimitBurst", see systemd.unit(5) for details.
Setting this to "on-failure" is the recommended choice for long-running services, in order to increase
reliability by attempting automatic recovery from errors. For services that shall be able to terminate on
their own choice (and avoid immediate restarting), "on-abnormal" is an alternative choice. Optional.
Type enum. choice: 'always', 'no', 'on-abnormal', 'on-abort', 'on-failure', 'on-success', 'on-watchdog'.
RestartMode
Takes a string value that specifies how a service should restart: If set to "normal" (the default), the
service restarts by going through a failed/inactive state.If set to "direct", the service transitions to
the activating state directly during auto-restart, skipping failed/inactive state. "ExecStopPost" is
invoked. "OnSuccess" and "OnFailure" are skipped.
This option is useful in cases where a dependency can fail temporarily but we don't want these temporary
failures to make the dependent units fail. When this option is set to "direct", dependent units are not
notified of these temporary failures. Optional. Type uniline.
SuccessExitStatus
Takes a list of exit status definitions that, when returned by the main service process, will be
considered successful termination, in addition to the normal successful exit status 0 and, except for
"Type=oneshot", the signals "SIGHUP", "SIGINT", "SIGTERM", and "SIGPIPE". Exit status definitions can be
numeric termination statuses, termination status names, or termination signal names, separated by spaces.
See the Process Exit Codes section in systemd.exec(5) for a list of termination status names (for this
setting only the part without the "EXIT_" or "EX_" prefix should be used). See signal(7) for a list of
signal names.
Note that this setting does not change the mapping between numeric exit statuses and their names, i.e.
regardless how this setting is used 0 will still be mapped to "SUCCESS" (and thus typically shown as
"0/SUCCESS" in tool outputs) and 1 to "FAILURE" (and thus typically shown as "1/FAILURE"), and so on. It
only controls what happens as effect of these exit statuses, and how it propagates to the state of the
service as a whole.
This option may appear more than once, in which case the list of successful exit statuses is merged. If
the empty string is assigned to this option, the list is reset, all prior assignments of this option will
have no effect.
Note: systemd-analyze exit-status may be used to list exit statuses and translate between numerical
status values and names. Optional. Type uniline.
RestartPreventExitStatus
Takes a list of exit status definitions that, when returned by the main service process, will prevent
automatic service restarts, regardless of the restart setting configured with "Restart". Exit status
definitions can be numeric termination statuses, termination status names, or termination signal names,
separated by spaces. Defaults to the empty list, so that, by default, no exit status is excluded from the
configured restart logic. A service with the "RestartPreventExitStatus" setting
RestartPreventExitStatus=TEMPFAIL 250 SIGKILL Exit status 75 ("TEMPFAIL"), 250, and the termination
signal "SIGKILL" will not result in automatic service restarting. This option may appear more than once,
in which case the list of restart-preventing statuses is merged. If the empty string is assigned to this
option, the list is reset and all prior assignments of this option will have no effect.
Note that this setting has no effect on processes configured via "ExecStartPre", "ExecStartPost",
"ExecStop", "ExecStopPost" or "ExecReload", but only on the main service process, i.e. either the one
invoked by "ExecStart" or (depending on "Type", "PIDFile", …) the otherwise configured main process.
Optional. Type uniline.
RestartForceExitStatus
Takes a list of exit status definitions that, when returned by the main service process, will force
automatic service restarts, regardless of the restart setting configured with "Restart". The argument
format is similar to "RestartPreventExitStatus".
Note that for "Type=oneshot" services, a success exit status will prevent them from auto-restarting, no
matter whether the corresponding exit statuses are listed in this option or not. Optional. Type uniline.
RootDirectoryStartOnly
Takes a boolean argument. If true, the root directory, as configured with the "RootDirectory" option (see
systemd.exec(5) for more information), is only applied to the process started with "ExecStart", and not
to the various other "ExecStartPre", "ExecStartPost", "ExecReload", "ExecStop", and "ExecStopPost"
commands. If false, the setting is applied to all configured commands the same way. Defaults to false.
Optional. Type boolean.
NonBlocking
Set the "O_NONBLOCK" flag for all file descriptors passed via socket-based activation. If true, all file
descriptors >= 3 (i.e. all except stdin, stdout, stderr), excluding those passed in via the file
descriptor storage logic (see "FileDescriptorStoreMax" for details), will have the "O_NONBLOCK" flag set
and hence are in non-blocking mode. This option is only useful in conjunction with a socket unit, as
described in systemd.socket(5) and has no effect on file descriptors which were previously saved in the
file-descriptor store for example. Defaults to false.
Note that if the same socket unit is configured to be passed to multiple service units (via the "Sockets"
setting, see below), and these services have different "NonBlocking" configurations, the precise state of
"O_NONBLOCK" depends on the order in which these services are invoked, and will possibly change after
service code already took possession of the socket file descriptor, simply because the "O_NONBLOCK" state
of a socket is shared by all file descriptors referencing it. Hence it is essential that all services
sharing the same socket use the same "NonBlocking" configuration, and do not change the flag in service
code either. Optional. Type uniline.
NotifyAccess
Controls access to the service status notification socket, as accessible via the sd_notify(3) call. Takes
one of "none" (the default), "main", "exec" or "all". If "none", no daemon status updates are accepted
from the service processes, all status update messages are ignored. If "main", only service updates sent
from the main process of the service are accepted. If "exec", only service updates sent from any of the
main or control processes originating from one of the "Exec*=" commands are accepted. If "all", all
services updates from all members of the service's control group are accepted. This option should be set
to open access to the notification socket when using "Type=notify"/"Type=notify-reload" or "WatchdogSec"
(see above). If those options are used but "NotifyAccess" is not configured, it will be implicitly set to
"main".
Note that sd_notify() notifications may be attributed to units correctly only if either the sending
process is still around at the time PID 1 processes the message, or if the sending process is explicitly
runtime-tracked by the service manager. The latter is the case if the service manager originally forked
off the process, i.e. on all processes that match "main" or "exec". Conversely, if an auxiliary process
of the unit sends an sd_notify() message and immediately exits, the service manager might not be able to
properly attribute the message to the unit, and thus will ignore it, even if "NotifyAccess""all" is set
for it.
Hence, to eliminate all race conditions involving lookup of the client's unit and attribution of
notifications to units correctly, sd_notify_barrier() may be used. This call acts as a synchronization
point and ensures all notifications sent before this call have been picked up by the service manager when
it returns successfully. Use of sd_notify_barrier() is needed for clients which are not invoked by the
service manager, otherwise this synchronization mechanism is unnecessary for attribution of notifications
to the unit. Optional. Type enum. choice: 'all', 'exec', 'main', 'none'.
Sockets
Specifies the name of the socket units this service shall inherit socket file descriptors from when the
service is started. Normally, it should not be necessary to use this setting, as all socket file
descriptors whose unit shares the same name as the service (subject to the different unit name suffix of
course) are passed to the spawned process.
Note that the same socket file descriptors may be passed to multiple processes simultaneously. Also note
that a different service may be activated on incoming socket traffic than the one which is ultimately
configured to inherit the socket file descriptors. Or, in other words: the "Service" setting of ".socket"
units does not have to match the inverse of the "Sockets" setting of the ".service" it refers to.
This option may appear more than once, in which case the list of socket units is merged. Note that once
set, clearing the list of sockets again (for example, by assigning the empty string to this option) is
not supported. Optional. Type uniline.
FileDescriptorStoreMax
Configure how many file descriptors may be stored in the service manager for the service using
sd_pid_notify_with_fds(3)'s "FDSTORE=1" messages. This is useful for implementing services that can
restart after an explicit request or a crash without losing state. Any open sockets and other file
descriptors which should not be closed during the restart may be stored this way. Application state can
either be serialized to a file in "RuntimeDirectory", or stored in a memfd_create(2) memory file
descriptor. Defaults to 0, i.e. no file descriptors may be stored in the service manager. All file
descriptors passed to the service manager from a specific service are passed back to the service's main
process on the next service restart (see sd_listen_fds(3) for details about the precise protocol used and
the order in which the file descriptors are passed). Any file descriptors passed to the service manager
are automatically closed when "POLLHUP" or "POLLERR" is seen on them, or when the service is fully
stopped and no job is queued or being executed for it (the latter can be tweaked with
"FileDescriptorStorePreserve", see below). If this option is used, "NotifyAccess" (see above) should be
set to open access to the notification socket provided by systemd. If "NotifyAccess" is not set, it will
be implicitly set to "main".
The fdstore command of systemd-analyze(1) may be used to list the current contents of a service's file
descriptor store.
Note that the service manager will only pass file descriptors contained in the file descriptor store to
the service's own processes, never to other clients via IPC or similar. However, it does allow
unprivileged clients to query the list of currently open file descriptors of a service. Sensitive data
may hence be safely placed inside the referenced files, but should not be attached to the metadata (e.g.
included in filenames) of the stored file descriptors.
If this option is set to a non-zero value the $FDSTORE environment variable will be set for processes
invoked for this service. See systemd.exec(5) for details.
For further information on the file descriptor store see the File Descriptor Store
<https://systemd.io/FILE_DESCRIPTOR_STORE> overview. Optional. Type uniline.
FileDescriptorStorePreserve
Takes one of "no", "yes", "restart" and controls when to release the service's file descriptor store
(i.e. when to close the contained file descriptors, if any). If set to "no" the file descriptor store is
automatically released when the service is stopped; if "restart" (the default) it is kept around as long
as the unit is neither inactive nor failed, or a job is queued for the service, or the service is
expected to be restarted. If "yes" the file descriptor store is kept around until the unit is removed
from memory (i.e. is not referenced anymore and inactive). The latter is useful to keep entries in the
file descriptor store pinned until the service manager exits.
Use systemctl clean --what=fdstore … to release the file descriptor store explicitly. Optional. Type
enum. choice: 'no', 'restart', 'yes'.
USBFunctionDescriptors
Configure the location of a file containing USB FunctionFS <https://docs.kernel.org/usb/functionfs.html>
descriptors, for implementation of USB gadget functions. This is used only in conjunction with a socket
unit with "ListenUSBFunction" configured. The contents of this file are written to the "ep0" file after
it is opened. Optional. Type uniline.
USBFunctionStrings
Configure the location of a file containing USB FunctionFS strings. Behavior is similar to
"USBFunctionDescriptors" above. Optional. Type uniline.
OOMPolicy
Configure the out-of-memory (OOM) killing policy for the kernel and the userspace OOM killer
systemd-oomd.service(8). On Linux, when memory becomes scarce to the point that the kernel has trouble
allocating memory for itself, it might decide to kill a running process in order to free up memory and
reduce memory pressure. Note that "systemd-oomd.service" is a more flexible solution that aims to prevent
out-of-memory situations for the userspace too, not just the kernel, by attempting to terminate services
earlier, before the kernel would have to act.
This setting takes one of "continue", "stop" or "kill". If set to "continue" and a process in the unit is
killed by the OOM killer, this is logged but the unit continues running. If set to "stop" the event is
logged but the unit is terminated cleanly by the service manager. If set to "kill" and one of the unit's
processes is killed by the OOM killer the kernel is instructed to kill all remaining processes of the
unit too, by setting the "memory.oom.group" attribute to 1; also see kernel page Control Group v2
<https://docs.kernel.org/admin-guide/cgroup-v2.html>.
Defaults to the setting "DefaultOOMPolicy" in systemd-system.conf(5) is set to, except for units where
"Delegate" is turned on, where it defaults to "continue".
Use the "OOMScoreAdjust" setting to configure whether processes of the unit shall be considered preferred
or less preferred candidates for process termination by the Linux OOM killer logic. See systemd.exec(5)
for details.
This setting also applies to systemd-oomd.service(8). Similarly to the kernel OOM kills performed by the
kernel, this setting determines the state of the unit after systemd-oomd kills a cgroup associated with
it. Optional. Type uniline.
OpenFile
Takes an argument of the form "path:fd-name:options", where: "path" is a path to a file or an "AF_UNIX"
socket in the file system;"fd-name" is a name that will be associated with the file descriptor; the name
may contain any ASCII character, but must exclude control characters and ":", and must be at most 255
characters in length; it is optional and, if not provided, defaults to the file name;"options" is a
comma-separated list of access options; possible values are "read-only", "append", "truncate",
"graceful"; if not specified, files will be opened in "rw" mode; if "graceful" is specified, errors
during file/socket opening are ignored. Specifying the same option several times is treated as an error.
The file or socket is opened by the service manager and the file descriptor is passed to the service. If
the path is a socket, we call connect() on it. See sd_listen_fds(3) for more details on how to retrieve
these file descriptors.
This setting is useful to allow services to access files/sockets that they can't access themselves (due
to running in a separate mount namespace, not having privileges, ...).
This setting can be specified multiple times, in which case all the specified paths are opened and the
file descriptors passed to the service. If the empty string is assigned, the entire list of open files
defined prior to this is reset. Optional. Type uniline.
ReloadSignal
Configures the UNIX process signal to send to the service's main process when asked to reload the
service's configuration. Defaults to "SIGHUP". This option has no effect unless "Type""notify-reload" is
used, see above. Optional. Type uniline.
FailureAction
Deprecated Optional. Type uniline.
SuccessAction
Deprecated Optional. Type uniline.
StartLimitBurst
Deprecated Optional. Type uniline.
StartLimitInterval
Deprecated Optional. Type uniline.
RebootArgument
Deprecated Optional. Type uniline.
SEE ALSO
• cme
COPYRIGHT
2010-2016 Lennart Poettering and others
2016 Dominique Dumont
LICENSE
LGPLv2.1+
perl v5.40.0 2024-09-22 Config::Model::...ection::Service(3pm)