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 This file is part of elogind.
8 Copyright 2010 Lennart Poettering
10 elogind is free software; you can redistribute it and/or modify it
11 under the terms of the GNU Lesser General Public License as published by
12 the Free Software Foundation; either version 2.1 of the License, or
13 (at your option) any later version.
15 elogind is distributed in the hope that it will be useful, but
16 WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 Lesser General Public License for more details.
20 You should have received a copy of the GNU Lesser General Public License
21 along with elogind; If not, see <http://www.gnu.org/licenses/>.
24 <refentry id="loginctl"
25 xmlns:xi="http://www.w3.org/2001/XInclude">
28 <title>loginctl</title>
29 <productname>elogind</productname>
33 <contrib>Developer</contrib>
34 <firstname>Lennart</firstname>
35 <surname>Poettering</surname>
36 <email>lennart@poettering.net</email>
42 <refentrytitle>loginctl</refentrytitle>
43 <manvolnum>1</manvolnum>
47 <refname>loginctl</refname>
48 <refpurpose>Control the elogind login manager</refpurpose>
53 <command>loginctl</command>
54 <arg choice="opt" rep="repeat">OPTIONS</arg>
55 <arg choice="req">COMMAND</arg>
56 <arg choice="opt" rep="repeat">NAME</arg>
61 <title>Description</title>
63 <para><command>loginctl</command> may be used to introspect and
64 control the state of the
65 <citerefentry><refentrytitle>systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
70 <title>Options</title>
72 <para>The following options are understood:</para>
76 <term><option>--no-ask-password</option></term>
78 <listitem><para>Do not query the user for authentication for
79 privileged operations.</para></listitem>
83 <term><option>-p</option></term>
84 <term><option>--property=</option></term>
86 <listitem><para>When showing session/user/seat properties,
87 limit display to certain properties as specified as argument.
88 If not specified, all set properties are shown. The argument
89 should be a property name, such as
90 <literal>Sessions</literal>. If specified more than once, all
91 properties with the specified names are
92 shown.</para></listitem>
96 <term><option>--value</option></term>
99 <para>When printing properties with <command>show</command>,
100 only print the value, and skip the property name and
101 <literal>=</literal>.</para>
106 <term><option>-a</option></term>
107 <term><option>--all</option></term>
109 <listitem><para>When showing session/user/seat properties,
110 show all properties regardless of whether they are set or
111 not.</para></listitem>
115 <term><option>-l</option></term>
116 <term><option>--full</option></term>
118 <listitem><para>Do not ellipsize process tree entries.</para>
123 <term><option>--kill-who=</option></term>
125 <listitem><para>When used with
126 <command>kill-session</command>, choose which processes to
127 kill. Must be one of <option>leader</option>, or
128 <option>all</option> to select whether to kill only the leader
129 process of the session or all processes of the session. If
130 omitted, defaults to <option>all</option>.</para></listitem>
134 <term><option>-s</option></term>
135 <term><option>--signal=</option></term>
137 <listitem><para>When used with <command>kill-session</command>
138 or <command>kill-user</command>, choose which signal to send
139 to selected processes. Must be one of the well known signal
140 specifiers, such as <constant>SIGTERM</constant>,
141 <constant>SIGINT</constant> or <constant>SIGSTOP</constant>.
142 If omitted, defaults to
143 <constant>SIGTERM</constant>.</para></listitem>
146 <xi:include href="user-system-options.xml" xpointer="host" />
147 <xi:include href="user-system-options.xml" xpointer="machine" />
149 <xi:include href="standard-options.xml" xpointer="no-pager" />
150 <xi:include href="standard-options.xml" xpointer="no-legend" />
151 <xi:include href="standard-options.xml" xpointer="help" />
152 <xi:include href="standard-options.xml" xpointer="version" />
157 <title>Commands</title>
159 <para>The following commands are understood:</para>
161 <refsect2><title>Session Commands</title><variablelist>
164 <term><command>list-sessions</command></term>
166 <listitem><para>List current sessions.</para></listitem>
170 <term><command>session-status</command> <optional><replaceable>ID</replaceable>…</optional></term>
172 <listitem><para>Show terse runtime status information about
173 one or more sessions, followed by the most recent log data
174 from the journal. Takes one or more session identifiers as
175 parameters. If no session identifiers are passed, the status of
176 the caller's session is shown. This function is intended to
177 generate human-readable output. If you are looking for
178 computer-parsable output, use <command>show-session</command>
179 instead.</para></listitem>
183 <term><command>show-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
185 <listitem><para>Show properties of one or more sessions or the
186 manager itself. If no argument is specified, properties of the
187 manager will be shown. If a session ID is specified,
188 properties of the session are shown. By default, empty
189 properties are suppressed. Use <option>--all</option> to show
190 those too. To select specific properties to show, use
191 <option>--property=</option>. This command is intended to be
192 used whenever computer-parsable output is required. Use
193 <command>session-status</command> if you are looking for
194 formatted human-readable output.</para></listitem>
198 <term><command>activate</command> <optional><replaceable>ID</replaceable></optional></term>
200 <listitem><para>Activate a session. This brings a session into
201 the foreground if another session is currently in the
202 foreground on the respective seat. Takes a session identifier
203 as argument. If no argument is specified, the session of the
204 caller is put into foreground.</para></listitem>
208 <term><command>lock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
209 <term><command>unlock-session</command> <optional><replaceable>ID</replaceable>…</optional></term>
211 <listitem><para>Activates/deactivates the screen lock on one
212 or more sessions, if the session supports it. Takes one or
213 more session identifiers as arguments. If no argument is
214 specified, the session of the caller is locked/unlocked.
219 <term><command>lock-sessions</command></term>
220 <term><command>unlock-sessions</command></term>
222 <listitem><para>Activates/deactivates the screen lock on all
223 current sessions supporting it. </para></listitem>
227 <term><command>terminate-session</command> <replaceable>ID</replaceable>…</term>
229 <listitem><para>Terminates a session. This kills all processes
230 of the session and deallocates all resources attached to the
231 session. </para></listitem>
235 <term><command>kill-session</command> <replaceable>ID</replaceable>…</term>
237 <listitem><para>Send a signal to one or more processes of the
238 session. Use <option>--kill-who=</option> to select which
239 process to kill. Use <option>--signal=</option> to select the
240 signal to send.</para></listitem>
242 </variablelist></refsect2>
244 <refsect2><title>User Commands</title><variablelist>
246 <term><command>list-users</command></term>
248 <listitem><para>List currently logged in users.
253 <term><command>user-status</command> <optional><replaceable>USER</replaceable>…</optional></term>
255 <listitem><para>Show terse runtime status information about
256 one or more logged in users, followed by the most recent log
257 data from the journal. Takes one or more user names or numeric
258 user IDs as parameters. If no parameters are passed, the status
259 of the caller's user is shown. This function is intended to
260 generate human-readable output. If you are looking for
261 computer-parsable output, use <command>show-user</command>
262 instead. Users may be specified by their usernames or numeric
263 user IDs. </para></listitem>
267 <term><command>show-user</command> <optional><replaceable>USER</replaceable>…</optional></term>
269 <listitem><para>Show properties of one or more users or the
270 manager itself. If no argument is specified, properties of the
271 manager will be shown. If a user is specified, properties of
272 the user are shown. By default, empty properties are
273 suppressed. Use <option>--all</option> to show those too. To
274 select specific properties to show, use
275 <option>--property=</option>. This command is intended to be
276 used whenever computer-parsable output is required. Use
277 <command>user-status</command> if you are looking for
278 formatted human-readable output.</para></listitem>
282 <term><command>enable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
283 <term><command>disable-linger</command> <optional><replaceable>USER</replaceable>…</optional></term>
285 <listitem><para>Enable/disable user lingering for one or more
286 users. If enabled for a specific user, a user manager is
287 spawned for the user at boot and kept around after logouts.
288 This allows users who are not logged in to run long-running
289 services. Takes one or more user names or numeric UIDs as
290 argument. If no argument is specified, enables/disables
291 lingering for the user of the session of the caller.</para>
293 <para>See also <varname>KillUserProcesses=</varname> setting in
294 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>.
299 <term><command>terminate-user</command> <replaceable>USER</replaceable>…</term>
301 <listitem><para>Terminates all sessions of a user. This kills
302 all processes of all sessions of the user and deallocates all
303 runtime resources attached to the user.</para></listitem>
307 <term><command>kill-user</command> <replaceable>USER</replaceable>…</term>
309 <listitem><para>Send a signal to all processes of a user. Use
310 <option>--signal=</option> to select the signal to send.
313 </variablelist></refsect2>
315 <refsect2><title>Seat Commands</title><variablelist>
317 <term><command>list-seats</command></term>
319 <listitem><para>List currently available seats on the local
320 system.</para></listitem>
324 <term><command>seat-status</command> <optional><replaceable>NAME</replaceable>…</optional></term>
326 <listitem><para>Show terse runtime status information about
327 one or more seats. Takes one or more seat names as parameters.
328 If no seat names are passed the status of the caller's
329 session's seat is shown. This function is intended to generate
330 human-readable output. If you are looking for
331 computer-parsable output, use <command>show-seat</command>
332 instead.</para></listitem>
336 <term><command>show-seat</command> <optional><replaceable>NAME</replaceable>…</optional></term>
338 <listitem><para>Show properties of one or more seats or the
339 manager itself. If no argument is specified, properties of the
340 manager will be shown. If a seat is specified, properties of
341 the seat are shown. By default, empty properties are
342 suppressed. Use <option>--all</option> to show those too. To
343 select specific properties to show, use
344 <option>--property=</option>. This command is intended to be
345 used whenever computer-parsable output is required. Use
346 <command>seat-status</command> if you are looking for
347 formatted human-readable output.</para></listitem>
351 <term><command>attach</command> <replaceable>NAME</replaceable> <replaceable>DEVICE</replaceable>…</term>
353 <listitem><para>Persistently attach one or more devices to a
354 seat. The devices should be specified via device paths in the
355 <filename>/sys</filename> file system. To create a new seat,
356 attach at least one graphics card to a previously unused seat
357 name. Seat names may consist only of a–z, A–Z, 0–9,
358 <literal>-</literal> and <literal>_</literal> and must be
359 prefixed with <literal>seat</literal>. To drop assignment of a
360 device to a specific seat, just reassign it to a different
361 seat, or use <command>flush-devices</command>.
366 <term><command>flush-devices</command></term>
368 <listitem><para>Removes all device assignments previously
369 created with <command>attach</command>. After this call, only
370 automatically generated seats will remain, and all seat
371 hardware is assigned to them.</para></listitem>
375 <term><command>terminate-seat</command> <replaceable>NAME</replaceable>…</term>
377 <listitem><para>Terminates all sessions on a seat. This kills
378 all processes of all sessions on the seat and deallocates all
379 runtime resources attached to them.</para></listitem>
381 </variablelist></refsect2>
383 <refsect2><title>System Commands</title><variablelist>
384 </variablelist></refsect2>
386 <term><command>poweroff</command></term>
389 <para>Print a wall message to all users, shut down and
390 power-off the system.</para>
394 <term><command>reboot <optional><replaceable>arg</replaceable></optional></command></term>
397 <para>Print a wall message to all users, shut down and
398 reboot the system.</para>
400 <para>If the optional argument
401 <replaceable>arg</replaceable> is given, it will be passed
402 as the optional argument to the
403 <citerefentry><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
404 system call. The value is architecture and firmware
405 specific. As an example, <literal>recovery</literal> might
406 be used to trigger system recovery, and
407 <literal>fota</literal> might be used to trigger a
408 <quote>firmware over the air</quote> update.</para>
413 <term><command>suspend</command></term>
416 <para>Suspend the system.
422 <term><command>hibernate</command></term>
425 <para>Hibernate the system.
431 <term><command>hybrid-sleep</command></term>
434 <para>Hibernate and suspend the system.</para>
439 <title>Exit status</title>
441 <para>On success, 0 is returned, a non-zero failure code
446 <title>Examples</title>
449 <title>Querying user status</title>
451 <programlisting>$ loginctl user-status
453 Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
456 Unit: user-1005.slice
462 ├─3473 login -- fatima
465 Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
466 session opened for user fatima by LOGIN(uid=0)
467 Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
470 <para>There are two sessions, 3 and 5. Session 3 is a graphical session,
471 marked with a star. The tree of processing including the two corresponding
472 scope units and the user manager unit are shown.</para>
476 <xi:include href="less-variables.xml" />
479 <title>See Also</title>
481 <citerefentry><refentrytitle>elogind</refentrytitle><manvolnum>8</manvolnum></citerefentry>,
482 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry>,
483 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>