chiark / gitweb /
man: drop unused <authorgroup> tags from man sources
[elogind.git] / man / pam_elogind.xml
1 <?xml version='1.0'?> <!--*-nxml-*-->
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   SPDX-License-Identifier: LGPL-2.1+
7 -->
8
9 <refentry id="pam_elogind" conditional='HAVE_PAM'>
10
11   <refentryinfo>
12     <title>pam_elogind</title>
13     <productname>elogind</productname>
14   </refentryinfo>
15
16   <refmeta>
17     <refentrytitle>pam_elogind</refentrytitle>
18     <manvolnum>8</manvolnum>
19   </refmeta>
20
21   <refnamediv>
22     <refname>pam_elogind</refname>
23     <refpurpose>Register user sessions in the elogind login manager</refpurpose>
24   </refnamediv>
25
26   <refsynopsisdiv>
27     <para><filename>pam_elogind.so</filename></para>
28   </refsynopsisdiv>
29
30   <refsect1>
31     <title>Description</title>
32
33     <para><command>pam_elogind</command> registers user sessions with
34     the systemd login manager
35     <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
36     and hence the systemd control group hierarchy.</para>
37
38     <para>On login, this module — in conjunction with <filename>systemd-logind.service</filename> — ensures the
39     following:</para>
40
41     <orderedlist>
42       <listitem><para>If it does not exist yet, the user runtime directory <filename>/run/user/$UID</filename> is
43       either created or mounted as new <literal>tmpfs</literal> file system with quota applied, and its ownership
44       changed to the user that is logging in.</para></listitem>
45
46       <listitem><para>The <varname>$XDG_SESSION_ID</varname> environment variable is initialized. If auditing is
47       available and <command>pam_loginuid.so</command> was run before this module (which is highly recommended), the
48       variable is initialized from the auditing session id (<filename>/proc/self/sessionid</filename>). Otherwise, an
49       independent session counter is used.</para></listitem>
50
51       <listitem><para>A new systemd scope unit is created for the session. If this is the first concurrent session of
52       the user, an implicit per-user slice unit below <filename>user.slice</filename> is automatically created and the
53       scope placed into it. An instance of the system service <filename>user@.service</filename>, which runs the
54       systemd user manager instance, is started.  </para></listitem>
55     </orderedlist>
56
57     <para>On logout, this module ensures the following:</para>
58
59     <orderedlist>
60       <listitem><para>If enabled in
61       <citerefentry><refentrytitle>logind.conf</refentrytitle>
62       <manvolnum>5</manvolnum></citerefentry> (<varname>KillUserProcesses=</varname>), all processes of the session are
63       terminated. If the last concurrent session of a user ends, the user's systemd instance will be terminated too,
64       and so will the user's slice unit.</para></listitem>
65
66       <listitem><para>If the last concurrent session of a user ends,
67       the user runtime directory <filename>/run/user/$UID</filename> and all its
68       contents are removed, too.</para></listitem>
69     </orderedlist>
70
71     <para>If the system was not booted up with systemd as init system,
72     this module does nothing and immediately returns
73     <constant>PAM_SUCCESS</constant>.</para>
74
75   </refsect1>
76
77   <refsect1>
78     <title>Options</title>
79
80     <para>The following options are understood:</para>
81
82     <variablelist class='pam-directives'>
83
84       <varlistentry>
85         <term><option>class=</option></term>
86
87         <listitem><para>Takes a string argument which sets the session
88         class. The XDG_SESSION_CLASS environmental variable takes
89         precedence. One of
90         <literal>user</literal>,
91         <literal>greeter</literal>,
92         <literal>lock-screen</literal> or
93         <literal>background</literal>. See
94         <citerefentry><refentrytitle>sd_session_get_class</refentrytitle><manvolnum>3</manvolnum></citerefentry>
95         for details about the session class.</para></listitem>
96       </varlistentry>
97
98       <varlistentry>
99         <term><option>type=</option></term>
100
101         <listitem><para>Takes a string argument which sets the session
102         type. The XDG_SESSION_TYPE environmental variable takes
103         precedence. One of
104         <literal>unspecified</literal>,
105         <literal>tty</literal>,
106         <literal>x11</literal>,
107         <literal>wayland</literal> or
108         <literal>mir</literal>. See
109         <citerefentry><refentrytitle>sd_session_get_type</refentrytitle><manvolnum>3</manvolnum></citerefentry>
110         for details about the session type.</para></listitem>
111       </varlistentry>
112
113       <varlistentry>
114         <term><option>debug<optional>=</optional></option></term>
115
116         <listitem><para>Takes an optional
117         boolean argument. If yes or without
118         the argument, the module will log
119         debugging information as it
120         operates.</para></listitem>
121       </varlistentry>
122     </variablelist>
123   </refsect1>
124
125   <refsect1>
126     <title>Module Types Provided</title>
127
128     <para>Only <option>session</option> is provided.</para>
129   </refsect1>
130
131   <refsect1>
132     <title>Environment</title>
133
134     <para>The following environment variables are set for the
135     processes of the user's session:</para>
136
137     <variablelist class='environment-variables'>
138       <varlistentry>
139         <term><varname>$XDG_SESSION_ID</varname></term>
140
141         <listitem><para>A session identifier, suitable to be used in
142         filenames. The string itself should be considered opaque,
143         although often it is just the audit session ID as reported by
144         <filename>/proc/self/sessionid</filename>. Each ID will be
145         assigned only once during machine uptime. It may hence be used
146         to uniquely label files or other resources of this
147         session.</para></listitem>
148       </varlistentry>
149
150       <varlistentry>
151         <term><varname>$XDG_RUNTIME_DIR</varname></term>
152
153         <listitem><para>Path to a user-private user-writable directory
154         that is bound to the user login time on the machine. It is
155         automatically created the first time a user logs in and
156         removed on the user's final logout. If a user logs in twice at
157         the same time, both sessions will see the same
158         <varname>$XDG_RUNTIME_DIR</varname> and the same contents. If
159         a user logs in once, then logs out again, and logs in again,
160         the directory contents will have been lost in between, but
161         applications should not rely on this behavior and must be able
162         to deal with stale files. To store session-private data in
163         this directory, the user should include the value of
164         <varname>$XDG_SESSION_ID</varname> in the filename. This
165         directory shall be used for runtime file system objects such
166         as <constant>AF_UNIX</constant> sockets, FIFOs, PID files and
167         similar. It is guaranteed that this directory is local and
168         offers the greatest possible file system feature set the
169         operating system provides. For further details, see the <ulink
170         url="http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html">XDG
171         Base Directory Specification</ulink>. <varname>$XDG_RUNTIME_DIR</varname>
172         is not set if the current user is not the original user of the session.</para></listitem>
173       </varlistentry>
174
175     </variablelist>
176
177     <para>The following environment variables are read by the module
178     and may be used by the PAM service to pass metadata to the
179     module:</para>
180
181     <variablelist class='environment-variables'>
182       <varlistentry>
183         <term><varname>$XDG_SESSION_TYPE</varname></term>
184
185         <listitem><para>The session type. This may be used instead of
186         <option>session=</option> on the module parameter line, and is
187         usually preferred.</para></listitem>
188       </varlistentry>
189
190       <varlistentry>
191         <term><varname>$XDG_SESSION_CLASS</varname></term>
192
193         <listitem><para>The session class. This may be used instead of
194         <option>class=</option> on the module parameter line, and is
195         usually preferred.</para></listitem>
196       </varlistentry>
197
198       <varlistentry>
199         <term><varname>$XDG_SESSION_DESKTOP</varname></term>
200
201         <listitem><para>A single, short identifier string for the
202         desktop environment. This may be used to indicate the session
203         desktop used, where this applies and if this information is
204         available. For example: <literal>GNOME</literal>, or
205         <literal>KDE</literal>. It is recommended to use the same
206         identifiers and capitalization as for
207         <varname>$XDG_CURRENT_DESKTOP</varname>, as defined by the
208         <ulink
209         url="http://standards.freedesktop.org/desktop-entry-spec/latest/">Desktop
210         Entry Specification</ulink>. (However, note that
211         <varname>$XDG_SESSION_DESKTOP</varname> only takes a single
212         item, and not a colon-separated list like
213         <varname>$XDG_CURRENT_DESKTOP</varname>.) See
214         <citerefentry><refentrytitle>sd_session_get_desktop</refentrytitle><manvolnum>3</manvolnum></citerefentry>
215         for more details.</para></listitem>
216       </varlistentry>
217
218       <varlistentry>
219         <term><varname>$XDG_SEAT</varname></term>
220
221         <listitem><para>The seat name the session shall be registered
222         for, if any.</para></listitem>
223       </varlistentry>
224
225       <varlistentry>
226         <term><varname>$XDG_VTNR</varname></term>
227
228         <listitem><para>The VT number the session shall be registered
229         for, if any. (Only applies to seats with a VT available, such
230         as <literal>seat0</literal>)</para></listitem>
231       </varlistentry>
232     </variablelist>
233
234     <para>If not set, <command>pam_elogind</command> will determine the
235     values for <varname>$XDG_SEAT</varname> and <varname>$XDG_VTNR</varname>
236     based on the <varname>$DISPLAY</varname> variable.</para>
237   </refsect1>
238
239   <refsect1>
240     <title>Session limits</title>
241
242     <para>PAM modules earlier in the stack, that is those that come before <command>pam_elogind.so</command>,
243     can set session scope limits using the PAM context objects. The data for these objects is provided as NUL-terminated C strings
244     and maps directly to the respective unit resource control directives. Note that these limits apply to individual sessions of the user,
245     they do not apply to all user processes as a combined whole. In particular, the per-user <command>user@.service</command> unit instance,
246     which runs the <command>elogind --user</command> manager process and its children, and is tracked outside of any session, being shared
247     by all the user's sessions, is not covered by these limits.
248     </para>
249
250     <para> See
251     <citerefentry><refentrytitle>elogind.resource-control</refentrytitle><manvolnum>5</manvolnum></citerefentry> for more information about the resources.
252     Also, see <citerefentry><refentrytitle>pam_set_data</refentrytitle><manvolnum>3</manvolnum></citerefentry> for additional information about how to set
253     the context objects.
254     </para>
255
256     <variablelist>
257       <varlistentry>
258         <term><varname>elogind.memory_max</varname></term>
259
260         <listitem><para>Sets unit <varname>MemoryMax=</varname>.</para></listitem>
261       </varlistentry>
262
263       <varlistentry>
264         <term><varname>elogind.tasks_max</varname></term>
265
266         <listitem><para>Sets unit <varname>TasksMax=</varname>.</para></listitem>
267       </varlistentry>
268
269       <varlistentry>
270         <term><varname>elogind.cpu_weight</varname></term>
271
272         <listitem><para>Sets unit <varname>CPUWeight=</varname>.</para></listitem>
273       </varlistentry>
274
275       <varlistentry>
276         <term><varname>elogind.io_weight</varname></term>
277
278         <listitem><para>Sets unit <varname>IOWeight=</varname>.</para></listitem>
279       </varlistentry>
280     </variablelist>
281
282     <para>Example data as can be provided from an another PAM module:
283       <programlisting>
284 pam_set_data(handle, "elogind.memory_max", (void *)"200M", cleanup);
285 pam_set_data(handle, "elogind.tasks_max",  (void *)"50",   cleanup);
286 pam_set_data(handle, "elogind.cpu_weight", (void *)"100",  cleanup);
287 pam_set_data(handle, "elogind.io_weight",  (void *)"340",  cleanup);
288       </programlisting>
289     </para>
290
291   </refsect1>
292
293   <refsect1>
294     <title>Example</title>
295
296     <programlisting>#%PAM-1.0
297 auth       required     pam_unix.so
298 auth       required     pam_nologin.so
299 account    required     pam_unix.so
300 password   required     pam_unix.so
301 session    required     pam_unix.so
302 session    required     pam_loginuid.so
303 session    required     pam_elogind.so</programlisting>
304   </refsect1>
305
306   <refsect1>
307     <title>See Also</title>
308     <para>
309       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
310       <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
311       <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
312       <citerefentry><refentrytitle>loginctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
313       <citerefentry project='man-pages'><refentrytitle>pam.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
314       <citerefentry project='man-pages'><refentrytitle>pam.d</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
315       <citerefentry project='man-pages'><refentrytitle>pam</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
316       <citerefentry project='man-pages'><refentrytitle>pam_loginuid</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
317       <citerefentry><refentrytitle>systemd.scope</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
318       <citerefentry><refentrytitle>systemd.slice</refentrytitle><manvolnum>5</manvolnum></citerefentry>,
319       <citerefentry><refentrytitle>systemd.service</refentrytitle><manvolnum>5</manvolnum></citerefentry>
320     </para>
321   </refsect1>
322
323 </refentry>