1:255.16-alt1
[systemd_ALT.git] / man / loginctl.xml
blobbf489a28506ef47b3ff3e500ea50e70a5ca98db6
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.2/docbookx.dtd">
4 <!-- SPDX-License-Identifier: LGPL-2.1-or-later -->
6 <refentry id="loginctl" conditional='ENABLE_LOGIND'
7     xmlns:xi="http://www.w3.org/2001/XInclude">
9   <refentryinfo>
10     <title>loginctl</title>
11     <productname>systemd</productname>
12   </refentryinfo>
14   <refmeta>
15     <refentrytitle>loginctl</refentrytitle>
16     <manvolnum>1</manvolnum>
17   </refmeta>
19   <refnamediv>
20     <refname>loginctl</refname>
21     <refpurpose>Control the systemd login manager</refpurpose>
22   </refnamediv>
24   <refsynopsisdiv>
25     <cmdsynopsis>
26       <command>loginctl</command>
27       <arg choice="opt" rep="repeat">OPTIONS</arg>
28       <arg choice="req">COMMAND</arg>
29       <arg choice="opt" rep="repeat">NAME</arg>
30     </cmdsynopsis>
31   </refsynopsisdiv>
33   <refsect1>
34     <title>Description</title>
36     <para><command>loginctl</command> may be used to introspect and
37     control the state of the
38     <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
39     login manager
40     <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
41   </refsect1>
43   <refsect1>
44     <title>Commands</title>
46     <para>The following commands are understood:</para>
48     <refsect2><title>Session Commands</title><variablelist>
50       <varlistentry>
51         <term><command>list-sessions</command></term>
53         <listitem><para>List current sessions.</para></listitem>
54       </varlistentry>
56       <varlistentry>
57         <term><command>session-status</command> <optional><replaceable>ID</replaceable>…</optional></term>
59         <listitem><para>Show terse runtime status information about
60         one or more sessions, followed by the most recent log data
61         from the journal. Takes one or more session identifiers as
62         parameters. If no session identifiers are passed, the status of
63         the caller's session is shown. This function is intended to
64         generate human-readable output. If you are looking for
65         computer-parsable output, use <command>show-session</command>
66         instead.</para>
68         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
69       </varlistentry>
71       <varlistentry>
72         <term><command>show-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
74         <listitem><para>Show properties of one or more sessions or the manager itself. If no argument is
75         specified, properties of the manager will be shown. If a session ID is specified, properties of
76         the session are shown. Specially, if the given ID is <literal>self</literal>, the session to which
77         the <command>loginctl</command> process belongs is used. If <literal>auto</literal>, the current
78         session is used as with <literal>self</literal> if exists, and falls back to the current user's
79         graphical session. By default, empty properties are suppressed. Use <option>--all</option> to show
80         those too. To select specific properties to show, use <option>--property=</option>. This command
81         is intended to be used whenever computer-parsable output is required. Use <command>session-status</command>
82         if you are looking for formatted human-readable output.</para>
84         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
85       </varlistentry>
87       <varlistentry>
88         <term><command>activate</command> <optional><replaceable>ID</replaceable></optional></term>
90         <listitem><para>Activate a session. This brings a session into
91         the foreground if another session is currently in the
92         foreground on the respective seat. Takes a session identifier
93         as argument. If no argument is specified, the session of the
94         caller is put into foreground.</para>
96         <xi:include href="version-info.xml" xpointer="v219"/></listitem>
97       </varlistentry>
99       <varlistentry>
100         <term><command>lock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
101         <term><command>unlock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
103         <listitem><para>Activates/deactivates the screen lock on one
104         or more sessions, if the session supports it. Takes one or
105         more session identifiers as arguments. If no argument is
106         specified, the session of the caller is locked/unlocked.
107         </para>
109         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
110       </varlistentry>
112       <varlistentry>
113         <term><command>lock-sessions</command></term>
114         <term><command>unlock-sessions</command></term>
116         <listitem><para>Activates/deactivates the screen lock on all
117         current sessions supporting it. </para>
119         <xi:include href="version-info.xml" xpointer="v188"/></listitem>
120       </varlistentry>
122       <varlistentry>
123         <term><command>terminate-session</command> <replaceable>ID</replaceable>…</term>
125         <listitem><para>Terminates a session. This kills all processes of the session and deallocates all
126         resources attached to the session. If the argument is specified as empty string the session invoking
127         the command is terminated.</para>
129         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
130       </varlistentry>
132       <varlistentry>
133         <term><command>kill-session</command> <replaceable>ID</replaceable>…</term>
135         <listitem><para>Send a signal to one or more processes of the session. Use
136         <option>--kill-whom=</option> to select which process to kill. Use <option>--signal=</option> to
137         select the signal to send. If the argument is specified as empty string the signal is sent to the
138         session invoking the command.</para>
140         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
141       </varlistentry>
142     </variablelist></refsect2>
144     <refsect2><title>User Commands</title><variablelist>
145       <varlistentry>
146         <term><command>list-users</command></term>
148         <listitem><para>List currently logged in users.
149         </para></listitem>
150       </varlistentry>
152       <varlistentry>
153         <term><command>user-status</command> <optional><replaceable>USER</replaceable>…</optional></term>
155         <listitem><para>Show terse runtime status information about
156         one or more logged in users, followed by the most recent log
157         data from the journal. Takes one or more user names or numeric
158         user IDs as parameters. If no parameters are passed, the status
159         is shown for the user of the session of the caller. This
160         function is intended to generate human-readable output. If you
161         are looking for computer-parsable output, use
162         <command>show-user</command> instead.</para>
164         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
165       </varlistentry>
167       <varlistentry>
168         <term><command>show-user</command> <optional><replaceable>USER</replaceable>…</optional></term>
170         <listitem><para>Show properties of one or more users or the
171         manager itself. If no argument is specified, properties of the
172         manager will be shown. If a user is specified, properties of
173         the user are shown. By default, empty properties are
174         suppressed. Use <option>--all</option> to show those too. To
175         select specific properties to show, use
176         <option>--property=</option>. This command is intended to be
177         used whenever computer-parsable output is required. Use
178         <command>user-status</command> if you are looking for
179         formatted human-readable output.</para>
181         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
182       </varlistentry>
184       <varlistentry>
185         <term><command>enable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
186         <term><command>disable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
188         <listitem><para>Enable/disable user lingering for one or more
189         users. If enabled for a specific user, a user manager is
190         spawned for the user at boot and kept around after logouts.
191         This allows users who are not logged in to run long-running
192         services. Takes one or more user names or numeric UIDs as
193         argument. If no argument is specified, enables/disables
194         lingering for the user of the session of the caller.</para>
196         <para>See also <varname>KillUserProcesses=</varname> setting in
197         <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
198         </para>
200         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
201       </varlistentry>
203       <varlistentry>
204         <term><command>terminate-user</command> <replaceable>USER</replaceable>…</term>
206         <listitem><para>Terminates all sessions of a user. This kills all processes of all sessions of the
207         user and deallocates all runtime resources attached to the user. If the argument is specified as
208         empty string the sessions of the user invoking the command are terminated.</para>
210         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
211       </varlistentry>
213       <varlistentry>
214         <term><command>kill-user</command> <replaceable>USER</replaceable>…</term>
216         <listitem><para>Send a signal to all processes of a user. Use <option>--signal=</option> to select
217         the signal to send. If the argument is specified as empty string the signal is sent to the sessions
218         of the user invoking the command.</para>
220         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
221       </varlistentry>
222     </variablelist></refsect2>
224     <refsect2><title>Seat Commands</title><variablelist>
225       <varlistentry>
226         <term><command>list-seats</command></term>
228         <listitem><para>List currently available seats on the local
229         system.</para></listitem>
230       </varlistentry>
232       <varlistentry>
233         <term><command>seat-status</command> <optional><replaceable>NAME</replaceable>…</optional></term>
235         <listitem><para>Show terse runtime status information about
236         one or more seats. Takes one or more seat names as parameters.
237         If no seat names are passed the status of the caller's
238         session's seat is shown. This function is intended to generate
239         human-readable output. If you are looking for
240         computer-parsable output, use <command>show-seat</command>
241         instead.</para>
243         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
244       </varlistentry>
246       <varlistentry>
247         <term><command>show-seat</command> <optional><replaceable>NAME</replaceable>…</optional></term>
249         <listitem><para>Show properties of one or more seats or the
250         manager itself. If no argument is specified, properties of the
251         manager will be shown. If a seat is specified, properties of
252         the seat are shown. By default, empty properties are
253         suppressed. Use <option>--all</option> to show those too. To
254         select specific properties to show, use
255         <option>--property=</option>. This command is intended to be
256         used whenever computer-parsable output is required. Use
257         <command>seat-status</command> if you are looking for
258         formatted human-readable output.</para>
260         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
261       </varlistentry>
263       <varlistentry>
264         <term><command>attach</command> <replaceable>NAME</replaceable> <replaceable>DEVICE</replaceable>…</term>
266         <listitem><para>Persistently attach one or more devices to a
267         seat. The devices should be specified via device paths in the
268         <filename>/sys/</filename> file system. To create a new seat,
269         attach at least one graphics card to a previously unused seat
270         name. Seat names may consist only of a–z, A–Z, 0–9,
271         <literal>-</literal> and <literal>_</literal> and must be
272         prefixed with <literal>seat</literal>. To drop assignment of a
273         device to a specific seat, just reassign it to a different
274         seat, or use <command>flush-devices</command>.
275         </para>
277         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
278       </varlistentry>
280       <varlistentry>
281         <term><command>flush-devices</command></term>
283         <listitem><para>Removes all device assignments previously
284         created with <command>attach</command>. After this call, only
285         automatically generated seats will remain, and all seat
286         hardware is assigned to them.</para></listitem>
287       </varlistentry>
289       <varlistentry>
290         <term><command>terminate-seat</command> <replaceable>NAME</replaceable>…</term>
292         <listitem><para>Terminates all sessions on a seat. This kills
293         all processes of all sessions on the seat and deallocates all
294         runtime resources attached to them.</para>
296         <xi:include href="version-info.xml" xpointer="v233"/></listitem>
297       </varlistentry>
298     </variablelist></refsect2>
300   </refsect1>
302   <refsect1>
303     <title>Options</title>
305     <para>The following options are understood:</para>
307     <variablelist>
308       <varlistentry>
309         <term><option>--no-ask-password</option></term>
311         <listitem><para>Do not query the user for authentication for
312         privileged operations.</para></listitem>
313       </varlistentry>
315       <varlistentry>
316         <term><option>-p</option></term>
317         <term><option>--property=</option></term>
319         <listitem><para>When showing session/user/seat properties,
320         limit display to certain properties as specified as argument.
321         If not specified, all set properties are shown. The argument
322         should be a property name, such as
323         <literal>Sessions</literal>. If specified more than once, all
324         properties with the specified names are
325         shown.</para></listitem>
326       </varlistentry>
328       <varlistentry>
329         <term><option>--value</option></term>
331         <listitem><para>When showing session/user/seat properties,
332         only print the value, and skip the property name and
333         <literal>=</literal>.</para>
335         <xi:include href="version-info.xml" xpointer="v230"/></listitem>
336       </varlistentry>
338       <varlistentry>
339         <term><option>-a</option></term>
340         <term><option>--all</option></term>
342         <listitem><para>When showing session/user/seat properties,
343         show all properties regardless of whether they are set or
344         not.</para></listitem>
345       </varlistentry>
347       <varlistentry>
348         <term><option>-l</option></term>
349         <term><option>--full</option></term>
351         <listitem><para>Do not ellipsize process tree entries.</para>
353         <xi:include href="version-info.xml" xpointer="v198"/>
354         </listitem>
355       </varlistentry>
357       <varlistentry>
358         <term><option>--kill-whom=</option></term>
360         <listitem><para>When used with <command>kill-session</command>, choose which processes to kill.
361         Takes one of <literal>leader</literal> or <literal>all</literal>, to select whether to kill only
362         the leader process of the session or all processes of the session. If omitted, defaults to
363         <option>all</option>.</para>
365         <xi:include href="version-info.xml" xpointer="v252"/></listitem>
366       </varlistentry>
368       <varlistentry>
369         <term><option>-s</option></term>
370         <term><option>--signal=</option></term>
372         <listitem><para>When used with <command>kill-session</command> or <command>kill-user</command>,
373         choose which signal to send to selected processes. Must be one of the well known signal specifiers,
374         such as <constant>SIGTERM</constant>, <constant>SIGINT</constant> or <constant>SIGSTOP</constant>.
375         If omitted, defaults to <constant>SIGTERM</constant>.</para>
377         <para>The special value <literal>help</literal> will list the known values and the program will exit
378         immediately, and the special value <literal>list</literal> will list known values along with the
379         numerical signal numbers and the program will exit immediately.</para></listitem>
380       </varlistentry>
382       <varlistentry>
383         <term><option>-n</option></term>
384         <term><option>--lines=</option></term>
386         <listitem><para>When used with <command>user-status</command>
387         and <command>session-status</command>, controls the number of
388         journal lines to show, counting from the most recent ones.
389         Takes a positive integer argument. Defaults to 10.</para>
391         <xi:include href="version-info.xml" xpointer="v219"/>
392         </listitem>
393       </varlistentry>
395       <varlistentry>
396         <term><option>-o</option></term>
397         <term><option>--output=</option></term>
399         <listitem><para>When used with <command>user-status</command>
400         and <command>session-status</command>, controls the formatting
401         of the journal entries that are shown. For the available
402         choices, see
403         <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
404         Defaults to <literal>short</literal>.</para>
406         <xi:include href="version-info.xml" xpointer="v219"/></listitem>
407       </varlistentry>
409       <xi:include href="user-system-options.xml" xpointer="host" />
410       <xi:include href="user-system-options.xml" xpointer="machine" />
412       <xi:include href="standard-options.xml" xpointer="no-pager" />
413       <xi:include href="standard-options.xml" xpointer="no-legend" />
414       <xi:include href="standard-options.xml" xpointer="help" />
415       <xi:include href="standard-options.xml" xpointer="version" />
416     </variablelist>
417   </refsect1>
419   <refsect1>
420     <title>Exit status</title>
422     <para>On success, 0 is returned, a non-zero failure code
423     otherwise.</para>
424   </refsect1>
426   <refsect1>
427     <title>Examples</title>
429     <example>
430       <title>Querying user status</title>
432       <programlisting>$ loginctl user-status
433 fatima (1005)
434            Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
435            State: active
436         Sessions: 5 *3
437             Unit: user-1005.slice
438                   ├─user@1005.service
439                     …
440                   ├─session-3.scope
441                     …
442                   └─session-5.scope
443                     ├─3473 login -- fatima
444                     └─3515 -zsh
446 Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
447                        session opened for user fatima by LOGIN(uid=0)
448 Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
449 </programlisting>
451       <para>There are two sessions, 3 and 5. Session 3 is a graphical session,
452       marked with a star. The tree of processing including the two corresponding
453       scope units and the user manager unit are shown.</para>
454     </example>
455   </refsect1>
457   <xi:include href="common-variables.xml" />
459   <refsect1>
460     <title>See Also</title>
461     <para>
462       <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
463       <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
464       <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
465       <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>
466     </para>
467   </refsect1>
469 </refentry>