| 1 |
<?xml version="1.0"?> |
| 2 |
<!DOCTYPE refsect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" |
| 3 |
"http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd"> |
| 4 |
<!-- SPDX-License-Identifier: LGPL-2.1-or-later --> |
| 5 |
|
| 6 |
<refsect1> |
| 7 |
<title>Environment</title> |
| 8 |
|
| 9 |
<variablelist class='environment-variables'> |
| 10 |
<varlistentry id='log-level'> |
| 11 |
<term><varname>$SYSTEMD_LOG_LEVEL</varname></term> |
| 12 |
|
| 13 |
<listitem><para id='log-level-body'>The maximum log level of emitted messages (messages with a higher |
| 14 |
log level, i.e. less important ones, will be suppressed). Takes a comma-separated list of values. A |
| 15 |
value may be either one of (in order of decreasing importance) <constant>emerg</constant>, |
| 16 |
<constant>alert</constant>, <constant>crit</constant>, <constant>err</constant>, |
| 17 |
<constant>warning</constant>, <constant>notice</constant>, <constant>info</constant>, |
| 18 |
<constant>debug</constant>, or an integer in the range 0…7. See |
| 19 |
<citerefentry project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
| 20 |
for more information. Each value may optionally be prefixed with one of <constant>console</constant>, |
| 21 |
<constant>syslog</constant>, <constant>kmsg</constant> or <constant>journal</constant> followed by a |
| 22 |
colon to set the maximum log level for that specific log target (e.g. |
| 23 |
<constant>SYSTEMD_LOG_LEVEL=debug,console:info</constant> specifies to log at debug level except when |
| 24 |
logging to the console which should be at info level). Note that the global maximum log level takes |
| 25 |
priority over any per target maximum log levels.</para></listitem> |
| 26 |
</varlistentry> |
| 27 |
|
| 28 |
<varlistentry id='log-color'> |
| 29 |
<term><varname>$SYSTEMD_LOG_COLOR</varname></term> |
| 30 |
|
| 31 |
<listitem><para id='log-color-body'>A boolean. If true, messages written to the tty will be colored |
| 32 |
according to priority.</para> |
| 33 |
|
| 34 |
<para>This setting is only useful when messages are written directly to the terminal, because |
| 35 |
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> and |
| 36 |
other tools that display logs will color messages based on the log level on their own.</para> |
| 37 |
</listitem> |
| 38 |
</varlistentry> |
| 39 |
|
| 40 |
<varlistentry id='log-time'> |
| 41 |
<term><varname>$SYSTEMD_LOG_TIME</varname></term> |
| 42 |
|
| 43 |
<listitem><para id='log-time-body'>A boolean. If true, console log messages will be prefixed with a |
| 44 |
timestamp.</para> |
| 45 |
|
| 46 |
<para>This setting is only useful when messages are written directly to the terminal or a file, because |
| 47 |
<citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> and |
| 48 |
other tools that display logs will attach timestamps based on the entry metadata on their own.</para> |
| 49 |
</listitem> |
| 50 |
</varlistentry> |
| 51 |
|
| 52 |
<varlistentry id='log-location'> |
| 53 |
<term><varname>$SYSTEMD_LOG_LOCATION</varname></term> |
| 54 |
|
| 55 |
<listitem><para id='log-location-body'>A boolean. If true, messages will be prefixed with a filename |
| 56 |
and line number in the source code where the message originates.</para> |
| 57 |
|
| 58 |
<para>Note that the log location is often attached as metadata to journal entries anyway. Including it |
| 59 |
directly in the message text can nevertheless be convenient when debugging programs.</para> |
| 60 |
</listitem> |
| 61 |
</varlistentry> |
| 62 |
|
| 63 |
<varlistentry id='log-tid'> |
| 64 |
<term><varname>$SYSTEMD_LOG_TID</varname></term> |
| 65 |
|
| 66 |
<listitem><para id='log-tid-body'>A boolean. If true, messages will be prefixed with the current |
| 67 |
numerical thread ID (TID).</para> |
| 68 |
|
| 69 |
<para>Note that the this information is attached as metadata to journal entries anyway. Including it |
| 70 |
directly in the message text can nevertheless be convenient when debugging programs.</para> |
| 71 |
</listitem> |
| 72 |
</varlistentry> |
| 73 |
|
| 74 |
<varlistentry id='log-target'> |
| 75 |
<term><varname>$SYSTEMD_LOG_TARGET</varname></term> |
| 76 |
|
| 77 |
<listitem><para id='log-target-body'>The destination for log messages. One of |
| 78 |
<constant>console</constant> (log to the attached tty), <constant>console-prefixed</constant> (log to |
| 79 |
the attached tty but with prefixes encoding the log level and "facility", see <citerefentry |
| 80 |
project='man-pages'><refentrytitle>syslog</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
| 81 |
<constant>kmsg</constant> (log to the kernel circular log buffer), <constant>journal</constant> (log to |
| 82 |
the journal), <constant>journal-or-kmsg</constant> (log to the journal if available, and to kmsg |
| 83 |
otherwise), <constant>auto</constant> (determine the appropriate log target automatically, the default), |
| 84 |
<constant>null</constant> (disable log output).</para> |
| 85 |
<!-- <constant>syslog</constant>, <constant>syslog-or-kmsg</constant> are deprecated --> |
| 86 |
</listitem> |
| 87 |
</varlistentry> |
| 88 |
|
| 89 |
<varlistentry id='log-ratelimit-kmsg'> |
| 90 |
<term><varname>$SYSTEMD_LOG_RATELIMIT_KMSG</varname></term> |
| 91 |
|
| 92 |
<listitem><para id='log-ratelimit-kmsg-body'> Whether to ratelimit kmsg or not. Takes a boolean. |
| 93 |
Defaults to <literal>true</literal>. If disabled, systemd will not ratelimit messages written to kmsg. |
| 94 |
</para></listitem> |
| 95 |
</varlistentry> |
| 96 |
|
| 97 |
<varlistentry id='pager'> |
| 98 |
<term><varname>$SYSTEMD_PAGER</varname></term> |
| 99 |
<term><varname>$PAGER</varname></term> |
| 100 |
|
| 101 |
<listitem><para>Pager to use when <option>--no-pager</option> is not given. |
| 102 |
<varname>$SYSTEMD_PAGER</varname> is used if set; otherwise <varname>$PAGER</varname> is used. |
| 103 |
If neither <varname>$SYSTEMD_PAGER</varname> nor <varname>$PAGER</varname> are set, a set of well-known |
| 104 |
pager implementations is tried in turn, including |
| 105 |
<citerefentry project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 106 |
and |
| 107 |
<citerefentry project='man-pages'><refentrytitle>more</refentrytitle><manvolnum>1</manvolnum></citerefentry>, |
| 108 |
until one is found. If no pager implementation is discovered, no pager is invoked. Setting those |
| 109 |
environment variables to an empty string or the value <literal>cat</literal> is equivalent to passing |
| 110 |
<option>--no-pager</option>.</para> |
| 111 |
|
| 112 |
<para>Note: if <varname>$SYSTEMD_PAGERSECURE</varname> is not set, <varname>$SYSTEMD_PAGER</varname> |
| 113 |
and <varname>$PAGER</varname> can only be used to disable the pager (with <literal>cat</literal> or |
| 114 |
<literal></literal>), and are otherwise ignored.</para></listitem> |
| 115 |
</varlistentry> |
| 116 |
|
| 117 |
<varlistentry id='less'> |
| 118 |
<term><varname>$SYSTEMD_LESS</varname></term> |
| 119 |
|
| 120 |
<listitem><para>Override the options passed to <command>less</command> (by default |
| 121 |
<literal>FRSXMK</literal>).</para> |
| 122 |
|
| 123 |
<para>Users might want to change two options in particular:</para> |
| 124 |
|
| 125 |
<variablelist> |
| 126 |
<varlistentry> |
| 127 |
<term><option>K</option></term> |
| 128 |
|
| 129 |
<listitem> |
| 130 |
<para>This option instructs the pager to exit immediately when |
| 131 |
<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> is pressed. To allow |
| 132 |
<command>less</command> to handle <keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> |
| 133 |
itself to switch back to the pager command prompt, unset this option.</para> |
| 134 |
|
| 135 |
<para>If the value of <varname>$SYSTEMD_LESS</varname> does not include <literal>K</literal>, |
| 136 |
and the pager that is invoked is <command>less</command>, |
| 137 |
<keycombo><keycap>Ctrl</keycap><keycap>C</keycap></keycombo> will be ignored by the |
| 138 |
executable, and needs to be handled by the pager.</para> |
| 139 |
</listitem> |
| 140 |
</varlistentry> |
| 141 |
|
| 142 |
<varlistentry> |
| 143 |
<term><option>X</option></term> |
| 144 |
|
| 145 |
<listitem> |
| 146 |
<para>This option instructs the pager to not send termcap initialization and deinitialization |
| 147 |
strings to the terminal. It is set by default to allow command output to remain visible in the |
| 148 |
terminal even after the pager exits. Nevertheless, this prevents some pager functionality from |
| 149 |
working, in particular paged output cannot be scrolled with the mouse.</para> |
| 150 |
</listitem> |
| 151 |
</varlistentry> |
| 152 |
</variablelist> |
| 153 |
|
| 154 |
<para>Note that setting the regular <varname>$LESS</varname> environment variable has no effect |
| 155 |
for <command>less</command> invocations by systemd tools.</para> |
| 156 |
|
| 157 |
<para>See |
| 158 |
<citerefentry project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry> |
| 159 |
for more discussion.</para></listitem> |
| 160 |
</varlistentry> |
| 161 |
|
| 162 |
<varlistentry id='lesscharset'> |
| 163 |
<term><varname>$SYSTEMD_LESSCHARSET</varname></term> |
| 164 |
|
| 165 |
<listitem><para>Override the charset passed to <command>less</command> (by default <literal>utf-8</literal>, if |
| 166 |
the invoking terminal is determined to be UTF-8 compatible).</para> |
| 167 |
|
| 168 |
<para>Note that setting the regular <varname>$LESSCHARSET</varname> environment variable has no effect |
| 169 |
for <command>less</command> invocations by systemd tools.</para></listitem> |
| 170 |
</varlistentry> |
| 171 |
|
| 172 |
<varlistentry id='lesssecure'> |
| 173 |
<term><varname>$SYSTEMD_PAGERSECURE</varname></term> |
| 174 |
|
| 175 |
<listitem> |
| 176 |
<para>Common pager commands like <citerefentry |
| 177 |
project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry>, in |
| 178 |
addition to "paging", i.e. scrolling through the output, support opening of or writing to other files |
| 179 |
and running arbitrary shell commands. When commands are invoked with elevated privileges, for example |
| 180 |
under <citerefentry |
| 181 |
project='man-pages'><refentrytitle>sudo</refentrytitle><manvolnum>8</manvolnum></citerefentry> or |
| 182 |
<citerefentry |
| 183 |
project='die-net'><refentrytitle>pkexec</refentrytitle><manvolnum>1</manvolnum></citerefentry>, the |
| 184 |
pager becomes a security boundary. Care must be taken that only programs with strictly limited |
| 185 |
functionality are used as pagers, and unintended interactive features like opening or creation of new |
| 186 |
files or starting of subprocesses are not allowed. "Secure mode" for the pager may be enabled as |
| 187 |
described below, <emphasis>if the pager supports that</emphasis> (most pagers are not written in a way |
| 188 |
that takes this into consideration). It is recommended to either explicitly enable "secure mode" or to |
| 189 |
completely disable the pager using <option>--no-pager</option> or <varname>PAGER=cat</varname> when |
| 190 |
allowing untrusted users to execute commands with elevated privileges.</para> |
| 191 |
|
| 192 |
<para>This option takes a boolean argument. When set to true, the "secure mode" of the pager is |
| 193 |
enabled. In "secure mode", <option>LESSSECURE=1</option> will be set when invoking the pager, which |
| 194 |
instructs the pager to disable commands that open or create new files or start new subprocesses. |
| 195 |
Currently only <citerefentry |
| 196 |
project='man-pages'><refentrytitle>less</refentrytitle><manvolnum>1</manvolnum></citerefentry> is known |
| 197 |
to understand this variable and implement "secure mode".</para> |
| 198 |
|
| 199 |
<para>When set to false, no limitation is placed on the pager. Setting |
| 200 |
<varname>SYSTEMD_PAGERSECURE=0</varname> or not removing it from the inherited environment may allow |
| 201 |
the user to invoke arbitrary commands.</para> |
| 202 |
|
| 203 |
<para>When <varname>$SYSTEMD_PAGERSECURE</varname> is not set, systemd tools attempt to automatically |
| 204 |
figure out if "secure mode" should be enabled and whether the pager supports it. "Secure mode" is |
| 205 |
enabled if the effective UID is not the same as the owner of the login session, see |
| 206 |
<citerefentry project='man-pages'><refentrytitle>geteuid</refentrytitle><manvolnum>2</manvolnum></citerefentry> |
| 207 |
and |
| 208 |
<citerefentry><refentrytitle>sd_pid_get_owner_uid</refentrytitle><manvolnum>3</manvolnum></citerefentry>, |
| 209 |
or when running under |
| 210 |
<citerefentry><refentrytitle>sudo</refentrytitle><manvolnum>8</manvolnum></citerefentry> or similar |
| 211 |
tools (<varname>$SUDO_UID</varname> is set <footnote> |
| 212 |
<para>It is recommended for other tools to set and check <varname>$SUDO_UID</varname> as appropriate, |
| 213 |
treating it is a common interface.</para></footnote>). In those cases, |
| 214 |
<varname>SYSTEMD_PAGERSECURE=1</varname> will be set and pagers which are not known to implement |
| 215 |
"secure mode" will not be used at all. Note that this autodetection only covers the most common |
| 216 |
mechanisms to elevate privileges and is intended as convenience. It is recommended to explicitly set |
| 217 |
<varname>$SYSTEMD_PAGERSECURE</varname> or disable the pager.</para> |
| 218 |
|
| 219 |
<para>Note that if the <varname>$SYSTEMD_PAGER</varname> or <varname>$PAGER</varname> variables are to |
| 220 |
be honoured, other than to disable the pager, <varname>$SYSTEMD_PAGERSECURE</varname> must be set |
| 221 |
too.</para></listitem> |
| 222 |
</varlistentry> |
| 223 |
|
| 224 |
<varlistentry id='colors'> |
| 225 |
<term><varname>$SYSTEMD_COLORS</varname></term> |
| 226 |
|
| 227 |
<listitem> |
| 228 |
<para>Takes a boolean argument, or a special value. By default (unset), <command>systemd</command> |
| 229 |
and related utilities will use colors in their output if possible. If <varname>$COLORTERM</varname> |
| 230 |
is set to <literal>truecolor</literal> or <literal>24bit</literal>, 24-bit colors will be enabled, |
| 231 |
256 colors otherwise, unless <varname>$NO_COLOR</varname> or <varname>$TERM</varname> indicates |
| 232 |
colors are disabled.</para> |
| 233 |
|
| 234 |
<variablelist> |
| 235 |
<varlistentry> |
| 236 |
<term><option>true</option></term> |
| 237 |
<listitem><para>Same as unset, except that <varname>$NO_COLOR</varname> is ignored.</para></listitem> |
| 238 |
</varlistentry> |
| 239 |
|
| 240 |
<varlistentry> |
| 241 |
<term><option>false</option></term> |
| 242 |
<listitem><para>The output will be monochrome.</para></listitem> |
| 243 |
</varlistentry> |
| 244 |
|
| 245 |
<varlistentry> |
| 246 |
<term><literal>16</literal></term> |
| 247 |
<term><literal>256</literal></term> |
| 248 |
<term><literal>24bit</literal></term> |
| 249 |
<listitem><para>Always use the base 16 ANSI colors, 256 colors, or 24 bit color, |
| 250 |
respectively.</para></listitem> |
| 251 |
</varlistentry> |
| 252 |
|
| 253 |
<varlistentry> |
| 254 |
<term><literal>auto-16</literal></term> |
| 255 |
<term><literal>auto-256</literal></term> |
| 256 |
<term><literal>auto-24bit</literal></term> |
| 257 |
<listitem><para>Use the given quantity of colours, subject to <varname>$TERM</varname>, and what |
| 258 |
the console is connected to.</para></listitem> |
| 259 |
</varlistentry> |
| 260 |
</variablelist> |
| 261 |
</listitem> |
| 262 |
</varlistentry> |
| 263 |
|
| 264 |
<!-- This is not documented on purpose, because it is not clear if $NO_COLOR will become supported |
| 265 |
widely enough. So let's provide support, but without advertising this. |
| 266 |
<varlistentry id='no-color'> |
| 267 |
<term><varname>$NO_COLOR</varname></term> |
| 268 |
|
| 269 |
<listitem><para>If set (to any value), and <varname>$SYSTEMD_COLORS</varname> is not set to |
| 270 |
<literal>16</literal>, <literal>256</literal>, or <literal>24bit</literal>, equivalent to |
| 271 |
<option>SYSTEMD_COLORS=0</option>. See <ulink url="https://no-color.org/">no-color.org</ulink>.</para> |
| 272 |
</listitem> |
| 273 |
</varlistentry> |
| 274 |
--> |
| 275 |
|
| 276 |
<varlistentry id='urlify'> |
| 277 |
<term><varname>$SYSTEMD_URLIFY</varname></term> |
| 278 |
|
| 279 |
<listitem><para>The value must be a boolean. Controls whether clickable links should be generated in |
| 280 |
the output for terminal emulators supporting this. This can be specified to override the decision that |
| 281 |
<command>systemd</command> makes based on <varname>$TERM</varname> and other conditions.</para> |
| 282 |
</listitem> |
| 283 |
</varlistentry> |
| 284 |
|
| 285 |
</variablelist> |
| 286 |
</refsect1> |