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