chiark / gitweb /
73205a50417721563f31ebaa8039b0bb64b19626
[elogind.git] / man / loginctl.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   Copyright 2010 Lennart Poettering
9 -->
10
11 <!-- 0 /// elogind does not need to activate loginctl in configure
12 <refentry id="loginctl" conditional='ENABLE_LOGIND'
13     xmlns:xi="http://www.w3.org/2001/XInclude">
14 else -->
15 <refentry id="loginctl" xmlns:xi="http://www.w3.org/2001/XInclude">
16 <!-- // 0 -->
17
18   <refentryinfo>
19     <title>loginctl</title>
20     <productname>elogind</productname>
21
22     <authorgroup>
23       <author>
24         <contrib>Developer</contrib>
25         <firstname>Lennart</firstname>
26         <surname>Poettering</surname>
27         <email>lennart@poettering.net</email>
28       </author>
29     </authorgroup>
30   </refentryinfo>
31
32   <refmeta>
33     <refentrytitle>loginctl</refentrytitle>
34     <manvolnum>1</manvolnum>
35   </refmeta>
36
37   <refnamediv>
38     <refname>loginctl</refname>
39     <refpurpose>Control the elogind login manager</refpurpose>
40   </refnamediv>
41
42   <refsynopsisdiv>
43     <cmdsynopsis>
44       <command>loginctl</command>
45       <arg choice="opt" rep="repeat">OPTIONS</arg>
46       <arg choice="req">COMMAND</arg>
47       <arg choice="opt" rep="repeat">NAME</arg>
48     </cmdsynopsis>
49   </refsynopsisdiv>
50
51   <refsect1>
52     <title>Description</title>
53
54     <para><command>loginctl</command> may be used to introspect and
55     control the state of the
56     <!-- 0 /// elogind has no services and is in section 8
57     <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
58     login manager
59     <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
60     --><!-- else -->
61     <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>
62     login manager</para>
63     <!-- // 0 -->
64   </refsect1>
65
66   <refsect1>
67     <title>Options</title>
68
69     <para>The following options are understood:</para>
70
71     <variablelist>
72       <varlistentry>
73         <term><option>--no-ask-password</option></term>
74
75         <listitem><para>Do not query the user for authentication for
76         privileged operations.</para></listitem>
77       </varlistentry>
78
79       <varlistentry>
80         <term><option>-p</option></term>
81         <term><option>--property=</option></term>
82
83         <listitem><para>When showing session/user/seat properties,
84         limit display to certain properties as specified as argument.
85         If not specified, all set properties are shown. The argument
86         should be a property name, such as
87         <literal>Sessions</literal>. If specified more than once, all
88         properties with the specified names are
89         shown.</para></listitem>
90       </varlistentry>
91
92       <varlistentry>
93         <term><option>--value</option></term>
94
95         <listitem><para>When showing session/user/seat properties,
96         only print the value, and skip the property name and
97         <literal>=</literal>.</para></listitem>
98       </varlistentry>
99
100       <varlistentry>
101         <term><option>-a</option></term>
102         <term><option>--all</option></term>
103
104         <listitem><para>When showing session/user/seat properties,
105         show all properties regardless of whether they are set or
106         not.</para></listitem>
107       </varlistentry>
108
109       <varlistentry>
110         <term><option>-l</option></term>
111         <term><option>--full</option></term>
112
113         <listitem><para>Do not ellipsize process tree entries.</para>
114         </listitem>
115       </varlistentry>
116
117       <varlistentry>
118         <term><option>--kill-who=</option></term>
119
120         <listitem><para>When used with
121         <command>kill-session</command>, choose which processes to
122         kill. Must be one of <option>leader</option>, or
123         <option>all</option> to select whether to kill only the leader
124         process of the session or all processes of the session. If
125         omitted, defaults to <option>all</option>.</para></listitem>
126       </varlistentry>
127
128       <varlistentry>
129         <term><option>-s</option></term>
130         <term><option>--signal=</option></term>
131
132         <listitem><para>When used with <command>kill-session</command>
133         or <command>kill-user</command>, choose which signal to send
134         to selected processes. Must be one of the well known signal
135         specifiers, such as <constant>SIGTERM</constant>,
136         <constant>SIGINT</constant> or <constant>SIGSTOP</constant>.
137         If omitted, defaults to
138         <constant>SIGTERM</constant>.</para></listitem>
139       </varlistentry>
140
141       <!-- 0 /// elogind does not support systemd-journal
142       <varlistentry>
143         <term><option>-n</option></term>
144         <term><option>&#x2D;&#x2D;lines=</option></term>
145
146         <listitem><para>When used with <command>user-status</command>
147         and <command>session-status</command>, controls the number of
148         journal lines to show, counting from the most recent ones.
149         Takes a positive integer argument. Defaults to 10.</para>
150         </listitem>
151       </varlistentry>
152
153       <varlistentry>
154         <term><option>-o</option></term>
155         <term><option>&#x2D;&#x2D;output=</option></term>
156
157         <listitem><para>When used with <command>user-status</command>
158         and <command>session-status</command>, controls the formatting
159         of the journal entries that are shown. For the available
160         choices, see
161         <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
162         Defaults to <literal>short</literal>.</para></listitem>
163       </varlistentry>
164       // 0 -->
165
166       <xi:include href="user-system-options.xml" xpointer="host" />
167       <xi:include href="user-system-options.xml" xpointer="machine" />
168
169       <xi:include href="standard-options.xml" xpointer="no-pager" />
170       <xi:include href="standard-options.xml" xpointer="no-legend" />
171       <xi:include href="standard-options.xml" xpointer="help" />
172       <xi:include href="standard-options.xml" xpointer="version" />
173     </variablelist>
174   </refsect1>
175
176   <refsect1>
177     <title>Commands</title>
178
179     <para>The following commands are understood:</para>
180
181     <refsect2><title>Session Commands</title><variablelist>
182
183       <varlistentry>
184         <term><command>list-sessions</command></term>
185
186         <listitem><para>List current sessions.</para></listitem>
187       </varlistentry>
188
189       <varlistentry>
190         <term><command>session-status</command> <optional><replaceable>ID</replaceable>…</optional></term>
191
192         <listitem><para>Show terse runtime status information about
193         one or more sessions, followed by the most recent log data
194         from the journal. Takes one or more session identifiers as
195         parameters. If no session identifiers are passed, the status of
196         the caller's session is shown. This function is intended to
197         generate human-readable output. If you are looking for
198         computer-parsable output, use <command>show-session</command>
199         instead.</para></listitem>
200       </varlistentry>
201
202       <varlistentry>
203         <term><command>show-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
204
205         <listitem><para>Show properties of one or more sessions or the
206         manager itself. If no argument is specified, properties of the
207         manager will be shown. If a session ID is specified,
208         properties of the session are shown. By default, empty
209         properties are suppressed. Use <option>--all</option> to show
210         those too. To select specific properties to show, use
211         <option>--property=</option>. This command is intended to be
212         used whenever computer-parsable output is required. Use
213         <command>session-status</command> if you are looking for
214         formatted human-readable output.</para></listitem>
215       </varlistentry>
216
217       <varlistentry>
218         <term><command>activate</command> <optional><replaceable>ID</replaceable></optional></term>
219
220         <listitem><para>Activate a session. This brings a session into
221         the foreground if another session is currently in the
222         foreground on the respective seat. Takes a session identifier
223         as argument. If no argument is specified, the session of the
224         caller is put into foreground.</para></listitem>
225       </varlistentry>
226
227       <varlistentry>
228         <term><command>lock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
229         <term><command>unlock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
230
231         <listitem><para>Activates/deactivates the screen lock on one
232         or more sessions, if the session supports it. Takes one or
233         more session identifiers as arguments. If no argument is
234         specified, the session of the caller is locked/unlocked.
235         </para></listitem>
236       </varlistentry>
237
238       <varlistentry>
239         <term><command>lock-sessions</command></term>
240         <term><command>unlock-sessions</command></term>
241
242         <listitem><para>Activates/deactivates the screen lock on all
243         current sessions supporting it. </para></listitem>
244       </varlistentry>
245
246       <varlistentry>
247         <term><command>terminate-session</command> <replaceable>ID</replaceable>…</term>
248
249         <listitem><para>Terminates a session. This kills all processes
250         of the session and deallocates all resources attached to the
251         session. </para></listitem>
252       </varlistentry>
253
254       <varlistentry>
255         <term><command>kill-session</command> <replaceable>ID</replaceable>…</term>
256
257         <listitem><para>Send a signal to one or more processes of the
258         session. Use <option>--kill-who=</option> to select which
259         process to kill. Use <option>--signal=</option> to select the
260         signal to send.</para></listitem>
261       </varlistentry>
262     </variablelist></refsect2>
263
264     <refsect2><title>User Commands</title><variablelist>
265       <varlistentry>
266         <term><command>list-users</command></term>
267
268         <listitem><para>List currently logged in users.
269         </para></listitem>
270       </varlistentry>
271
272       <varlistentry>
273         <term><command>user-status</command> <optional><replaceable>USER</replaceable>…</optional></term>
274
275         <listitem><para>Show terse runtime status information about
276         one or more logged in users, followed by the most recent log
277         data from the journal. Takes one or more user names or numeric
278         user IDs as parameters. If no parameters are passed, the status
279         is shown for the user of the session of the caller. This
280         function is intended to generate human-readable output. If you
281         are looking for computer-parsable output, use
282         <command>show-user</command> instead.</para></listitem>
283       </varlistentry>
284
285       <varlistentry>
286         <term><command>show-user</command> <optional><replaceable>USER</replaceable>…</optional></term>
287
288         <listitem><para>Show properties of one or more users or the
289         manager itself. If no argument is specified, properties of the
290         manager will be shown. If a user is specified, properties of
291         the user are shown. By default, empty properties are
292         suppressed. Use <option>--all</option> to show those too. To
293         select specific properties to show, use
294         <option>--property=</option>. This command is intended to be
295         used whenever computer-parsable output is required. Use
296         <command>user-status</command> if you are looking for
297         formatted human-readable output.</para></listitem>
298       </varlistentry>
299
300       <!-- 0 /// elogind does not spawn a user manager. Mask until lingeringin elogind is clarified.
301       <varlistentry>
302         <term><command>enable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
303         <term><command>disable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
304
305         <listitem><para>Enable/disable user lingering for one or more
306         users. If enabled for a specific user, a user manager is
307         spawned for the user at boot and kept around after logouts.
308         This allows users who are not logged in to run long-running
309         services. Takes one or more user names or numeric UIDs as
310         argument. If no argument is specified, enables/disables
311         lingering for the user of the session of the caller.</para>
312
313         <para>See also <varname>KillUserProcesses=</varname> setting in
314         <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
315         </para></listitem>
316       </varlistentry>
317       // 0 -->
318
319       <varlistentry>
320         <term><command>terminate-user</command> <replaceable>USER</replaceable>…</term>
321
322         <listitem><para>Terminates all sessions of a user. This kills
323         all processes of all sessions of the user and deallocates all
324         runtime resources attached to the user.</para></listitem>
325       </varlistentry>
326
327       <varlistentry>
328         <term><command>kill-user</command> <replaceable>USER</replaceable>…</term>
329
330         <listitem><para>Send a signal to all processes of a user. Use
331         <option>--signal=</option> to select the signal to send.
332         </para></listitem>
333       </varlistentry>
334     </variablelist></refsect2>
335
336     <refsect2><title>Seat Commands</title><variablelist>
337       <varlistentry>
338         <term><command>list-seats</command></term>
339
340         <listitem><para>List currently available seats on the local
341         system.</para></listitem>
342       </varlistentry>
343
344       <varlistentry>
345         <term><command>seat-status</command> <optional><replaceable>NAME</replaceable>…</optional></term>
346
347         <listitem><para>Show terse runtime status information about
348         one or more seats. Takes one or more seat names as parameters.
349         If no seat names are passed the status of the caller's
350         session's seat is shown. This function is intended to generate
351         human-readable output. If you are looking for
352         computer-parsable output, use <command>show-seat</command>
353         instead.</para></listitem>
354       </varlistentry>
355
356       <varlistentry>
357         <term><command>show-seat</command> <optional><replaceable>NAME</replaceable>…</optional></term>
358
359         <listitem><para>Show properties of one or more seats or the
360         manager itself. If no argument is specified, properties of the
361         manager will be shown. If a seat is specified, properties of
362         the seat are shown. By default, empty properties are
363         suppressed. Use <option>--all</option> to show those too. To
364         select specific properties to show, use
365         <option>--property=</option>. This command is intended to be
366         used whenever computer-parsable output is required. Use
367         <command>seat-status</command> if you are looking for
368         formatted human-readable output.</para></listitem>
369       </varlistentry>
370
371       <varlistentry>
372         <term><command>attach</command> <replaceable>NAME</replaceable> <replaceable>DEVICE</replaceable>…</term>
373
374         <listitem><para>Persistently attach one or more devices to a
375         seat. The devices should be specified via device paths in the
376         <filename>/sys</filename> file system. To create a new seat,
377         attach at least one graphics card to a previously unused seat
378         name. Seat names may consist only of a–z, A–Z, 0–9,
379         <literal>-</literal> and <literal>_</literal> and must be
380         prefixed with <literal>seat</literal>. To drop assignment of a
381         device to a specific seat, just reassign it to a different
382         seat, or use <command>flush-devices</command>.
383         </para></listitem>
384       </varlistentry>
385
386       <varlistentry>
387         <term><command>flush-devices</command></term>
388
389         <listitem><para>Removes all device assignments previously
390         created with <command>attach</command>. After this call, only
391         automatically generated seats will remain, and all seat
392         hardware is assigned to them.</para></listitem>
393       </varlistentry>
394
395       <varlistentry>
396         <term><command>terminate-seat</command> <replaceable>NAME</replaceable>…</term>
397
398         <listitem><para>Terminates all sessions on a seat. This kills
399         all processes of all sessions on the seat and deallocates all
400         runtime resources attached to them.</para></listitem>
401       </varlistentry>
402     </variablelist></refsect2>
403
404     <!-- 1 /// elogind additionally supports a few systemctl commands. -->
405     <refsect2><title>System Commands</title><variablelist>
406       <varlistentry>
407         <term><command>poweroff</command></term>
408
409         <listitem>
410           <para>Print a wall message to all users, shut down and
411             power-off the system.</para>
412         </listitem>
413       </varlistentry>
414       <varlistentry>
415         <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
416
417         <listitem>
418           <para>Print a wall message to all users, shut down and
419             reboot the system.</para>
420
421           <para>If the optional argument
422           <replaceable>arg</replaceable> is given, it will be passed
423           as the optional argument to the
424           <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
425           system call. The value is architecture and firmware
426           specific. As an example, <literal>recovery</literal> might
427           be used to trigger system recovery, and
428           <literal>fota</literal> might be used to trigger a
429           <quote>firmware over the air</quote> update.</para>
430         </listitem>
431       </varlistentry>
432
433       <varlistentry>
434         <term><command>suspend</command></term>
435
436         <listitem>
437           <para>Suspend the system.
438           </para>
439         </listitem>
440       </varlistentry>
441
442       <varlistentry>
443         <term><command>hibernate</command></term>
444
445         <listitem>
446           <para>Hibernate the system.
447           </para>
448         </listitem>
449       </varlistentry>
450
451       <varlistentry>
452         <term><command>hybrid-sleep</command></term>
453
454         <listitem>
455           <para>Hibernate and suspend the system.</para>
456         </listitem>
457       </varlistentry>
458     </variablelist></refsect2>
459     <!-- // 1 -->
460   </refsect1>
461
462   <refsect1>
463     <title>Exit status</title>
464
465     <para>On success, 0 is returned, a non-zero failure code
466     otherwise.</para>
467   </refsect1>
468
469   <refsect1>
470     <title>Examples</title>
471
472     <example>
473       <title>Querying user status</title>
474
475       <!-- 0 /// With elogind no Unit and jurnald output is generated
476       <programlisting>$ loginctl user-status
477 fatima (1005)
478            Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
479            State: active
480         Sessions: 5 *3
481             Unit: user-1005.slice
482                   ├─user@1005.service
483                     …
484                   ├─session-3.scope
485                     …
486                   └─session-5.scope
487                     ├─3473 login &#x2D;&#x2D; fatima
488                     └─3515 -zsh
489
490 Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
491                        session opened for user fatima by LOGIN(uid=0)
492 Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
493 </programlisting>
494       --><!-- else -->
495       <programlisting>$ loginctl user-status
496 fatima (1005)
497            Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
498            State: active
499         Sessions: 5 *3
500             Unit: user-1005.slice
501 </programlisting>
502       <!-- // 0 -->
503
504       <para>There are two sessions, 3 and 5. Session 3 is a graphical session,
505       marked with a star. The tree of processing including the two corresponding
506       scope units and the user manager unit are shown.</para>
507     </example>
508   </refsect1>
509
510   <xi:include href="less-variables.xml" />
511
512   <refsect1>
513     <title>See Also</title>
514     <para>
515       <!-- 0 /// elogind is in section 8
516       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
517       <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
518       <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
519       --><!-- else -->
520       <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
521       <!-- // 0 -->
522       <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
523     </para>
524   </refsect1>
525
526 </refentry>