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