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">
6 SPDX-License-Identifier: LGPL-2.1+
9 <!-- 0 /// elogind does not need to activate loginctl in configure
10 <refentry id="loginctl" conditional='ENABLE_LOGIND'
11 xmlns:xi="http://www.w3.org/2001/XInclude">
13 <refentry id="loginctl" xmlns:xi="http://www.w3.org/2001/XInclude">
17 <title>loginctl</title>
18 <productname>elogind</productname>
22 <contrib>Developer</contrib>
23 <firstname>Lennart</firstname>
24 <surname>Poettering</surname>
25 <email>lennart@poettering.net</email>
31 <refentrytitle>loginctl</refentrytitle>
32 <manvolnum>1</manvolnum>
36 <refname>loginctl</refname>
37 <refpurpose>Control the elogind login manager</refpurpose>
42 <command>loginctl</command>
43 <arg choice="opt" rep="repeat">OPTIONS</arg>
44 <arg choice="req">COMMAND</arg>
45 <arg choice="opt" rep="repeat">NAME</arg>
50 <title>Description</title>
52 <para><command>loginctl</command> may be used to introspect and
53 control the state of the
54 <!-- 0 /// elogind has no services and is in section 8
55 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>
57 <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>.</para>
59 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>
65 <title>Options</title>
67 <para>The following options are understood:</para>
71 <term><option>--no-ask-password</option></term>
73 <listitem><para>Do not query the user for authentication for
74 privileged operations.</para></listitem>
78 <term><option>-p</option></term>
79 <term><option>--property=</option></term>
81 <listitem><para>When showing session/user/seat properties,
82 limit display to certain properties as specified as argument.
83 If not specified, all set properties are shown. The argument
84 should be a property name, such as
85 <literal>Sessions</literal>. If specified more than once, all
86 properties with the specified names are
87 shown.</para></listitem>
91 <term><option>--value</option></term>
93 <listitem><para>When showing session/user/seat properties,
94 only print the value, and skip the property name and
95 <literal>=</literal>.</para></listitem>
99 <term><option>-a</option></term>
100 <term><option>--all</option></term>
102 <listitem><para>When showing session/user/seat properties,
103 show all properties regardless of whether they are set or
104 not.</para></listitem>
108 <term><option>-l</option></term>
109 <term><option>--full</option></term>
111 <listitem><para>Do not ellipsize process tree entries.</para>
116 <term><option>--kill-who=</option></term>
118 <listitem><para>When used with
119 <command>kill-session</command>, choose which processes to
120 kill. Must be one of <option>leader</option>, or
121 <option>all</option> to select whether to kill only the leader
122 process of the session or all processes of the session. If
123 omitted, defaults to <option>all</option>.</para></listitem>
127 <term><option>-s</option></term>
128 <term><option>--signal=</option></term>
130 <listitem><para>When used with <command>kill-session</command>
131 or <command>kill-user</command>, choose which signal to send
132 to selected processes. Must be one of the well known signal
133 specifiers, such as <constant>SIGTERM</constant>,
134 <constant>SIGINT</constant> or <constant>SIGSTOP</constant>.
135 If omitted, defaults to
136 <constant>SIGTERM</constant>.</para></listitem>
139 <!-- 0 /// elogind does not support systemd-journal
141 <term><option>-n</option></term>
142 <term><option>--lines=</option></term>
144 <listitem><para>When used with <command>user-status</command>
145 and <command>session-status</command>, controls the number of
146 journal lines to show, counting from the most recent ones.
147 Takes a positive integer argument. Defaults to 10.</para>
152 <term><option>-o</option></term>
153 <term><option>--output=</option></term>
155 <listitem><para>When used with <command>user-status</command>
156 and <command>session-status</command>, controls the formatting
157 of the journal entries that are shown. For the available
159 <citerefentry><refentrytitle>journalctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>.
160 Defaults to <literal>short</literal>.</para></listitem>
164 <xi:include href="user-system-options.xml" xpointer="host" />
165 <xi:include href="user-system-options.xml" xpointer="machine" />
167 <xi:include href="standard-options.xml" xpointer="no-pager" />
168 <xi:include href="standard-options.xml" xpointer="no-legend" />
169 <xi:include href="standard-options.xml" xpointer="help" />
170 <xi:include href="standard-options.xml" xpointer="version" />
175 <title>Commands</title>
177 <para>The following commands are understood:</para>
179 <refsect2><title>Session Commands</title><variablelist>
182 <term><command>list-sessions</command></term>
184 <listitem><para>List current sessions.</para></listitem>
188 <term><command>session-status</command> <optional><replaceable>ID</replaceable>…</optional></term>
190 <listitem><para>Show terse runtime status information about
191 one or more sessions, followed by the most recent log data
192 from the journal. Takes one or more session identifiers as
193 parameters. If no session identifiers are passed, the status of
194 the caller's session is shown. This function is intended to
195 generate human-readable output. If you are looking for
196 computer-parsable output, use <command>show-session</command>
197 instead.</para></listitem>
201 <term><command>show-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
203 <listitem><para>Show properties of one or more sessions or the
204 manager itself. If no argument is specified, properties of the
205 manager will be shown. If a session ID is specified,
206 properties of the session are shown. By default, empty
207 properties are suppressed. Use <option>--all</option> to show
208 those too. To select specific properties to show, use
209 <option>--property=</option>. This command is intended to be
210 used whenever computer-parsable output is required. Use
211 <command>session-status</command> if you are looking for
212 formatted human-readable output.</para></listitem>
216 <term><command>activate</command> <optional><replaceable>ID</replaceable></optional></term>
218 <listitem><para>Activate a session. This brings a session into
219 the foreground if another session is currently in the
220 foreground on the respective seat. Takes a session identifier
221 as argument. If no argument is specified, the session of the
222 caller is put into foreground.</para></listitem>
226 <term><command>lock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
227 <term><command>unlock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
229 <listitem><para>Activates/deactivates the screen lock on one
230 or more sessions, if the session supports it. Takes one or
231 more session identifiers as arguments. If no argument is
232 specified, the session of the caller is locked/unlocked.
237 <term><command>lock-sessions</command></term>
238 <term><command>unlock-sessions</command></term>
240 <listitem><para>Activates/deactivates the screen lock on all
241 current sessions supporting it. </para></listitem>
245 <term><command>terminate-session</command> <replaceable>ID</replaceable>…</term>
247 <listitem><para>Terminates a session. This kills all processes
248 of the session and deallocates all resources attached to the
249 session. </para></listitem>
253 <term><command>kill-session</command> <replaceable>ID</replaceable>…</term>
255 <listitem><para>Send a signal to one or more processes of the
256 session. Use <option>--kill-who=</option> to select which
257 process to kill. Use <option>--signal=</option> to select the
258 signal to send.</para></listitem>
260 </variablelist></refsect2>
262 <refsect2><title>User Commands</title><variablelist>
264 <term><command>list-users</command></term>
266 <listitem><para>List currently logged in users.
271 <term><command>user-status</command> <optional><replaceable>USER</replaceable>…</optional></term>
273 <listitem><para>Show terse runtime status information about
274 one or more logged in users, followed by the most recent log
275 data from the journal. Takes one or more user names or numeric
276 user IDs as parameters. If no parameters are passed, the status
277 is shown for the user of the session of the caller. This
278 function is intended to generate human-readable output. If you
279 are looking for computer-parsable output, use
280 <command>show-user</command> instead.</para></listitem>
284 <term><command>show-user</command> <optional><replaceable>USER</replaceable>…</optional></term>
286 <listitem><para>Show properties of one or more users or the
287 manager itself. If no argument is specified, properties of the
288 manager will be shown. If a user is specified, properties of
289 the user are shown. By default, empty properties are
290 suppressed. Use <option>--all</option> to show those too. To
291 select specific properties to show, use
292 <option>--property=</option>. This command is intended to be
293 used whenever computer-parsable output is required. Use
294 <command>user-status</command> if you are looking for
295 formatted human-readable output.</para></listitem>
298 <!-- 0 /// elogind does not spawn a user manager. Mask until lingeringin elogind is clarified.
300 <term><command>enable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
301 <term><command>disable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
303 <listitem><para>Enable/disable user lingering for one or more
304 users. If enabled for a specific user, a user manager is
305 spawned for the user at boot and kept around after logouts.
306 This allows users who are not logged in to run long-running
307 services. Takes one or more user names or numeric UIDs as
308 argument. If no argument is specified, enables/disables
309 lingering for the user of the session of the caller.</para>
311 <para>See also <varname>KillUserProcesses=</varname> setting in
312 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
318 <term><command>terminate-user</command> <replaceable>USER</replaceable>…</term>
320 <listitem><para>Terminates all sessions of a user. This kills
321 all processes of all sessions of the user and deallocates all
322 runtime resources attached to the user.</para></listitem>
326 <term><command>kill-user</command> <replaceable>USER</replaceable>…</term>
328 <listitem><para>Send a signal to all processes of a user. Use
329 <option>--signal=</option> to select the signal to send.
332 </variablelist></refsect2>
334 <refsect2><title>Seat Commands</title><variablelist>
336 <term><command>list-seats</command></term>
338 <listitem><para>List currently available seats on the local
339 system.</para></listitem>
343 <term><command>seat-status</command> <optional><replaceable>NAME</replaceable>…</optional></term>
345 <listitem><para>Show terse runtime status information about
346 one or more seats. Takes one or more seat names as parameters.
347 If no seat names are passed the status of the caller's
348 session's seat is shown. This function is intended to generate
349 human-readable output. If you are looking for
350 computer-parsable output, use <command>show-seat</command>
351 instead.</para></listitem>
355 <term><command>show-seat</command> <optional><replaceable>NAME</replaceable>…</optional></term>
357 <listitem><para>Show properties of one or more seats or the
358 manager itself. If no argument is specified, properties of the
359 manager will be shown. If a seat is specified, properties of
360 the seat are shown. By default, empty properties are
361 suppressed. Use <option>--all</option> to show those too. To
362 select specific properties to show, use
363 <option>--property=</option>. This command is intended to be
364 used whenever computer-parsable output is required. Use
365 <command>seat-status</command> if you are looking for
366 formatted human-readable output.</para></listitem>
370 <term><command>attach</command> <replaceable>NAME</replaceable> <replaceable>DEVICE</replaceable>…</term>
372 <listitem><para>Persistently attach one or more devices to a
373 seat. The devices should be specified via device paths in the
374 <filename>/sys</filename> file system. To create a new seat,
375 attach at least one graphics card to a previously unused seat
376 name. Seat names may consist only of a–z, A–Z, 0–9,
377 <literal>-</literal> and <literal>_</literal> and must be
378 prefixed with <literal>seat</literal>. To drop assignment of a
379 device to a specific seat, just reassign it to a different
380 seat, or use <command>flush-devices</command>.
385 <term><command>flush-devices</command></term>
387 <listitem><para>Removes all device assignments previously
388 created with <command>attach</command>. After this call, only
389 automatically generated seats will remain, and all seat
390 hardware is assigned to them.</para></listitem>
394 <term><command>terminate-seat</command> <replaceable>NAME</replaceable>…</term>
396 <listitem><para>Terminates all sessions on a seat. This kills
397 all processes of all sessions on the seat and deallocates all
398 runtime resources attached to them.</para></listitem>
400 </variablelist></refsect2>
402 <!-- 1 /// elogind additionally supports a few systemctl commands. -->
403 <refsect2><title>System Commands</title><variablelist>
405 <term><command>poweroff</command></term>
408 <para>Print a wall message to all users, shut down and
409 power-off the system.</para>
413 <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
416 <para>Print a wall message to all users, shut down and
417 reboot the system.</para>
419 <para>If the optional argument
420 <replaceable>arg</replaceable> is given, it will be passed
421 as the optional argument to the
422 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
423 system call. The value is architecture and firmware
424 specific. As an example, <literal>recovery</literal> might
425 be used to trigger system recovery, and
426 <literal>fota</literal> might be used to trigger a
427 <quote>firmware over the air</quote> update.</para>
432 <term><command>suspend</command></term>
435 <para>Suspend the system.
441 <term><command>hibernate</command></term>
444 <para>Hibernate the system.
450 <term><command>hybrid-sleep</command></term>
453 <para>Hibernate and suspend the system.</para>
456 </variablelist></refsect2>
461 <title>Exit status</title>
463 <para>On success, 0 is returned, a non-zero failure code
468 <title>Examples</title>
471 <title>Querying user status</title>
473 <!-- 0 /// With elogind no Unit and jurnald output is generated
474 <programlisting>$ loginctl user-status
476 Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
479 Unit: user-1005.slice
485 ├─3473 login -- fatima
488 Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
489 session opened for user fatima by LOGIN(uid=0)
490 Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
493 <programlisting>$ loginctl user-status
495 Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
498 Unit: user-1005.slice
502 <para>There are two sessions, 3 and 5. Session 3 is a graphical session,
503 marked with a star. The tree of processing including the two corresponding
504 scope units and the user manager unit are shown.</para>
508 <xi:include href="less-variables.xml" />
511 <title>See Also</title>
513 <!-- 0 /// elogind is in section 8
514 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
515 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
516 <citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
518 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
520 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>