| 1 |
<?xml version='1.0'?> <!--*-nxml-*--> |
| 2 |
<!DOCTYPE refentry 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 |
<refentry id="pam_systemd" conditional='HAVE_PAM' xmlns:xi="http://www.w3.org/2001/XInclude"> |
| 7 |
|
| 8 |
<refentryinfo> |
| 9 |
<title>pam_systemd</title> |
| 10 |
<productname>systemd</productname> |
| 11 |
</refentryinfo> |
| 12 |
|
| 13 |
<refmeta> |
| 14 |
<refentrytitle>pam_systemd</refentrytitle> |
| 15 |
<manvolnum>8</manvolnum> |
| 16 |
</refmeta> |
| 17 |
|
| 18 |
<refnamediv> |
| 19 |
<refname>pam_systemd</refname> |
| 20 |
<refpurpose>Register user sessions in the systemd login manager</refpurpose> |
| 21 |
</refnamediv> |
| 22 |
|
| 23 |
<refsynopsisdiv> |
| 24 |
<para><filename>pam_systemd.so</filename></para> |
| 25 |
</refsynopsisdiv> |
| 26 |
|
| 27 |
<refsect1> |
| 28 |
<title>Description</title> |
| 29 |
|
| 30 |
<para><command>pam_systemd</command> registers user sessions with |
| 31 |
the systemd login manager |
| 32 |
<citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, |
| 33 |
and hence the systemd control group hierarchy.</para> |
| 34 |
|
| 35 |
<para>The module also applies various resource management and runtime parameters to the new session, as |
| 36 |
configured in the <ulink url="https://systemd.io/USER_RECORD">JSON User Records</ulink> of the user, when |
| 37 |
one is defined.</para> |
| 38 |
|
| 39 |
<para>On login, this module — in conjunction with <filename>systemd-logind.service</filename> — ensures the |
| 40 |
following:</para> |
| 41 |
|
| 42 |
<orderedlist> |
| 43 |
<listitem><para>If it does not exist yet, the user runtime directory <filename>/run/user/$UID</filename> is |
| 44 |
either created or mounted as new <literal>tmpfs</literal> file system with quota applied, and its ownership |
| 45 |
changed to the user that is logging in.</para></listitem> |
| 46 |
|
| 47 |
<listitem><para>The <varname>$XDG_SESSION_ID</varname> environment variable is initialized. If auditing is |
| 48 |
available and <command>pam_loginuid.so</command> was run before this module (which is highly recommended), the |
| 49 |
variable is initialized from the auditing session id (<filename>/proc/self/sessionid</filename>). Otherwise, an |
| 50 |
independent session counter is used.</para></listitem> |
| 51 |
|
| 52 |
<listitem><para>A new systemd scope unit is created for the session. If this is the first concurrent session of |
| 53 |
the user, an implicit per-user slice unit below <filename>user.slice</filename> is automatically created and the |
| 54 |
scope placed into it. An instance of the system service <filename>[email protected]</filename>, which runs the |
| 55 |
systemd user manager instance, is started.</para></listitem> |
| 56 |
|
| 57 |
<listitem><para>The <literal>$TZ</literal>, <literal>$EMAIL</literal> and <literal>$LANG</literal> |
| 58 |
environment variables are configured for the user, based on the respective data from the user's JSON |
| 59 |
record (if it is defined). Moreover, any environment variables explicitly configured in the user record |
| 60 |
are imported, and the umask, nice level, and resource limits initialized.</para></listitem> |
| 61 |
</orderedlist> |
| 62 |
|
| 63 |
<para>On logout, this module ensures the following:</para> |
| 64 |
|
| 65 |
<orderedlist> |
| 66 |
<listitem><para>If enabled in |
| 67 |
<citerefentry><refentrytitle>logind.conf</refentrytitle> |
| 68 |
<manvolnum>5</manvolnum></citerefentry> (<varname>KillUserProcesses=</varname>), all processes of the session are |
| 69 |
terminated. If the last concurrent session of a user ends, the user's systemd instance will be terminated too, |
| 70 |
and so will the user's slice unit.</para></listitem> |
| 71 |
|
| 72 |
<listitem><para>If the last concurrent session of a user ends, |
| 73 |
the user runtime directory <filename>/run/user/$UID</filename> and all its |
| 74 |
contents are removed, too.</para></listitem> |
| 75 |
</orderedlist> |
| 76 |
|
| 77 |
<para>If the system was not booted up with systemd as init system, |
| 78 |
this module does nothing and immediately returns |
| 79 |
<constant>PAM_SUCCESS</constant>.</para> |
| 80 |
|
| 81 |
</refsect1> |
| 82 |
|
| 83 |
<refsect1> |
| 84 |
<title>Options</title> |
| 85 |
|
| 86 |
<para>The following options are understood:</para> |
| 87 |
|
| 88 |
<variablelist class='pam-directives'> |
| 89 |
|
| 90 |
<varlistentry> |
| 91 |
<term><varname>class=</varname></term> |
| 92 |
|
| 93 |
<listitem><para>Takes a string argument which sets the session class. The |
| 94 |
<varname>XDG_SESSION_CLASS</varname> environment variable (see below) takes precedence. See |
| 95 |
<citerefentry><refentrytitle>sd_session_get_class</refentrytitle><manvolnum>3</manvolnum></citerefentry> |
| 96 |
for a way to query the class of a session. The following session classes are defined:</para> |
| 97 |
|
| 98 |
<table> |
| 99 |
<title>Session Classes</title> |
| 100 |
<tgroup cols='2' align='left' colsep='1' rowsep='1'> |
| 101 |
<colspec colname="name" /> |
| 102 |
<colspec colname="explanation" /> |
| 103 |
<thead> |
| 104 |
<row> |
| 105 |
<entry>Name</entry> |
| 106 |
<entry>Explanation</entry> |
| 107 |
</row> |
| 108 |
</thead> |
| 109 |
<tbody> |
| 110 |
<row> |
| 111 |
<entry><constant>user</constant></entry> |
| 112 |
<entry>A regular interactive user session. This is the default class for sessions for which a TTY or X display is known at session registration time.</entry> |
| 113 |
</row> |
| 114 |
<row> |
| 115 |
<entry><constant>user-early</constant></entry> |
| 116 |
<entry>Similar to <constant>user</constant> but sessions of this class are not ordered after <citerefentry><refentrytitle>systemd-user-sessions.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>, i.e. may be started before regular sessions are allowed to be established. This session class is the default for sessions of the root user that would otherwise qualify for the <constant>user</constant> class, see above. (Added in v256.)</entry> |
| 117 |
</row> |
| 118 |
<row> |
| 119 |
<entry><constant>user-light</constant></entry> |
| 120 |
<entry>Similar to <constant>user</constant>, but sessions of this class will not pull in the <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry> of the user, and thus possibly have no service manager of the user running. (Added in v258.)</entry> |
| 121 |
</row> |
| 122 |
<row> |
| 123 |
<entry><constant>user-early-light</constant></entry> |
| 124 |
<entry>Similar to <constant>user-early</constant>, but sessions of this class will not pull in the <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry> of the user, and thus possibly have no service manager of the user running. (Added in v258.)</entry> |
| 125 |
</row> |
| 126 |
<row> |
| 127 |
<entry><constant>user-incomplete</constant></entry> |
| 128 |
<entry>Similar to <constant>user</constant> but for sessions which are not fully set up yet, i.e. have no home directory mounted or similar. This is used by <citerefentry><refentrytitle>systemd-homed.service</refentrytitle><manvolnum>8</manvolnum></citerefentry> to allow users to log in via <citerefentry project='man-pages'><refentrytitle>ssh</refentrytitle><manvolnum>1</manvolnum></citerefentry> before their home directory is mounted, delaying the mount until the user provided the unlock password. Sessions of this class are upgraded to the regular <constant>user</constant> class once the home directory is activated.</entry> |
| 129 |
</row> |
| 130 |
<row> |
| 131 |
<entry><constant>greeter</constant></entry> |
| 132 |
<entry>Similar to <constant>user</constant> but for sessions that are spawned by a display manager ephemerally and which prompt the user for login credentials.</entry> |
| 133 |
</row> |
| 134 |
<row> |
| 135 |
<entry><constant>lock-screen</constant></entry> |
| 136 |
<entry>Similar to <constant>user</constant> but for sessions that are spawned by a display manager ephemerally and which show a lock screen that can be used to unlock locked user accounts or sessions.</entry> |
| 137 |
</row> |
| 138 |
<row> |
| 139 |
<entry><constant>background</constant></entry> |
| 140 |
<entry>Used for background sessions, such as those invoked by <citerefentry project='die-net'><refentrytitle>cron</refentrytitle><manvolnum>8</manvolnum></citerefentry> and similar tools. This is the default class for sessions for which no TTY or X display is known at session registration time.</entry> |
| 141 |
</row> |
| 142 |
<row> |
| 143 |
<entry><constant>background-light</constant></entry> |
| 144 |
<entry>Similar to <constant>background</constant>, but sessions of this class will not pull in the <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry> of the user, and thus possibly have no service manager of the user running. (Added in v256.)</entry> |
| 145 |
</row> |
| 146 |
<row> |
| 147 |
<entry><constant>manager</constant></entry> |
| 148 |
<entry>The <citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry> service of the user is registered under this session class. (Added in v256.)</entry> |
| 149 |
</row> |
| 150 |
<row> |
| 151 |
<entry><constant>manager-early</constant></entry> |
| 152 |
<entry>Similar to <constant>manager</constant>, but for the root user. Compare with the <constant>user</constant> vs. <constant>user-early</constant> situation. (Added in v256.)</entry> |
| 153 |
</row> |
| 154 |
<row> |
| 155 |
<entry><constant>none</constant></entry> |
| 156 |
<entry>Skips registering this session with logind. No session scope will be created, and the user service manager will not be started. (Added in v258.)</entry> |
| 157 |
</row> |
| 158 |
</tbody> |
| 159 |
</tgroup> |
| 160 |
</table> |
| 161 |
|
| 162 |
<para>If no session class is specified via either the PAM module option or via the |
| 163 |
<varname>$XDG_SESSION_CLASS</varname> environment variable, the class is automatically chosen, depending on |
| 164 |
various session parameters, such as the session type (if known), whether the session has a TTY or X11 |
| 165 |
display, and the user disposition. Note that various tools allow setting the session class for newly |
| 166 |
allocated PAM sessions explicitly by means of the <varname>$XDG_SESSION_CLASS</varname> environment variable. |
| 167 |
For example, classic UNIX cronjobs support environment variable assignments (see |
| 168 |
<citerefentry project='man-pages'><refentrytitle>crontab</refentrytitle><manvolnum>5</manvolnum></citerefentry>), |
| 169 |
which may be used to choose between the <constant>background</constant> and |
| 170 |
<constant>background-light</constant> session class individually per cronjob, or |
| 171 |
<command>run0 --setenv=XDG_SESSION_CLASS=user-light</command> may be used |
| 172 |
to choose between <constant>user</constant> and <constant>user-light</constant> for invoked privileged sessions. |
| 173 |
</para> |
| 174 |
|
| 175 |
<xi:include href="version-info.xml" xpointer="v197"/></listitem> |
| 176 |
</varlistentry> |
| 177 |
|
| 178 |
<varlistentry> |
| 179 |
<term><varname>type=</varname></term> |
| 180 |
|
| 181 |
<listitem><para>Takes a string argument which sets the session type. The <varname>XDG_SESSION_TYPE</varname> |
| 182 |
environment variable (see below) takes precedence. One of <constant>unspecified</constant>, |
| 183 |
<constant>tty</constant>, <constant>x11</constant>, <constant>wayland</constant>, <constant>mir</constant>, or |
| 184 |
<constant>web</constant>. See |
| 185 |
<citerefentry><refentrytitle>sd_session_get_type</refentrytitle><manvolnum>3</manvolnum></citerefentry> for |
| 186 |
details about the session type.</para> |
| 187 |
|
| 188 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 189 |
</varlistentry> |
| 190 |
|
| 191 |
<varlistentry> |
| 192 |
<term><varname>desktop=</varname></term> |
| 193 |
|
| 194 |
<listitem><para>Takes a single, short identifier string for the desktop environment. The |
| 195 |
<varname>XDG_SESSION_DESKTOP</varname> environment variable (see below) takes precedence. This may be used to |
| 196 |
indicate the session desktop used, where this applies and if this information is available. For example: |
| 197 |
<constant>GNOME</constant>, or <constant>KDE</constant>. It is recommended to use the same identifiers and |
| 198 |
capitalization as for <varname>$XDG_CURRENT_DESKTOP</varname>, as defined by the <ulink |
| 199 |
url="https://standards.freedesktop.org/desktop-entry-spec/latest/">Desktop Entry |
| 200 |
Specification</ulink>. (However, note that the option only takes a single item, and not a colon-separated list |
| 201 |
like <varname>$XDG_CURRENT_DESKTOP</varname>.) See |
| 202 |
<citerefentry><refentrytitle>sd_session_get_desktop</refentrytitle><manvolnum>3</manvolnum></citerefentry> for |
| 203 |
further details.</para> |
| 204 |
|
| 205 |
<xi:include href="version-info.xml" xpointer="v240"/></listitem> |
| 206 |
</varlistentry> |
| 207 |
|
| 208 |
<varlistentry> |
| 209 |
<term><varname>area=</varname></term> |
| 210 |
|
| 211 |
<listitem><para>Takes a filename as parameter. If specified and the user logs into their account the |
| 212 |
<varname>$HOME</varname> environment variable will be set to <filename>~/Areas/</filename> suffixed |
| 213 |
by the specified string, but only if that directory exists. Moreover, the |
| 214 |
<varname>$XDG_AREA</varname> variable will be set to the (unprefixed) parameter.</para> |
| 215 |
|
| 216 |
<para>This functionality may be used to maintain multiple separate secondary home directories within |
| 217 |
the primary home directory of the user. Typically, the area to log into is specified while logging |
| 218 |
in, if the account permits that (accounts provided by |
| 219 |
<citerefentry><refentrytitle>pam_systemd_home</refentrytitle><manvolnum>8</manvolnum></citerefentry> |
| 220 |
do), but this parameter may be used to define a default if that's not provided.</para> |
| 221 |
|
| 222 |
<para>Note that this only adjusts <varname>$HOME</varname> during login, it does not affect the |
| 223 |
otherwise reported home directory of the user. Specifically this means that <citerefentry |
| 224 |
project='man-pages'><refentrytitle>sshd</refentrytitle><manvolnum>8</manvolnum></citerefentry> will |
| 225 |
continue to look for SSH keys of the user only in the primary home directory of the user, not in any |
| 226 |
of their areas.</para> |
| 227 |
|
| 228 |
<para>Note that the default area to log into can also be configured as part of the user account. The |
| 229 |
area specified via <varname>area=</varname> overrides the default area configured there. Also note |
| 230 |
that if the area is specified explicitly by the user at login time, it overrides both. Also note that |
| 231 |
setting this parameter to an empty string has the effect of undoing the effect of any default area |
| 232 |
configured as part of the user record, i.e. ensuring the user logs into the primary home directory of |
| 233 |
their account.</para> |
| 234 |
|
| 235 |
<para>For details on the area concept see |
| 236 |
<citerefentry><refentrytitle>pam_systemd_home</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para> |
| 237 |
|
| 238 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 239 |
</varlistentry> |
| 240 |
|
| 241 |
<varlistentry> |
| 242 |
<term><varname>default-capability-bounding-set=</varname></term> |
| 243 |
<term><varname>default-capability-ambient-set=</varname></term> |
| 244 |
|
| 245 |
<listitem><para>Takes a comma-separated list of process capabilities (e.g. |
| 246 |
<constant>CAP_WAKE_ALARM</constant>, <constant>CAP_BLOCK_SUSPEND</constant>, …) to set for the |
| 247 |
invoked session's processes, if the user record does not encode appropriate sets of capabilities |
| 248 |
directly. See <citerefentry |
| 249 |
project='man-pages'><refentrytitle>capabilities</refentrytitle><manvolnum>7</manvolnum></citerefentry> |
| 250 |
for details on the capabilities concept. If not specified, the default bounding set is left as is |
| 251 |
(i.e. usually contains the full set of capabilities). The default ambient set is set to |
| 252 |
<constant>CAP_WAKE_ALARM</constant> for regular users if the PAM session is associated with a local |
| 253 |
seat or if it is invoked for the systemd user service <filename>[email protected]</filename>. Otherwise, |
| 254 |
defaults to the empty set.</para> |
| 255 |
|
| 256 |
<xi:include href="version-info.xml" xpointer="v254"/></listitem> |
| 257 |
</varlistentry> |
| 258 |
|
| 259 |
<varlistentry> |
| 260 |
<term><varname>debug</varname><optional>=</optional></term> |
| 261 |
|
| 262 |
<listitem><para>Takes an optional boolean argument. If yes or without the argument, the module will log |
| 263 |
debugging information as it operates.</para></listitem> |
| 264 |
</varlistentry> |
| 265 |
</variablelist> |
| 266 |
</refsect1> |
| 267 |
|
| 268 |
<refsect1> |
| 269 |
<title>Module Types Provided</title> |
| 270 |
|
| 271 |
<para>Only <option>session</option> is provided.</para> |
| 272 |
</refsect1> |
| 273 |
|
| 274 |
<refsect1> |
| 275 |
<title>Environment</title> |
| 276 |
|
| 277 |
<para>The following environment variables are initialized by the module and available to the processes of the |
| 278 |
user's session:</para> |
| 279 |
|
| 280 |
<variablelist class='environment-variables'> |
| 281 |
<varlistentry> |
| 282 |
<term><varname>$XDG_SESSION_ID</varname></term> |
| 283 |
|
| 284 |
<listitem><para>A short session identifier, suitable to be used in filenames. The string itself should be |
| 285 |
considered opaque, although often it is just the audit session ID as reported by |
| 286 |
<filename>/proc/self/sessionid</filename>. Each ID will be assigned only once during machine uptime. It may |
| 287 |
hence be used to uniquely label files or other resources of this session. Combine this ID with the boot |
| 288 |
identifier, as returned by |
| 289 |
<citerefentry><refentrytitle>sd_id128_get_boot</refentrytitle><manvolnum>3</manvolnum></citerefentry>, for a |
| 290 |
globally unique identifier.</para></listitem> |
| 291 |
</varlistentry> |
| 292 |
|
| 293 |
<varlistentry> |
| 294 |
<term><varname>$XDG_RUNTIME_DIR</varname></term> |
| 295 |
|
| 296 |
<listitem><para>Path to a user-private user-writable directory |
| 297 |
that is bound to the user login time on the machine. It is |
| 298 |
automatically created the first time a user logs in and |
| 299 |
removed on the user's final logout. If a user logs in twice at |
| 300 |
the same time, both sessions will see the same |
| 301 |
<varname>$XDG_RUNTIME_DIR</varname> and the same contents. If |
| 302 |
a user logs in once, then logs out again, and logs in again, |
| 303 |
the directory contents will have been lost in between, but |
| 304 |
applications should not rely on this behavior and must be able |
| 305 |
to deal with stale files. To store session-private data in |
| 306 |
this directory, the user should include the value of |
| 307 |
<varname>$XDG_SESSION_ID</varname> in the filename. This |
| 308 |
directory shall be used for runtime file system objects such |
| 309 |
as <constant>AF_UNIX</constant> sockets, FIFOs, PID files and |
| 310 |
similar. It is guaranteed that this directory is local and |
| 311 |
offers the greatest possible file system feature set the |
| 312 |
operating system provides. For further details, see the <ulink |
| 313 |
url="https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG |
| 314 |
Base Directory Specification</ulink>. <varname>$XDG_RUNTIME_DIR</varname> |
| 315 |
is not set if the current user is not the original user of the session.</para></listitem> |
| 316 |
</varlistentry> |
| 317 |
|
| 318 |
<varlistentry> |
| 319 |
<term><varname>$TZ</varname></term> |
| 320 |
<term><varname>$EMAIL</varname></term> |
| 321 |
<term><varname>$LANG</varname></term> |
| 322 |
|
| 323 |
<listitem><para>If a JSON user record is known for the user logging in these variables are |
| 324 |
initialized from the respective data in the record.</para> |
| 325 |
|
| 326 |
<xi:include href="version-info.xml" xpointer="v245"/></listitem> |
| 327 |
</varlistentry> |
| 328 |
|
| 329 |
<varlistentry> |
| 330 |
<term><varname>$SHELL_PROMPT_PREFIX</varname></term> |
| 331 |
<term><varname>$SHELL_PROMPT_SUFFIX</varname></term> |
| 332 |
<term><varname>$SHELL_WELCOME</varname></term> |
| 333 |
|
| 334 |
<listitem><para>These environment variables are initialized from the service credentials |
| 335 |
<literal>shell.prompt.prefix</literal>, <literal>shell.prompt.suffix</literal> and |
| 336 |
<literal>shell.welcome</literal> if set. They are passed to the invoked session processes, where they |
| 337 |
are imported into any shell prompt (specifically <varname>$SHELL_PROMPT_PREFIX</varname> is added as |
| 338 |
prefix to <varname>$PS1</varname>, and <varname>$SHELL_PROMPT_SUFFIX</varname> as suffix) or printed |
| 339 |
on screen when a shell first initializes.</para> |
| 340 |
|
| 341 |
<xi:include href="version-info.xml" xpointer="v257"/></listitem> |
| 342 |
</varlistentry> |
| 343 |
|
| 344 |
</variablelist> |
| 345 |
|
| 346 |
<para>The following environment variables are read by the module and may be used by the PAM service to pass |
| 347 |
metadata to the module. If these variables are not set when the PAM module is invoked but can be determined |
| 348 |
otherwise they are set by the module, so that these variables are initialized for the session and applications if |
| 349 |
known at all.</para> |
| 350 |
|
| 351 |
<variablelist class='environment-variables'> |
| 352 |
<varlistentry> |
| 353 |
<term><varname>$XDG_SESSION_TYPE</varname></term> |
| 354 |
|
| 355 |
<listitem><para>The session type. This may be used instead of <varname>type=</varname> on the module parameter |
| 356 |
line, and is usually preferred.</para> |
| 357 |
|
| 358 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 359 |
</varlistentry> |
| 360 |
|
| 361 |
<varlistentry> |
| 362 |
<term><varname>$XDG_SESSION_CLASS</varname></term> |
| 363 |
|
| 364 |
<listitem><para>The session class. This may be used instead of <varname>class=</varname> on the module parameter |
| 365 |
line, and is usually preferred.</para> |
| 366 |
|
| 367 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 368 |
</varlistentry> |
| 369 |
|
| 370 |
<varlistentry> |
| 371 |
<term><varname>$XDG_SESSION_DESKTOP</varname></term> |
| 372 |
|
| 373 |
<listitem><para>The desktop identifier. This may be used instead of <varname>desktop=</varname> on the module |
| 374 |
parameter line, and is usually preferred.</para> |
| 375 |
|
| 376 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 377 |
</varlistentry> |
| 378 |
|
| 379 |
<varlistentry> |
| 380 |
<term><varname>$XDG_SEAT</varname></term> |
| 381 |
|
| 382 |
<listitem><para>The seat name the session shall be registered |
| 383 |
for, if any.</para> |
| 384 |
|
| 385 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 386 |
</varlistentry> |
| 387 |
|
| 388 |
<varlistentry> |
| 389 |
<term><varname>$XDG_VTNR</varname></term> |
| 390 |
|
| 391 |
<listitem><para>The VT number the session shall be registered |
| 392 |
for, if any. (Only applies to seats with a VT available, such |
| 393 |
as <literal>seat0</literal>)</para> |
| 394 |
|
| 395 |
<xi:include href="version-info.xml" xpointer="v209"/></listitem> |
| 396 |
</varlistentry> |
| 397 |
|
| 398 |
<varlistentry> |
| 399 |
<term><varname>$XDG_AREA</varname></term> |
| 400 |
|
| 401 |
<listitem><para>If an area (secondary home directories of the user, within the primary home |
| 402 |
directory) to log into has been selected this variable is set to the area name (without any path |
| 403 |
prefix). It is otherwise unset. For details about areas, see above.</para> |
| 404 |
|
| 405 |
<xi:include href="version-info.xml" xpointer="v258"/></listitem> |
| 406 |
</varlistentry> |
| 407 |
|
| 408 |
<varlistentry> |
| 409 |
<term><varname>$XDG_SESSION_EXTRA_DEVICE_ACCESS</varname></term> |
| 410 |
|
| 411 |
<listitem><para>The set of additional hardware devices that the session shall be granted access to. |
| 412 |
For every <literal><replaceable>ID</replaceable></literal> in the list, the session is granted |
| 413 |
access to all devices tagged with <literal>xaccess-<replaceable>ID</replaceable></literal> in udev.</para> |
| 414 |
|
| 415 |
<xi:include href="version-info.xml" xpointer="v260"/></listitem> |
| 416 |
</varlistentry> |
| 417 |
</variablelist> |
| 418 |
|
| 419 |
<para>If not set, <command>pam_systemd</command> will initialize |
| 420 |
<varname>$XDG_SEAT</varname> and <varname>$XDG_VTNR</varname> |
| 421 |
based on the <varname>$DISPLAY</varname> variable (if the latter is set).</para> |
| 422 |
</refsect1> |
| 423 |
|
| 424 |
<refsect1> |
| 425 |
<title>Session limits</title> |
| 426 |
|
| 427 |
<para>PAM modules earlier in the stack, that is those that come before <command>pam_systemd.so</command>, |
| 428 |
can set session scope limits using the PAM context objects. The data for these objects is provided as <constant>NUL</constant>-terminated C strings |
| 429 |
and maps directly to the respective unit resource control directives. Note that these limits apply to individual sessions of the user, |
| 430 |
they do not apply to all user processes as a combined whole. In particular, the per-user <command>[email protected]</command> unit instance, |
| 431 |
which runs the <command>systemd --user</command> manager process and its children, and is tracked outside of any session, being shared |
| 432 |
by all the user's sessions, is not covered by these limits. |
| 433 |
</para> |
| 434 |
|
| 435 |
<para> See |
| 436 |
<citerefentry><refentrytitle>systemd.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information about the resources. |
| 437 |
Also, see <citerefentry project='man-pages'><refentrytitle>pam_set_data</refentrytitle><manvolnum>3</manvolnum></citerefentry> for additional information about how to set |
| 438 |
the context objects. |
| 439 |
</para> |
| 440 |
|
| 441 |
<variablelist class='pam-directives'> |
| 442 |
<varlistentry> |
| 443 |
<term><varname>systemd.memory_max=</varname></term> |
| 444 |
|
| 445 |
<listitem><para>Sets unit <varname>MemoryMax=</varname>.</para> |
| 446 |
|
| 447 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 448 |
</varlistentry> |
| 449 |
|
| 450 |
<varlistentry> |
| 451 |
<term><varname>systemd.tasks_max=</varname></term> |
| 452 |
|
| 453 |
<listitem><para>Sets unit <varname>TasksMax=</varname>.</para> |
| 454 |
|
| 455 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 456 |
</varlistentry> |
| 457 |
|
| 458 |
<varlistentry> |
| 459 |
<term><varname>systemd.cpu_weight=</varname></term> |
| 460 |
|
| 461 |
<listitem><para>Sets unit <varname>CPUWeight=</varname>.</para> |
| 462 |
|
| 463 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 464 |
</varlistentry> |
| 465 |
|
| 466 |
<varlistentry> |
| 467 |
<term><varname>systemd.io_weight=</varname></term> |
| 468 |
|
| 469 |
<listitem><para>Sets unit <varname>IOWeight=</varname>.</para> |
| 470 |
|
| 471 |
<xi:include href="version-info.xml" xpointer="v239"/></listitem> |
| 472 |
</varlistentry> |
| 473 |
|
| 474 |
<varlistentry> |
| 475 |
<term><varname>systemd.runtime_max_sec=</varname></term> |
| 476 |
|
| 477 |
<listitem><para>Sets unit <varname>RuntimeMaxSec=</varname>.</para> |
| 478 |
|
| 479 |
<xi:include href="version-info.xml" xpointer="v244"/></listitem> |
| 480 |
</varlistentry> |
| 481 |
</variablelist> |
| 482 |
|
| 483 |
<para>Example data as can be provided from an another PAM module: |
| 484 |
<programlisting> |
| 485 |
pam_set_data(handle, "systemd.memory_max", (void *)"200M", cleanup); |
| 486 |
pam_set_data(handle, "systemd.tasks_max", (void *)"50", cleanup); |
| 487 |
pam_set_data(handle, "systemd.cpu_weight", (void *)"100", cleanup); |
| 488 |
pam_set_data(handle, "systemd.io_weight", (void *)"340", cleanup); |
| 489 |
pam_set_data(handle, "systemd.runtime_max_sec", (void *)"3600", cleanup); |
| 490 |
</programlisting> |
| 491 |
</para> |
| 492 |
|
| 493 |
</refsect1> |
| 494 |
|
| 495 |
<refsect1> |
| 496 |
<title>Example</title> |
| 497 |
|
| 498 |
<para>Here's an example PAM configuration fragment that allows users sessions to be managed by |
| 499 |
<filename>systemd-logind.service</filename>:</para> |
| 500 |
|
| 501 |
<programlisting>#%PAM-1.0 |
| 502 |
-auth [success=done authtok_err=bad perm_denied=bad maxtries=bad default=ignore] pam_systemd_home.so |
| 503 |
auth sufficient pam_unix.so |
| 504 |
auth required pam_deny.so |
| 505 |
|
| 506 |
account required pam_nologin.so |
| 507 |
-account [success=done authtok_expired=bad new_authtok_reqd=bad maxtries=bad acct_expired=bad default=ignore] pam_systemd_home.so |
| 508 |
account required pam_unix.so |
| 509 |
|
| 510 |
-password sufficient pam_systemd_home.so |
| 511 |
password sufficient pam_unix.so sha512 shadow try_first_pass |
| 512 |
password required pam_deny.so |
| 513 |
|
| 514 |
-session optional pam_keyinit.so revoke |
| 515 |
-session optional pam_loginuid.so |
| 516 |
-session optional pam_systemd_home.so |
| 517 |
<command>-session optional pam_systemd.so</command> |
| 518 |
session required pam_unix.so</programlisting> |
| 519 |
</refsect1> |
| 520 |
|
| 521 |
<refsect1> |
| 522 |
<title>See Also</title> |
| 523 |
<para><simplelist type="inline"> |
| 524 |
<member><citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 525 |
<member><citerefentry><refentrytitle>systemd-user-sessions.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 526 |
<member><citerefentry><refentrytitle>[email protected]</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 527 |
<member><citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 528 |
<member><citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 529 |
<member><citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry></member> |
| 530 |
<member><citerefentry><refentrytitle>pam_systemd_home</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 531 |
<member><citerefentry project='man-pages'><refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 532 |
<member><citerefentry project='man-pages'><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 533 |
<member><citerefentry project='man-pages'><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 534 |
<member><citerefentry project='man-pages'><refentrytitle>pam_loginuid</refentrytitle><manvolnum>8</manvolnum></citerefentry></member> |
| 535 |
<member><citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 536 |
<member><citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 537 |
<member><citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry></member> |
| 538 |
</simplelist></para> |
| 539 |
</refsect1> |
| 540 |
|
| 541 |
</refentry> |