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