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