]>
Commit | Line | Data |
---|---|---|
dd1eb43b LP |
1 | <?xml-stylesheet type="text/xsl" href="http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl"?> |
2 | <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" | |
3 | "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> | |
4 | ||
5 | <!-- | |
6 | This file is part of systemd. | |
7 | ||
8 | Copyright 2010 Lennart Poettering | |
9 | ||
10 | systemd is free software; you can redistribute it and/or modify it | |
5430f7f2 LP |
11 | under the terms of the GNU Lesser General Public License as published by |
12 | the Free Software Foundation; either version 2.1 of the License, or | |
dd1eb43b LP |
13 | (at your option) any later version. |
14 | ||
15 | systemd is distributed in the hope that it will be useful, but | |
16 | WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
5430f7f2 | 18 | Lesser General Public License for more details. |
dd1eb43b | 19 | |
5430f7f2 | 20 | You should have received a copy of the GNU Lesser General Public License |
dd1eb43b LP |
21 | along with systemd; If not, see <http://www.gnu.org/licenses/>. |
22 | --> | |
23 | ||
24 | <refentry id="systemd.exec"> | |
25 | <refentryinfo> | |
26 | <title>systemd.exec</title> | |
27 | <productname>systemd</productname> | |
28 | ||
29 | <authorgroup> | |
30 | <author> | |
31 | <contrib>Developer</contrib> | |
32 | <firstname>Lennart</firstname> | |
33 | <surname>Poettering</surname> | |
34 | <email>lennart@poettering.net</email> | |
35 | </author> | |
36 | </authorgroup> | |
37 | </refentryinfo> | |
38 | ||
39 | <refmeta> | |
40 | <refentrytitle>systemd.exec</refentrytitle> | |
41 | <manvolnum>5</manvolnum> | |
42 | </refmeta> | |
43 | ||
44 | <refnamediv> | |
45 | <refname>systemd.exec</refname> | |
34511ca7 | 46 | <refpurpose>Execution environment configuration</refpurpose> |
dd1eb43b LP |
47 | </refnamediv> |
48 | ||
49 | <refsynopsisdiv> | |
e670b166 ZJS |
50 | <para><filename><replaceable>service</replaceable>.service</filename>, |
51 | <filename><replaceable>socket</replaceable>.socket</filename>, | |
52 | <filename><replaceable>mount</replaceable>.mount</filename>, | |
53 | <filename><replaceable>swap</replaceable>.swap</filename></para> | |
dd1eb43b LP |
54 | </refsynopsisdiv> |
55 | ||
56 | <refsect1> | |
57 | <title>Description</title> | |
58 | ||
9a666408 | 59 | <para>Unit configuration files for services, sockets, |
43638332 | 60 | mount points, and swap devices share a subset of |
2292707d LP |
61 | configuration options which define the execution |
62 | environment of spawned processes.</para> | |
dd1eb43b LP |
63 | |
64 | <para>This man page lists the configuration options | |
9a666408 | 65 | shared by these four unit types. See |
dd1eb43b LP |
66 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> |
67 | for the common options of all unit configuration | |
68 | files, and | |
2292707d LP |
69 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
70 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
d868475a | 71 | <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
dd1eb43b LP |
72 | and |
73 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
74 | for more information on the specific unit | |
75 | configuration files. The execution specific | |
76 | configuration options are configured in the [Service], | |
16dad32e | 77 | [Socket], [Mount], or [Swap] sections, depending on the unit |
dd1eb43b LP |
78 | type.</para> |
79 | </refsect1> | |
80 | ||
81 | <refsect1> | |
82 | <title>Options</title> | |
83 | ||
ccc9a4f9 | 84 | <variablelist class='unit-directives'> |
dd1eb43b LP |
85 | |
86 | <varlistentry> | |
87 | <term><varname>WorkingDirectory=</varname></term> | |
88 | ||
89 | <listitem><para>Takes an absolute | |
90 | directory path. Sets the working | |
e06c73cc | 91 | directory for executed processes. If |
79640424 | 92 | not set, defaults to the root directory |
e06c73cc LP |
93 | when systemd is running as a system |
94 | instance and the respective user's | |
95 | home directory if run as | |
96 | user.</para></listitem> | |
dd1eb43b LP |
97 | </varlistentry> |
98 | ||
99 | <varlistentry> | |
100 | <term><varname>RootDirectory=</varname></term> | |
101 | ||
102 | <listitem><para>Takes an absolute | |
103 | directory path. Sets the root | |
104 | directory for executed processes, with | |
105 | the | |
106 | <citerefentry><refentrytitle>chroot</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
79640424 | 107 | system call. If this is used, it must |
dd1eb43b LP |
108 | be ensured that the process and all |
109 | its auxiliary files are available in | |
110 | the <function>chroot()</function> | |
111 | jail.</para></listitem> | |
112 | </varlistentry> | |
113 | ||
114 | <varlistentry> | |
115 | <term><varname>User=</varname></term> | |
116 | <term><varname>Group=</varname></term> | |
117 | ||
118 | <listitem><para>Sets the Unix user | |
16dad32e AE |
119 | or group that the processes are executed |
120 | as, respectively. Takes a single user or group | |
dd1eb43b | 121 | name or ID as argument. If no group is |
16dad32e | 122 | set, the default group of the user is |
dd1eb43b LP |
123 | chosen.</para></listitem> |
124 | </varlistentry> | |
125 | ||
126 | <varlistentry> | |
127 | <term><varname>SupplementaryGroups=</varname></term> | |
128 | ||
129 | <listitem><para>Sets the supplementary | |
130 | Unix groups the processes are executed | |
e9dd9f95 | 131 | as. This takes a space-separated list |
dd1eb43b LP |
132 | of group names or IDs. This option may |
133 | be specified more than once in which | |
134 | case all listed groups are set as | |
74051b9b LP |
135 | supplementary groups. When the empty |
136 | string is assigned the list of | |
137 | supplementary groups is reset, and all | |
138 | assignments prior to this one will | |
139 | have no effect. In any way, this | |
140 | option does not override, but extends | |
141 | the list of supplementary groups | |
142 | configured in the system group | |
143 | database for the | |
dd1eb43b LP |
144 | user.</para></listitem> |
145 | </varlistentry> | |
146 | ||
147 | <varlistentry> | |
148 | <term><varname>Nice=</varname></term> | |
149 | ||
150 | <listitem><para>Sets the default nice | |
151 | level (scheduling priority) for | |
152 | executed processes. Takes an integer | |
153 | between -20 (highest priority) and 19 | |
154 | (lowest priority). See | |
155 | <citerefentry><refentrytitle>setpriority</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
156 | for details.</para></listitem> | |
157 | </varlistentry> | |
158 | ||
159 | <varlistentry> | |
dd6c17b1 | 160 | <term><varname>OOMScoreAdjust=</varname></term> |
dd1eb43b LP |
161 | |
162 | <listitem><para>Sets the adjustment | |
163 | level for the Out-Of-Memory killer for | |
164 | executed processes. Takes an integer | |
dd6c17b1 LP |
165 | between -1000 (to disable OOM killing |
166 | for this process) and 1000 (to make | |
dd1eb43b LP |
167 | killing of this process under memory |
168 | pressure very likely). See <ulink | |
6ed80a4e | 169 | url="https://www.kernel.org/doc/Documentation/filesystems/proc.txt">proc.txt</ulink> |
dd1eb43b LP |
170 | for details.</para></listitem> |
171 | </varlistentry> | |
172 | ||
173 | <varlistentry> | |
174 | <term><varname>IOSchedulingClass=</varname></term> | |
175 | ||
176 | <listitem><para>Sets the IO scheduling | |
177 | class for executed processes. Takes an | |
178 | integer between 0 and 3 or one of the | |
179 | strings <option>none</option>, | |
180 | <option>realtime</option>, | |
181 | <option>best-effort</option> or | |
182 | <option>idle</option>. See | |
183 | <citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
184 | for details.</para></listitem> | |
185 | </varlistentry> | |
186 | ||
187 | <varlistentry> | |
188 | <term><varname>IOSchedulingPriority=</varname></term> | |
189 | ||
190 | <listitem><para>Sets the IO scheduling | |
191 | priority for executed processes. Takes | |
192 | an integer between 0 (highest | |
193 | priority) and 7 (lowest priority). The | |
194 | available priorities depend on the | |
195 | selected IO scheduling class (see | |
196 | above). See | |
197 | <citerefentry><refentrytitle>ioprio_set</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
198 | for details.</para></listitem> | |
199 | </varlistentry> | |
200 | ||
201 | <varlistentry> | |
202 | <term><varname>CPUSchedulingPolicy=</varname></term> | |
203 | ||
204 | <listitem><para>Sets the CPU | |
205 | scheduling policy for executed | |
206 | processes. Takes one of | |
207 | <option>other</option>, | |
208 | <option>batch</option>, | |
209 | <option>idle</option>, | |
210 | <option>fifo</option> or | |
211 | <option>rr</option>. See | |
212 | <citerefentry><refentrytitle>sched_setscheduler</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
213 | for details.</para></listitem> | |
214 | </varlistentry> | |
215 | ||
216 | <varlistentry> | |
217 | <term><varname>CPUSchedulingPriority=</varname></term> | |
218 | ||
219 | <listitem><para>Sets the CPU | |
220 | scheduling priority for executed | |
bb112710 | 221 | processes. The available priority |
dd1eb43b | 222 | range depends on the selected CPU |
bb112710 HHPF |
223 | scheduling policy (see above). For |
224 | real-time scheduling policies an | |
225 | integer between 1 (lowest priority) | |
226 | and 99 (highest priority) can be used. | |
227 | See <citerefentry><refentrytitle>sched_setscheduler</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
228 | for details. | |
229 | </para></listitem> | |
dd1eb43b LP |
230 | </varlistentry> |
231 | ||
232 | <varlistentry> | |
233 | <term><varname>CPUSchedulingResetOnFork=</varname></term> | |
234 | ||
235 | <listitem><para>Takes a boolean | |
79640424 | 236 | argument. If true, elevated CPU |
dd1eb43b LP |
237 | scheduling priorities and policies |
238 | will be reset when the executed | |
239 | processes fork, and can hence not leak | |
240 | into child processes. See | |
241 | <citerefentry><refentrytitle>sched_setscheduler</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
242 | for details. Defaults to false.</para></listitem> | |
243 | </varlistentry> | |
244 | ||
245 | <varlistentry> | |
246 | <term><varname>CPUAffinity=</varname></term> | |
247 | ||
248 | <listitem><para>Controls the CPU | |
249 | affinity of the executed | |
96d4ce01 | 250 | processes. Takes a space-separated |
66f756d4 | 251 | list of CPU indices. This option may |
74051b9b LP |
252 | be specified more than once in which |
253 | case the specificed CPU affinity masks | |
254 | are merged. If the empty string is | |
79640424 | 255 | assigned, the mask is reset, all |
74051b9b LP |
256 | assignments prior to this will have no |
257 | effect. See | |
dd1eb43b LP |
258 | <citerefentry><refentrytitle>sched_setaffinity</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
259 | for details.</para></listitem> | |
260 | </varlistentry> | |
261 | ||
262 | <varlistentry> | |
263 | <term><varname>UMask=</varname></term> | |
264 | ||
265 | <listitem><para>Controls the file mode | |
266 | creation mask. Takes an access mode in | |
267 | octal notation. See | |
268 | <citerefentry><refentrytitle>umask</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
269 | for details. Defaults to | |
260d3708 | 270 | 0022.</para></listitem> |
dd1eb43b LP |
271 | </varlistentry> |
272 | ||
273 | <varlistentry> | |
274 | <term><varname>Environment=</varname></term> | |
275 | ||
276 | <listitem><para>Sets environment | |
277 | variables for executed | |
96d4ce01 | 278 | processes. Takes a space-separated |
dd1eb43b LP |
279 | list of variable assignments. This |
280 | option may be specified more than once | |
281 | in which case all listed variables | |
282 | will be set. If the same variable is | |
79640424 | 283 | set twice, the later setting will |
74051b9b LP |
284 | override the earlier setting. If the |
285 | empty string is assigned to this | |
79640424 | 286 | option, the list of environment |
74051b9b | 287 | variables is reset, all prior |
0ae9c92a FC |
288 | assignments have no effect. |
289 | Variable expansion is not performed | |
97d0e5f8 | 290 | inside the strings, however, specifier |
79640424 | 291 | expansion is possible. The $ character has |
97d0e5f8 | 292 | no special meaning. |
0ae9c92a FC |
293 | If you need to assign a value containing spaces |
294 | to a variable, use double quotes (") | |
295 | for the assignment.</para> | |
296 | ||
297 | <para>Example: | |
c5b37953 | 298 | <programlisting>Environment="VAR1=word1 word2" VAR2=word3 "VAR3=$word 5 6"</programlisting> |
0ae9c92a | 299 | gives three variables <literal>VAR1</literal>, |
c5b37953 ZJS |
300 | <literal>VAR2</literal>, <literal>VAR3</literal> |
301 | with the values <literal>word1 word2</literal>, | |
302 | <literal>word3</literal>, <literal>$word 5 6</literal>. | |
0ae9c92a FC |
303 | </para> |
304 | ||
305 | <para> | |
306 | See | |
dd1eb43b | 307 | <citerefentry><refentrytitle>environ</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
0ae9c92a | 308 | for details about environment variables.</para></listitem> |
dd1eb43b LP |
309 | </varlistentry> |
310 | <varlistentry> | |
311 | <term><varname>EnvironmentFile=</varname></term> | |
312 | <listitem><para>Similar to | |
313 | <varname>Environment=</varname> but | |
314 | reads the environment variables from a | |
315 | text file. The text file should | |
e9dd9f95 | 316 | contain new-line-separated variable |
dd1eb43b LP |
317 | assignments. Empty lines and lines |
318 | starting with ; or # will be ignored, | |
565d91fd MV |
319 | which may be used for commenting. A line |
320 | ending with a backslash will be concatenated | |
321 | with the following one, allowing multiline variable | |
322 | definitions. The parser strips leading | |
323 | and trailing whitespace from the values | |
7734f773 | 324 | of assignments, unless you use |
74051b9b LP |
325 | double quotes (").</para> |
326 | ||
327 | <para>The argument passed should be an | |
e9dd9f95 | 328 | absolute filename or wildcard |
74051b9b | 329 | expression, optionally prefixed with |
05cc7267 | 330 | <literal>-</literal>, which indicates |
6b4991cf JE |
331 | that if the file does not exist, it |
332 | will not be read and no error or warning | |
05cc7267 ZJS |
333 | message is logged. This option may be |
334 | specified more than once in which case | |
335 | all specified files are read. If the | |
336 | empty string is assigned to this | |
79640424 | 337 | option, the list of file to read is |
05cc7267 ZJS |
338 | reset, all prior assignments have no |
339 | effect.</para> | |
74051b9b LP |
340 | |
341 | <para>The files listed with this | |
f1779fd2 LP |
342 | directive will be read shortly before |
343 | the process is executed. Settings from | |
344 | these files override settings made | |
345 | with | |
346 | <varname>Environment=</varname>. If | |
347 | the same variable is set twice from | |
79640424 | 348 | these files, the files will be read in |
f1779fd2 LP |
349 | the order they are specified and the |
350 | later setting will override the | |
74051b9b | 351 | earlier setting.</para></listitem> |
dd1eb43b LP |
352 | </varlistentry> |
353 | ||
354 | <varlistentry> | |
355 | <term><varname>StandardInput=</varname></term> | |
356 | <listitem><para>Controls where file | |
357 | descriptor 0 (STDIN) of the executed | |
358 | processes is connected to. Takes one | |
359 | of <option>null</option>, | |
360 | <option>tty</option>, | |
361 | <option>tty-force</option>, | |
362 | <option>tty-fail</option> or | |
363 | <option>socket</option>. If | |
79640424 | 364 | <option>null</option> is selected, |
dd1eb43b LP |
365 | standard input will be connected to |
366 | <filename>/dev/null</filename>, | |
367 | i.e. all read attempts by the process | |
368 | will result in immediate EOF. If | |
79640424 | 369 | <option>tty</option> is selected, |
dd1eb43b LP |
370 | standard input is connected to a TTY |
371 | (as configured by | |
372 | <varname>TTYPath=</varname>, see | |
373 | below) and the executed process | |
374 | becomes the controlling process of the | |
375 | terminal. If the terminal is already | |
79640424 | 376 | being controlled by another process, the |
f8553ccb AE |
377 | executed process waits until the current |
378 | controlling process releases the | |
379 | terminal. | |
380 | <option>tty-force</option> | |
dd1eb43b LP |
381 | is similar to <option>tty</option>, |
382 | but the executed process is forcefully | |
383 | and immediately made the controlling | |
384 | process of the terminal, potentially | |
385 | removing previous controlling | |
386 | processes from the | |
387 | terminal. <option>tty-fail</option> is | |
388 | similar to <option>tty</option> but if | |
389 | the terminal already has a controlling | |
390 | process start-up of the executed | |
391 | process fails. The | |
392 | <option>socket</option> option is only | |
393 | valid in socket-activated services, | |
394 | and only when the socket configuration | |
395 | file (see | |
396 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
397 | for details) specifies a single socket | |
79640424 | 398 | only. If this option is set, standard |
dd1eb43b LP |
399 | input will be connected to the socket |
400 | the service was activated from, which | |
401 | is primarily useful for compatibility | |
402 | with daemons designed for use with the | |
403 | traditional | |
404 | <citerefentry><refentrytitle>inetd</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
405 | daemon. This setting defaults to | |
406 | <option>null</option>.</para></listitem> | |
407 | </varlistentry> | |
408 | <varlistentry> | |
409 | <term><varname>StandardOutput=</varname></term> | |
410 | <listitem><para>Controls where file | |
411 | descriptor 1 (STDOUT) of the executed | |
412 | processes is connected to. Takes one | |
413 | of <option>inherit</option>, | |
414 | <option>null</option>, | |
415 | <option>tty</option>, | |
416 | <option>syslog</option>, | |
28dbc1e8 | 417 | <option>kmsg</option>, |
706343f4 LP |
418 | <option>journal</option>, |
419 | <option>syslog+console</option>, | |
28dbc1e8 | 420 | <option>kmsg+console</option>, |
706343f4 | 421 | <option>journal+console</option> or |
dd1eb43b | 422 | <option>socket</option>. If set to |
79640424 | 423 | <option>inherit</option>, the file |
dd1eb43b LP |
424 | descriptor of standard input is |
425 | duplicated for standard output. If set | |
79640424 | 426 | to <option>null</option>, standard |
dd1eb43b LP |
427 | output will be connected to |
428 | <filename>/dev/null</filename>, | |
429 | i.e. everything written to it will be | |
79640424 | 430 | lost. If set to <option>tty</option>, |
dd1eb43b LP |
431 | standard output will be connected to a |
432 | tty (as configured via | |
433 | <varname>TTYPath=</varname>, see | |
434 | below). If the TTY is used for output | |
79640424 | 435 | only, the executed process will not |
dd1eb43b LP |
436 | become the controlling process of the |
437 | terminal, and will not fail or wait | |
438 | for other processes to release the | |
439 | terminal. <option>syslog</option> | |
440 | connects standard output to the | |
441 | <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
346bce1f LP |
442 | system syslog |
443 | service. <option>kmsg</option> | |
dd1eb43b LP |
444 | connects it with the kernel log buffer |
445 | which is accessible via | |
706343f4 LP |
446 | <citerefentry><refentrytitle>dmesg</refentrytitle><manvolnum>1</manvolnum></citerefentry>. <option>journal</option> |
447 | connects it with the journal which is | |
448 | accessible via | |
169c4f65 | 449 | <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
706343f4 LP |
450 | (Note that everything that is written |
451 | to syslog or kmsg is implicitly stored | |
452 | in the journal as well, those options | |
453 | are hence supersets of this | |
454 | one). <option>syslog+console</option>, | |
455 | <option>journal+console</option> and | |
456 | <option>kmsg+console</option> work | |
28dbc1e8 LP |
457 | similarly but copy the output to the |
458 | system console as | |
459 | well. <option>socket</option> connects | |
460 | standard output to a socket from | |
461 | socket activation, semantics are | |
dd1eb43b LP |
462 | similar to the respective option of |
463 | <varname>StandardInput=</varname>. | |
de6c78f8 LP |
464 | This setting defaults to the value set |
465 | with | |
466 | <option>DefaultStandardOutput=</option> | |
467 | in | |
5f9cfd4c | 468 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
de6c78f8 | 469 | which defaults to |
706343f4 | 470 | <option>journal</option>.</para></listitem> |
dd1eb43b LP |
471 | </varlistentry> |
472 | <varlistentry> | |
ad678a06 | 473 | <term><varname>StandardError=</varname></term> |
dd1eb43b | 474 | <listitem><para>Controls where file |
b67f562c | 475 | descriptor 2 (STDERR) of the |
6db27428 ZJS |
476 | executed processes is connected to. |
477 | The available options are identical to | |
dd1eb43b | 478 | those of |
ad678a06 | 479 | <varname>StandardOutput=</varname>, |
5471472d | 480 | with one exception: if set to |
dd1eb43b LP |
481 | <option>inherit</option> the file |
482 | descriptor used for standard output is | |
483 | duplicated for standard error. This | |
de6c78f8 LP |
484 | setting defaults to the value set with |
485 | <option>DefaultStandardError=</option> | |
486 | in | |
5f9cfd4c | 487 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
de6c78f8 | 488 | which defaults to |
dd1eb43b LP |
489 | <option>inherit</option>.</para></listitem> |
490 | </varlistentry> | |
491 | <varlistentry> | |
492 | <term><varname>TTYPath=</varname></term> | |
493 | <listitem><para>Sets the terminal | |
6db27428 ZJS |
494 | device node to use if standard input, output, |
495 | or error are connected to a | |
dd1eb43b LP |
496 | TTY (see above). Defaults to |
497 | <filename>/dev/console</filename>.</para></listitem> | |
498 | </varlistentry> | |
6ea832a2 LP |
499 | <varlistentry> |
500 | <term><varname>TTYReset=</varname></term> | |
501 | <listitem><para>Reset the terminal | |
502 | device specified with | |
503 | <varname>TTYPath=</varname> before and | |
504 | after execution. Defaults to | |
505 | <literal>no</literal>.</para></listitem> | |
506 | </varlistentry> | |
507 | <varlistentry> | |
508 | <term><varname>TTYVHangup=</varname></term> | |
509 | <listitem><para>Disconnect all clients | |
510 | which have opened the terminal device | |
511 | specified with | |
512 | <varname>TTYPath=</varname> | |
513 | before and after execution. Defaults | |
514 | to | |
515 | <literal>no</literal>.</para></listitem> | |
516 | </varlistentry> | |
517 | <varlistentry> | |
518 | <term><varname>TTYVTDisallocate=</varname></term> | |
c5315881 | 519 | <listitem><para>If the terminal |
6ea832a2 LP |
520 | device specified with |
521 | <varname>TTYPath=</varname> is a | |
79640424 | 522 | virtual console terminal, try to |
6ea832a2 LP |
523 | deallocate the TTY before and after |
524 | execution. This ensures that the | |
525 | screen and scrollback buffer is | |
526 | cleared. Defaults to | |
527 | <literal>no</literal>.</para></listitem> | |
528 | </varlistentry> | |
dd1eb43b | 529 | <varlistentry> |
48c4fad9 | 530 | <term><varname>SyslogIdentifier=</varname></term> |
dd1eb43b LP |
531 | <listitem><para>Sets the process name |
532 | to prefix log lines sent to syslog or | |
79640424 | 533 | the kernel log buffer with. If not set, |
dd1eb43b LP |
534 | defaults to the process name of the |
535 | executed process. This option is only | |
536 | useful when | |
537 | <varname>StandardOutput=</varname> or | |
538 | <varname>StandardError=</varname> are | |
539 | set to <option>syslog</option> or | |
540 | <option>kmsg</option>.</para></listitem> | |
541 | </varlistentry> | |
542 | <varlistentry> | |
543 | <term><varname>SyslogFacility=</varname></term> | |
544 | <listitem><para>Sets the syslog | |
545 | facility to use when logging to | |
546 | syslog. One of <option>kern</option>, | |
547 | <option>user</option>, | |
548 | <option>mail</option>, | |
549 | <option>daemon</option>, | |
550 | <option>auth</option>, | |
551 | <option>syslog</option>, | |
552 | <option>lpr</option>, | |
553 | <option>news</option>, | |
554 | <option>uucp</option>, | |
555 | <option>cron</option>, | |
556 | <option>authpriv</option>, | |
557 | <option>ftp</option>, | |
558 | <option>local0</option>, | |
559 | <option>local1</option>, | |
560 | <option>local2</option>, | |
561 | <option>local3</option>, | |
562 | <option>local4</option>, | |
563 | <option>local5</option>, | |
564 | <option>local6</option> or | |
565 | <option>local7</option>. See | |
566 | <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
567 | for details. This option is only | |
568 | useful when | |
569 | <varname>StandardOutput=</varname> or | |
570 | <varname>StandardError=</varname> are | |
571 | set to <option>syslog</option>. | |
572 | Defaults to | |
573 | <option>daemon</option>.</para></listitem> | |
574 | </varlistentry> | |
575 | <varlistentry> | |
576 | <term><varname>SyslogLevel=</varname></term> | |
577 | <listitem><para>Default syslog level | |
578 | to use when logging to syslog or the | |
579 | kernel log buffer. One of | |
580 | <option>emerg</option>, | |
581 | <option>alert</option>, | |
582 | <option>crit</option>, | |
583 | <option>err</option>, | |
584 | <option>warning</option>, | |
585 | <option>notice</option>, | |
586 | <option>info</option>, | |
587 | <option>debug</option>. See | |
588 | <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> | |
589 | for details. This option is only | |
590 | useful when | |
591 | <varname>StandardOutput=</varname> or | |
592 | <varname>StandardError=</varname> are | |
593 | set to <option>syslog</option> or | |
594 | <option>kmsg</option>. Note that | |
595 | individual lines output by the daemon | |
596 | might be prefixed with a different log | |
597 | level which can be used to override | |
598 | the default log level specified | |
599 | here. The interpretation of these | |
600 | prefixes may be disabled with | |
74922904 | 601 | <varname>SyslogLevelPrefix=</varname>, |
dd1eb43b | 602 | see below. For details see |
cb07866b | 603 | <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
dd1eb43b LP |
604 | |
605 | Defaults to | |
606 | <option>info</option>.</para></listitem> | |
607 | </varlistentry> | |
608 | ||
609 | <varlistentry> | |
74922904 | 610 | <term><varname>SyslogLevelPrefix=</varname></term> |
dd1eb43b | 611 | <listitem><para>Takes a boolean |
74922904 | 612 | argument. If true and |
dd1eb43b LP |
613 | <varname>StandardOutput=</varname> or |
614 | <varname>StandardError=</varname> are | |
df688b23 LP |
615 | set to <option>syslog</option>, |
616 | <option>kmsg</option> or | |
617 | <option>journal</option>, log lines | |
dd1eb43b LP |
618 | written by the executed process that |
619 | are prefixed with a log level will be | |
620 | passed on to syslog with this log | |
621 | level set but the prefix removed. If | |
74922904 | 622 | set to false, the interpretation of |
dd1eb43b LP |
623 | these prefixes is disabled and the |
624 | logged lines are passed on as-is. For | |
625 | details about this prefixing see | |
cb07866b | 626 | <citerefentry><refentrytitle>sd-daemon</refentrytitle><manvolnum>3</manvolnum></citerefentry>. |
74922904 | 627 | Defaults to true.</para></listitem> |
dd1eb43b LP |
628 | </varlistentry> |
629 | ||
630 | <varlistentry> | |
03fae018 | 631 | <term><varname>TimerSlackNSec=</varname></term> |
dd1eb43b LP |
632 | <listitem><para>Sets the timer slack |
633 | in nanoseconds for the executed | |
d88a251b LP |
634 | processes. The timer slack controls |
635 | the accuracy of wake-ups triggered by | |
03fae018 | 636 | timers. See |
dd1eb43b | 637 | <citerefentry><refentrytitle>prctl</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
03fae018 LP |
638 | for more information. Note that in |
639 | contrast to most other time span | |
f8553ccb | 640 | definitions this parameter takes an |
d88a251b LP |
641 | integer value in nano-seconds if no |
642 | unit is specified. The usual time | |
643 | units are understood | |
644 | too.</para></listitem> | |
dd1eb43b LP |
645 | </varlistentry> |
646 | ||
647 | <varlistentry> | |
648 | <term><varname>LimitCPU=</varname></term> | |
649 | <term><varname>LimitFSIZE=</varname></term> | |
650 | <term><varname>LimitDATA=</varname></term> | |
651 | <term><varname>LimitSTACK=</varname></term> | |
652 | <term><varname>LimitCORE=</varname></term> | |
653 | <term><varname>LimitRSS=</varname></term> | |
654 | <term><varname>LimitNOFILE=</varname></term> | |
655 | <term><varname>LimitAS=</varname></term> | |
656 | <term><varname>LimitNPROC=</varname></term> | |
657 | <term><varname>LimitMEMLOCK=</varname></term> | |
658 | <term><varname>LimitLOCKS=</varname></term> | |
659 | <term><varname>LimitSIGPENDING=</varname></term> | |
660 | <term><varname>LimitMSGQUEUE=</varname></term> | |
661 | <term><varname>LimitNICE=</varname></term> | |
662 | <term><varname>LimitRTPRIO=</varname></term> | |
663 | <term><varname>LimitRTTIME=</varname></term> | |
664 | <listitem><para>These settings control | |
665 | various resource limits for executed | |
666 | processes. See | |
667 | <citerefentry><refentrytitle>setrlimit</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
3d57c6ab LP |
668 | for details. Use the string |
669 | <varname>infinity</varname> to | |
670 | configure no limit on a specific | |
671 | resource.</para></listitem> | |
dd1eb43b LP |
672 | </varlistentry> |
673 | ||
674 | <varlistentry> | |
675 | <term><varname>PAMName=</varname></term> | |
676 | <listitem><para>Sets the PAM service | |
79640424 | 677 | name to set up a session as. If set, |
dd1eb43b LP |
678 | the executed process will be |
679 | registered as a PAM session under the | |
680 | specified service name. This is only | |
681 | useful in conjunction with the | |
682 | <varname>User=</varname> setting. If | |
79640424 | 683 | not set, no PAM session will be opened |
dd1eb43b LP |
684 | for the executed processes. See |
685 | <citerefentry><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
686 | for details.</para></listitem> | |
687 | </varlistentry> | |
688 | ||
689 | <varlistentry> | |
690 | <term><varname>TCPWrapName=</varname></term> | |
691 | <listitem><para>If this is a | |
79640424 | 692 | socket-activated service, this sets the |
dd1eb43b LP |
693 | tcpwrap service name to check the |
694 | permission for the current connection | |
695 | with. This is only useful in | |
696 | conjunction with socket-activated | |
697 | services, and stream sockets (TCP) in | |
698 | particular. It has no effect on other | |
9f056f40 LP |
699 | socket types (e.g. datagram/UDP) and |
700 | on processes unrelated to socket-based | |
dd1eb43b | 701 | activation. If the tcpwrap |
79640424 | 702 | verification fails, daemon start-up |
dd1eb43b LP |
703 | will fail and the connection is |
704 | terminated. See | |
705 | <citerefentry><refentrytitle>tcpd</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
9f056f40 LP |
706 | for details. Note that this option may |
707 | be used to do access control checks | |
708 | only. Shell commands and commands | |
709 | described in | |
710 | <citerefentry><refentrytitle>hosts_options</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
711 | are not supported.</para></listitem> | |
dd1eb43b LP |
712 | </varlistentry> |
713 | ||
714 | <varlistentry> | |
260abb78 LP |
715 | <term><varname>CapabilityBoundingSet=</varname></term> |
716 | ||
717 | <listitem><para>Controls which | |
718 | capabilities to include in the | |
719 | capability bounding set for the | |
720 | executed process. See | |
dd1eb43b | 721 | <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
e9dd9f95 JSJ |
722 | for details. Takes a whitespace-separated |
723 | list of capability names as read by | |
d91c34f2 | 724 | <citerefentry><refentrytitle>cap_from_name</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
74d00578 ZJS |
725 | e.g. <constant>CAP_SYS_ADMIN</constant>, |
726 | <constant>CAP_DAC_OVERRIDE</constant>, | |
727 | <constant>CAP_SYS_PTRACE</constant>. | |
260abb78 LP |
728 | Capabilities listed will be included |
729 | in the bounding set, all others are | |
730 | removed. If the list of capabilities | |
79640424 | 731 | is prefixed with <literal>~</literal>, |
d91c34f2 LP |
732 | all but the listed capabilities will |
733 | be included, the effect of the | |
734 | assignment inverted. Note that this | |
735 | option also affects the respective | |
736 | capabilities in the effective, | |
737 | permitted and inheritable capability | |
738 | sets, on top of what | |
739 | <varname>Capabilities=</varname> | |
79640424 | 740 | does. If this option is not used, the |
260abb78 LP |
741 | capability bounding set is not |
742 | modified on process execution, hence | |
743 | no limits on the capabilities of the | |
74051b9b LP |
744 | process are enforced. This option may |
745 | appear more than once in which case | |
d91c34f2 LP |
746 | the bounding sets are merged. If the |
747 | empty string is assigned to this | |
79640424 | 748 | option, the bounding set is reset to |
d91c34f2 LP |
749 | the empty capability set, and all |
750 | prior settings have no effect. If set | |
751 | to <literal>~</literal> (without any | |
79640424 | 752 | further argument), the bounding set is |
d91c34f2 LP |
753 | reset to the full set of available |
754 | capabilities, also undoing any | |
755 | previous settings.</para></listitem> | |
dd1eb43b LP |
756 | </varlistentry> |
757 | ||
758 | <varlistentry> | |
759 | <term><varname>SecureBits=</varname></term> | |
760 | <listitem><para>Controls the secure | |
761 | bits set for the executed process. See | |
762 | <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> | |
763 | for details. Takes a list of strings: | |
764 | <option>keep-caps</option>, | |
765 | <option>keep-caps-locked</option>, | |
766 | <option>no-setuid-fixup</option>, | |
767 | <option>no-setuid-fixup-locked</option>, | |
3377af3e | 768 | <option>noroot</option> and/or |
74051b9b LP |
769 | <option>noroot-locked</option>. This |
770 | option may appear more than once in | |
771 | which case the secure bits are | |
772 | ORed. If the empty string is assigned | |
79640424 | 773 | to this option, the bits are reset to |
74051b9b | 774 | 0.</para></listitem> |
dd1eb43b LP |
775 | </varlistentry> |
776 | ||
777 | <varlistentry> | |
260abb78 | 778 | <term><varname>Capabilities=</varname></term> |
dd1eb43b | 779 | <listitem><para>Controls the |
dd1eb43b | 780 | <citerefentry><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
260abb78 LP |
781 | set for the executed process. Take a |
782 | capability string describing the | |
783 | effective, permitted and inherited | |
784 | capability sets as documented in | |
785 | <citerefentry><refentrytitle>cap_from_text</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
786 | Note that these capability sets are | |
787 | usually influenced by the capabilities | |
788 | attached to the executed file. Due to | |
789 | that | |
790 | <varname>CapabilityBoundingSet=</varname> | |
791 | is probably the much more useful | |
792 | setting.</para></listitem> | |
dd1eb43b LP |
793 | </varlistentry> |
794 | ||
dd1eb43b LP |
795 | <varlistentry> |
796 | <term><varname>ReadWriteDirectories=</varname></term> | |
797 | <term><varname>ReadOnlyDirectories=</varname></term> | |
798 | <term><varname>InaccessibleDirectories=</varname></term> | |
799 | ||
800 | <listitem><para>Sets up a new | |
12f25b6e | 801 | file system namespace for executed |
dd1eb43b LP |
802 | processes. These options may be used |
803 | to limit access a process might have | |
12f25b6e | 804 | to the main file system |
dd1eb43b | 805 | hierarchy. Each setting takes a |
96d4ce01 | 806 | space-separated list of absolute |
dd1eb43b LP |
807 | directory paths. Directories listed in |
808 | <varname>ReadWriteDirectories=</varname> | |
809 | are accessible from within the | |
810 | namespace with the same access rights | |
811 | as from outside. Directories listed in | |
812 | <varname>ReadOnlyDirectories=</varname> | |
813 | are accessible for reading only, | |
814 | writing will be refused even if the | |
815 | usual file access controls would | |
816 | permit this. Directories listed in | |
817 | <varname>InaccessibleDirectories=</varname> | |
74051b9b LP |
818 | will be made inaccessible for |
819 | processes inside the namespace. Note | |
820 | that restricting access with these | |
821 | options does not extend to submounts | |
822 | of a directory. You must list | |
823 | submounts separately in these settings | |
824 | to ensure the same limited | |
825 | access. These options may be specified | |
826 | more than once in which case all | |
827 | directories listed will have limited | |
828 | access from within the namespace. If | |
829 | the empty string is assigned to this | |
79640424 | 830 | option, the specific list is reset, and |
74051b9b | 831 | all prior assignments have no |
ea92ae33 MW |
832 | effect.</para> |
833 | <para>Paths in | |
834 | <varname>ReadOnlyDirectories=</varname> | |
835 | and | |
836 | <varname>InaccessibleDirectories=</varname> | |
837 | may be prefixed with | |
838 | <literal>-</literal>, in which case | |
6b4991cf | 839 | they will be ignored when they do not |
907afa06 LP |
840 | exist. Note that using this |
841 | setting will disconnect propagation of | |
842 | mounts from the service to the host | |
843 | (propagation in the opposite direction | |
844 | continues to work). This means that | |
845 | this setting may not be used for | |
846 | services which shall be able to | |
847 | install mount points in the main mount | |
848 | namespace.</para></listitem> | |
dd1eb43b LP |
849 | </varlistentry> |
850 | ||
851 | <varlistentry> | |
852 | <term><varname>PrivateTmp=</varname></term> | |
853 | ||
854 | <listitem><para>Takes a boolean | |
79640424 | 855 | argument. If true, sets up a new file |
ff01d048 | 856 | system namespace for the executed |
652d0dd7 ZJS |
857 | processes and mounts private |
858 | <filename>/tmp</filename> and | |
613b411c | 859 | <filename>/var/tmp</filename> |
e0e009c0 | 860 | directories inside it that is not |
613b411c | 861 | shared by processes outside of the |
dd1eb43b LP |
862 | namespace. This is useful to secure |
863 | access to temporary files of the | |
864 | process, but makes sharing between | |
865 | processes via | |
652d0dd7 ZJS |
866 | <filename>/tmp</filename> or |
867 | <filename>/var/tmp</filename> | |
907afa06 LP |
868 | impossible. If this is enabled all |
869 | temporary files created by a service | |
870 | in these directories will be removed | |
871 | after the service is stopped. Defaults | |
872 | to false. It is possible to run two or | |
873 | more units within the same private | |
874 | <filename>/tmp</filename> and | |
613b411c LP |
875 | <filename>/var/tmp</filename> |
876 | namespace by using the | |
877 | <varname>JoinsNamespaceOf=</varname> | |
878 | directive, see | |
879 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
907afa06 LP |
880 | for details. Note that using this |
881 | setting will disconnect propagation of | |
882 | mounts from the service to the host | |
883 | (propagation in the opposite direction | |
884 | continues to work). This means that | |
885 | this setting may not be used for | |
886 | services which shall be able to install | |
887 | mount points in the main mount | |
888 | namespace.</para></listitem> | |
889 | </varlistentry> | |
890 | ||
891 | <varlistentry> | |
892 | <term><varname>PrivateDevices=</varname></term> | |
893 | ||
894 | <listitem><para>Takes a boolean | |
895 | argument. If true, sets up a new /dev | |
896 | namespace for the executed processes | |
897 | and only adds API pseudo devices such | |
898 | as <filename>/dev/null</filename>, | |
899 | <filename>/dev/zero</filename> or | |
900 | <filename>/dev/random</filename> (as | |
901 | well as the pseudo TTY subsystem) to | |
902 | it, but no physical devices such as | |
903 | <filename>/dev/sda</filename>. This is | |
904 | useful to securely turn off physical | |
905 | device access by the executed | |
906 | process. Defaults to false. Enabling | |
907 | this option will also remove | |
908 | <constant>CAP_MKNOD</constant> from | |
909 | the capability bounding set for the | |
910 | unit (see above), and set | |
911 | <varname>DevicePolicy=closed</varname> | |
912 | (see | |
913 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
914 | for details). Note that using this | |
915 | setting will disconnect propagation of | |
916 | mounts from the service to the host | |
917 | (propagation in the opposite direction | |
918 | continues to work). This means that | |
919 | this setting may not be used for | |
920 | services which shall be able to | |
921 | install mount points in the main mount | |
922 | namespace.</para></listitem> | |
ff01d048 LP |
923 | </varlistentry> |
924 | ||
925 | <varlistentry> | |
926 | <term><varname>PrivateNetwork=</varname></term> | |
927 | ||
928 | <listitem><para>Takes a boolean | |
79640424 | 929 | argument. If true, sets up a new |
ff01d048 LP |
930 | network namespace for the executed |
931 | processes and configures only the | |
932 | loopback network device | |
933 | <literal>lo</literal> inside it. No | |
934 | other network devices will be | |
935 | available to the executed process. | |
936 | This is useful to securely turn off | |
937 | network access by the executed | |
907afa06 LP |
938 | process. Defaults to false. It is |
939 | possible to run two or more units | |
940 | within the same private network | |
613b411c LP |
941 | namespace by using the |
942 | <varname>JoinsNamespaceOf=</varname> | |
943 | directive, see | |
944 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
907afa06 LP |
945 | for details. Note that this option |
946 | will disconnect all socket families | |
947 | from the host, this includes | |
948 | AF_NETLINK and AF_UNIX. The latter has | |
949 | the effect that AF_UNIX sockets in the | |
950 | abstract socket namespace will become | |
951 | unavailable to the processes (however, | |
952 | those located in the file system will | |
953 | continue to be | |
954 | accessible).</para></listitem> | |
7f112f50 LP |
955 | </varlistentry> |
956 | ||
dd1eb43b LP |
957 | <varlistentry> |
958 | <term><varname>MountFlags=</varname></term> | |
959 | ||
960 | <listitem><para>Takes a mount | |
961 | propagation flag: | |
962 | <option>shared</option>, | |
963 | <option>slave</option> or | |
964 | <option>private</option>, which | |
ac0930c8 LP |
965 | control whether the file system |
966 | namespace set up for this unit's | |
967 | processes will receive or propagate | |
968 | new mounts. See | |
8050c221 | 969 | <citerefentry><refentrytitle>mount</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
ac0930c8 LP |
970 | for details. Default to |
971 | <option>shared</option>.</para></listitem> | |
dd1eb43b LP |
972 | </varlistentry> |
973 | ||
169c1bda LP |
974 | <varlistentry> |
975 | <term><varname>UtmpIdentifier=</varname></term> | |
976 | ||
c5315881 | 977 | <listitem><para>Takes a four |
169c1bda LP |
978 | character identifier string for an |
979 | utmp/wtmp entry for this service. This | |
980 | should only be set for services such | |
981 | as <command>getty</command> | |
982 | implementations where utmp/wtmp | |
983 | entries must be created and cleared | |
984 | before and after execution. If the | |
985 | configured string is longer than four | |
79640424 | 986 | characters, it is truncated and the |
169c1bda LP |
987 | terminal four characters are |
988 | used. This setting interprets %I style | |
989 | string replacements. This setting is | |
990 | unset by default, i.e. no utmp/wtmp | |
991 | entries are created or cleaned up for | |
992 | this service.</para></listitem> | |
993 | </varlistentry> | |
994 | ||
7b52a628 MS |
995 | <varlistentry> |
996 | <term><varname>SELinuxContext=</varname></term> | |
997 | ||
82adf6af LP |
998 | <listitem><para>Set the SELinux |
999 | security context of the executed | |
1000 | process. If set, this will override | |
1001 | the automated domain | |
1002 | transition. However, the policy still | |
1003 | needs to autorize the transition. This | |
1004 | directive is ignored if SELinux is | |
1005 | disabled. If prefixed by | |
1006 | <literal>-</literal>, all errors will | |
1007 | be ignored. See | |
7b52a628 MS |
1008 | <citerefentry><refentrytitle>setexeccon</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
1009 | for details.</para></listitem> | |
1010 | </varlistentry> | |
1011 | ||
eef65bf3 MS |
1012 | <varlistentry> |
1013 | <term><varname>AppArmorProfile=</varname></term> | |
1014 | ||
1015 | <listitem><para>Take a profile name as argument. | |
1016 | The process executed by the unit will switch to | |
1017 | this profile when started. Profiles must already | |
1018 | be loaded in the kernel, or the unit will fail. | |
1019 | This result in a non operation if AppArmor is not | |
1020 | enabled. If prefixed by <literal>-</literal>, all errors | |
1021 | will be ignored. | |
1022 | </para></listitem> | |
1023 | </varlistentry> | |
1024 | ||
353e12c2 LP |
1025 | <varlistentry> |
1026 | <term><varname>IgnoreSIGPIPE=</varname></term> | |
1027 | ||
1028 | <listitem><para>Takes a boolean | |
05cc7267 | 1029 | argument. If true, causes <constant>SIGPIPE</constant> to be |
353e12c2 | 1030 | ignored in the executed |
e9dd9f95 | 1031 | process. Defaults to true because |
05cc7267 | 1032 | <constant>SIGPIPE</constant> generally is useful only in |
353e12c2 LP |
1033 | shell pipelines.</para></listitem> |
1034 | </varlistentry> | |
1035 | ||
8351ceae LP |
1036 | <varlistentry> |
1037 | <term><varname>NoNewPrivileges=</varname></term> | |
1038 | ||
1039 | <listitem><para>Takes a boolean | |
e9dd9f95 | 1040 | argument. If true, ensures that the |
8351ceae LP |
1041 | service process and all its children |
1042 | can never gain new privileges. This | |
1043 | option is more powerful than the respective | |
1044 | secure bits flags (see above), as it | |
1045 | also prohibits UID changes of any | |
1046 | kind. This is the simplest, most | |
1047 | effective way to ensure that a process | |
1048 | and its children can never elevate | |
1049 | privileges again.</para></listitem> | |
1050 | </varlistentry> | |
1051 | ||
1052 | <varlistentry> | |
1053 | <term><varname>SystemCallFilter=</varname></term> | |
1054 | ||
f513e420 LP |
1055 | <listitem><para>Takes a |
1056 | space-separated list of system call | |
e9dd9f95 | 1057 | names. If this setting is used, all |
8351ceae | 1058 | system calls executed by the unit |
17df7223 | 1059 | processes except for the listed ones |
8351ceae | 1060 | will result in immediate process |
74d00578 ZJS |
1061 | termination with the |
1062 | <constant>SIGSYS</constant> signal | |
8351ceae | 1063 | (whitelisting). If the first character |
79640424 | 1064 | of the list is <literal>~</literal>, |
8351ceae LP |
1065 | the effect is inverted: only the |
1066 | listed system calls will result in | |
1067 | immediate process termination | |
f513e420 LP |
1068 | (blacklisting). If running in user |
1069 | mode and this option is used, | |
8351ceae | 1070 | <varname>NoNewPrivileges=yes</varname> |
f513e420 LP |
1071 | is implied. This feature makes use of the |
1072 | Secure Computing Mode 2 interfaces of | |
1073 | the kernel ('seccomp filtering') and | |
1074 | is useful for enforcing a minimal | |
8351ceae LP |
1075 | sandboxing environment. Note that the |
1076 | <function>execve</function>, | |
1077 | <function>rt_sigreturn</function>, | |
1078 | <function>sigreturn</function>, | |
1079 | <function>exit_group</function>, | |
1080 | <function>exit</function> system calls | |
6b4991cf | 1081 | are implicitly whitelisted and do not |
74051b9b LP |
1082 | need to be listed explicitly. This |
1083 | option may be specified more than once | |
1084 | in which case the filter masks are | |
1085 | merged. If the empty string is | |
79640424 | 1086 | assigned, the filter is reset, all |
74051b9b | 1087 | prior assignments will have no |
c0467cf3 RC |
1088 | effect.</para> |
1089 | ||
17df7223 LP |
1090 | <para>If you specify both types of |
1091 | this option (i.e. whitelisting and | |
73e231ab | 1092 | blacklisting), the first encountered |
17df7223 LP |
1093 | will take precedence and will dictate |
1094 | the default action (termination or | |
1095 | approval of a system call). Then the | |
1096 | next occurrences of this option will | |
1097 | add or delete the listed system calls | |
1098 | from the set of the filtered system | |
1099 | calls, depending of its type and the | |
66f756d4 | 1100 | default action. (For example, if you have started |
17df7223 LP |
1101 | with a whitelisting of |
1102 | <function>read</function> and | |
73e231ab | 1103 | <function>write</function>, and right |
17df7223 LP |
1104 | after it add a blacklisting of |
1105 | <function>write</function>, then | |
1106 | <function>write</function> will be | |
66f756d4 | 1107 | removed from the set.) |
c0467cf3 | 1108 | </para></listitem> |
8351ceae LP |
1109 | </varlistentry> |
1110 | ||
17df7223 LP |
1111 | <varlistentry> |
1112 | <term><varname>SystemCallErrorNumber=</varname></term> | |
1113 | ||
1114 | <listitem><para>Takes an | |
1115 | <literal>errno</literal> error number | |
1116 | name to return when the system call | |
1117 | filter configured with | |
1118 | <varname>SystemCallFilter=</varname> | |
1119 | is triggered, instead of terminating | |
1120 | the process immediately. Takes an | |
1121 | error name such as | |
ac45f971 LP |
1122 | <constant>EPERM</constant>, |
1123 | <constant>EACCES</constant> or | |
1124 | <constant>EUCLEAN</constant>. When this | |
17df7223 | 1125 | setting is not used, or when the empty |
73e231ab | 1126 | string is assigned, the process will be |
17df7223 LP |
1127 | terminated immediately when the filter |
1128 | is triggered.</para></listitem> | |
1129 | </varlistentry> | |
1130 | ||
57183d11 LP |
1131 | <varlistentry> |
1132 | <term><varname>SystemCallArchitectures=</varname></term> | |
1133 | ||
1134 | <listitem><para>Takes a space | |
1135 | separated list of architecture | |
1136 | identifiers to include in the system | |
1137 | call filter. The known architecture | |
1138 | identifiers are | |
ac45f971 LP |
1139 | <constant>x86</constant>, |
1140 | <constant>x86-64</constant>, | |
1141 | <constant>x32</constant>, | |
f513e420 LP |
1142 | <constant>arm</constant> as well as |
1143 | the special identifier | |
1144 | <constant>native</constant>. Only | |
1145 | system calls of the specified | |
1146 | architectures will be permitted to | |
1147 | processes of this unit. This is an | |
1148 | effective way to disable compatibility | |
1149 | with non-native architectures for | |
1150 | processes, for example to prohibit | |
1151 | execution of 32-bit x86 binaries on | |
1152 | 64-bit x86-64 systems. The special | |
ac45f971 | 1153 | <constant>native</constant> identifier |
57183d11 LP |
1154 | implicitly maps to the native |
1155 | architecture of the system (or more | |
1156 | strictly: to the architecture the | |
f513e420 LP |
1157 | system manager is compiled for). If |
1158 | running in user mode and this option | |
1159 | is used, | |
1160 | <varname>NoNewPrivileges=yes</varname> | |
1161 | is implied. Note that setting this | |
1162 | option to a non-empty list implies | |
1163 | that <constant>native</constant> is | |
1164 | included too. By default, this option | |
1165 | is set to the empty list, i.e. no | |
1166 | architecture system call filtering is | |
e9642be2 | 1167 | applied.</para></listitem> |
57183d11 LP |
1168 | </varlistentry> |
1169 | ||
4298d0b5 LP |
1170 | <varlistentry> |
1171 | <term><varname>RestrictAddressFamilies=</varname></term> | |
1172 | ||
1173 | <listitem><para>Restricts the set of | |
1174 | socket address families accessible to | |
1175 | the processes of this unit. Takes a | |
1176 | space-separated list of address family | |
1177 | names to whitelist, such as | |
1178 | <constant>AF_UNIX</constant>, | |
1179 | <constant>AF_INET</constant> or | |
1180 | <constant>AF_INET6</constant>. When | |
1181 | prefixed with <constant>~</constant> | |
1182 | the listed address families will be | |
1183 | applied as blacklist, otherwise as | |
1184 | whitelist. Note that this restricts | |
1185 | access to the | |
1186 | <citerefentry><refentrytitle>socket</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
1187 | system call only. Sockets passed into | |
1188 | the process by other means (for | |
1189 | example, by using socket activation | |
1190 | with socket units, see | |
1191 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>) | |
1192 | are unaffected. Also, sockets created | |
1193 | with <function>socketpair()</function> | |
1194 | (which creates connected AF_UNIX | |
1195 | sockets only) are unaffected. Note | |
1196 | that this option has no effect on | |
1197 | 32bit x86 and is ignored (but works | |
f513e420 LP |
1198 | correctly on x86-64). If running in user |
1199 | mode and this option is used, | |
1200 | <varname>NoNewPrivileges=yes</varname> | |
1201 | is implied. By default no | |
4298d0b5 LP |
1202 | restriction applies, all address |
1203 | families are accessible to | |
1204 | processes. If assigned the empty | |
1205 | string any previous list changes are | |
1206 | undone.</para> | |
1207 | ||
1208 | <para>Use this option to limit | |
1209 | exposure of processes to remote | |
1210 | systems, in particular via exotic | |
1211 | network protocols. Note that in most | |
1212 | cases the local | |
1213 | <constant>AF_UNIX</constant> address | |
1214 | family should be included in the | |
1215 | configured whitelist as it is | |
1216 | frequently used for local | |
1217 | communication, including for | |
1218 | <citerefentry><refentrytitle>syslog</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
1219 | logging.</para></listitem> | |
1220 | </varlistentry> | |
1221 | ||
ac45f971 LP |
1222 | <varlistentry> |
1223 | <term><varname>Personality=</varname></term> | |
1224 | ||
1225 | <listitem><para>Controls which | |
1226 | kernel architecture | |
1227 | <citerefentry><refentrytitle>uname</refentrytitle><manvolnum>2</manvolnum></citerefentry> | |
1228 | shall report, when invoked by unit | |
1229 | processes. Takes one of | |
1230 | <constant>x86</constant> and | |
1231 | <constant>x86-64</constant>. This is | |
1232 | useful when running 32bit services on | |
1233 | a 64bit host system. If not specified | |
1234 | the personality is left unmodified and | |
1235 | thus reflects the personality of the | |
1236 | host system's | |
1237 | kernel.</para></listitem> | |
1238 | </varlistentry> | |
4298d0b5 | 1239 | |
e66cf1a3 LP |
1240 | <varlistentry> |
1241 | <term><varname>RuntimeDirectory=</varname></term> | |
1242 | <term><varname>RuntimeDirectoryMode=</varname></term> | |
1243 | ||
1244 | <listitem><para>Takes a list of | |
1245 | directory names. If set one or more | |
1246 | directories by the specified names | |
1247 | will be created below | |
1248 | <filename>/run</filename> (for system | |
1249 | services) or below | |
1250 | <varname>$XDG_RUNTIME_DIR</varname> | |
1251 | (for user services) when the unit is | |
1252 | started and removed when the unit is | |
1253 | stopped. The directories will have the | |
1254 | access mode specified in | |
1255 | <varname>RuntimeDirectoryMode=</varname>, | |
1256 | and will be owned by the user and | |
1257 | group specified in | |
1258 | <varname>User=</varname> and | |
1259 | <varname>Group=</varname>. Use this to | |
1260 | manage one or more runtime directories | |
1261 | of the unit and bind their lifetime to | |
1262 | the daemon runtime. The specified | |
1263 | directory names must be relative, and | |
1264 | may not include a | |
1265 | <literal>/</literal>, i.e. must refer | |
1266 | to simple directories to create or | |
1267 | remove. This is particularly useful | |
1268 | for unpriviliges daemons that cannot | |
1269 | create runtime directories in | |
1270 | <filename>/run</filename> due to lack | |
1271 | of privileges, and to make sure the | |
1272 | runtime directory is cleaned up | |
1273 | automatically after use. For runtime | |
1274 | directories that require more complex | |
1275 | or different configuration or lifetime | |
1276 | guarantees, please consider using | |
1277 | <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>.</para></listitem> | |
1278 | </varlistentry> | |
1279 | ||
dd1eb43b LP |
1280 | </variablelist> |
1281 | </refsect1> | |
1282 | ||
43638332 ZJS |
1283 | <refsect1> |
1284 | <title>Environment variables in spawned processes</title> | |
1285 | ||
1286 | <para>Processes started by the system are executed in | |
1287 | a clean environment in which select variables | |
1288 | listed below are set. System processes started by systemd | |
1289 | do not inherit variables from PID 1, but processes | |
1290 | started by user systemd instances inherit all | |
1291 | environment variables from the user systemd instance. | |
1292 | </para> | |
1293 | ||
1294 | <variablelist class='environment-variables'> | |
1295 | <varlistentry> | |
1296 | <term><varname>$PATH</varname></term> | |
1297 | ||
1298 | <listitem><para>Colon-separated list | |
1299 | of directiories to use when launching | |
1300 | executables. Systemd uses a fixed | |
1301 | value of | |
1302 | <filename>/usr/local/sbin</filename>:<filename>/usr/local/bin</filename>:<filename>/usr/sbin</filename>:<filename>/usr/bin</filename>:<filename>/sbin</filename>:<filename>/bin</filename>. | |
1303 | </para></listitem> | |
1304 | </varlistentry> | |
1305 | ||
1306 | <varlistentry> | |
1307 | <term><varname>$LANG</varname></term> | |
1308 | ||
1309 | <listitem><para>Locale. Can be set in | |
1310 | <citerefentry><refentrytitle>locale.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry> | |
1311 | or on the kernel command line (see | |
1312 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry> | |
1313 | and | |
1314 | <citerefentry><refentrytitle>kernel-command-line</refentrytitle><manvolnum>7</manvolnum></citerefentry>). | |
1315 | </para></listitem> | |
1316 | </varlistentry> | |
1317 | ||
1318 | <varlistentry> | |
1319 | <term><varname>$USER</varname></term> | |
59fccd82 | 1320 | <term><varname>$LOGNAME</varname></term> |
43638332 | 1321 | <term><varname>$HOME</varname></term> |
59fccd82 | 1322 | <term><varname>$SHELL</varname></term> |
43638332 | 1323 | |
59fccd82 ZJS |
1324 | <listitem><para>User name (twice), home |
1325 | directory, and the login shell. | |
72f4d966 | 1326 | The variables are set for the units that |
43638332 ZJS |
1327 | have <varname>User=</varname> set, |
1328 | which includes user | |
1329 | <command>systemd</command> instances. | |
1330 | See | |
1331 | <citerefentry><refentrytitle>passwd</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
1332 | </para></listitem> | |
1333 | </varlistentry> | |
1334 | ||
1335 | <varlistentry> | |
1336 | <term><varname>$XDG_RUNTIME_DIR</varname></term> | |
1337 | ||
1338 | <listitem><para>The directory for volatile | |
1339 | state. Set for the user <command>systemd</command> | |
1340 | instance, and also in user sessions. | |
1341 | See | |
1342 | <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>. | |
1343 | </para></listitem> | |
1344 | </varlistentry> | |
1345 | ||
1346 | <varlistentry> | |
1347 | <term><varname>$XDG_SESSION_ID</varname></term> | |
1348 | <term><varname>$XDG_SEAT</varname></term> | |
1349 | <term><varname>$XDG_VTNR</varname></term> | |
1350 | ||
1351 | <listitem><para>The identifier of the | |
72f4d966 | 1352 | session, the seat name, and |
43638332 ZJS |
1353 | virtual terminal of the session. Set |
1354 | by | |
1355 | <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry> | |
1356 | for login sessions. | |
1357 | <varname>$XDG_SEAT</varname> and | |
72f4d966 JE |
1358 | <varname>$XDG_VTNR</varname> will |
1359 | only be set when attached to a seat and a | |
43638332 ZJS |
1360 | tty.</para></listitem> |
1361 | </varlistentry> | |
1362 | ||
b67f562c LP |
1363 | <varlistentry> |
1364 | <term><varname>$MAINPID</varname></term> | |
1365 | ||
1366 | <listitem><para>The PID of the units | |
1367 | main process if it is known. This is | |
1368 | only set for control processes as | |
1369 | invoked by | |
1370 | <varname>ExecReload=</varname> and | |
1371 | similar. </para></listitem> | |
1372 | </varlistentry> | |
1373 | ||
43638332 ZJS |
1374 | <varlistentry> |
1375 | <term><varname>$MANAGERPID</varname></term> | |
1376 | ||
1377 | <listitem><para>The PID of the user | |
1378 | <command>systemd</command> instance, | |
1379 | set for processes spawned by it. | |
1380 | </para></listitem> | |
1381 | </varlistentry> | |
1382 | ||
1383 | <varlistentry> | |
1384 | <term><varname>$LISTEN_FDS</varname></term> | |
1385 | <term><varname>$LISTEN_PID</varname></term> | |
1386 | ||
1387 | <listitem><para>Information about file | |
1388 | descriptors passed to a service for | |
1389 | socket activation. See | |
1390 | <citerefentry><refentrytitle>sd_listen_fds</refentrytitle><manvolnum>3</manvolnum></citerefentry>. | |
1391 | </para></listitem> | |
1392 | </varlistentry> | |
59fccd82 ZJS |
1393 | |
1394 | <varlistentry> | |
1395 | <term><varname>$TERM</varname></term> | |
1396 | ||
1397 | <listitem><para>Terminal type, set | |
1398 | only for units connected to a terminal | |
1399 | (<varname>StandardInput=tty</varname>, | |
1400 | <varname>StandardOutput=tty</varname>, | |
1401 | or | |
1402 | <varname>StandardError=tty</varname>). | |
1403 | See | |
1404 | <citerefentry><refentrytitle>termcap</refentrytitle><manvolnum>5</manvolnum></citerefentry>. | |
1405 | </para></listitem> | |
1406 | </varlistentry> | |
43638332 ZJS |
1407 | </variablelist> |
1408 | ||
1409 | <para>Additional variables may be configured by the | |
1410 | following means: for processes spawned in specific | |
1411 | units, use the <varname>Environment=</varname> and | |
1412 | <varname>EnvironmentFile=</varname> options above; to | |
1413 | specify variables globally, use | |
1414 | <varname>DefaultEnvironment=</varname> (see | |
1415 | <citerefentry><refentrytitle>systemd-system.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>) | |
1416 | or the kernel option | |
1417 | <varname>systemd.setenv=</varname> (see | |
1418 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>). Additional | |
1419 | variables may also be set through PAM, | |
1420 | c.f. <citerefentry><refentrytitle>pam_env</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> | |
1421 | </refsect1> | |
1422 | ||
dd1eb43b LP |
1423 | <refsect1> |
1424 | <title>See Also</title> | |
1425 | <para> | |
f3e219a2 | 1426 | <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
dd1eb43b | 1427 | <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
169c4f65 | 1428 | <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
dd1eb43b LP |
1429 | <citerefentry><refentrytitle>systemd.unit</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
1430 | <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
1431 | <citerefentry><refentrytitle>systemd.socket</refentrytitle><manvolnum>5</manvolnum></citerefentry>, | |
2292707d | 1432 | <citerefentry><refentrytitle>systemd.swap</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
4819ff03 | 1433 | <citerefentry><refentrytitle>systemd.mount</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
9cc2c8b7 | 1434 | <citerefentry><refentrytitle>systemd.kill</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
3fde5f30 | 1435 | <citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
43638332 | 1436 | <citerefentry><refentrytitle>systemd.directives</refentrytitle><manvolnum>7</manvolnum></citerefentry>, |
e66cf1a3 | 1437 | <citerefentry><refentrytitle>tmpfiles.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>, |
43638332 | 1438 | <citerefentry><refentrytitle>exec</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
dd1eb43b LP |
1439 | </para> |
1440 | </refsect1> | |
1441 | ||
1442 | </refentry> |