1LOGINCTL(1) loginctl LOGINCTL(1)
2
3
4
6 loginctl - Control the systemd login manager
7
9 loginctl [OPTIONS...] {COMMAND} [NAME...]
10
12 loginctl may be used to introspect and control the state of the
13 systemd(1) login manager systemd-logind.service(8).
14
16 The following options are understood:
17
18 --no-ask-password
19 Do not query the user for authentication for privileged operations.
20
21 -p, --property=
22 When showing session/user/seat properties, limit display to certain
23 properties as specified as argument. If not specified, all set
24 properties are shown. The argument should be a property name, such
25 as "Sessions". If specified more than once, all properties with the
26 specified names are shown.
27
28 --value
29 When showing session/user/seat properties, only print the value,
30 and skip the property name and "=".
31
32 -a, --all
33 When showing session/user/seat properties, show all properties
34 regardless of whether they are set or not.
35
36 -l, --full
37 Do not ellipsize process tree entries.
38
39 --kill-who=
40 When used with kill-session, choose which processes to kill. Must
41 be one of leader, or all to select whether to kill only the leader
42 process of the session or all processes of the session. If omitted,
43 defaults to all.
44
45 -s, --signal=
46 When used with kill-session or kill-user, choose which signal to
47 send to selected processes. Must be one of the well known signal
48 specifiers, such as SIGTERM, SIGINT or SIGSTOP. If omitted,
49 defaults to SIGTERM.
50
51 -n, --lines=
52 When used with user-status and session-status, controls the number
53 of journal lines to show, counting from the most recent ones. Takes
54 a positive integer argument. Defaults to 10.
55
56 -o, --output=
57 When used with user-status and session-status, controls the
58 formatting of the journal entries that are shown. For the available
59 choices, see journalctl(1). Defaults to "short".
60
61 -H, --host=
62 Execute the operation remotely. Specify a hostname, or a username
63 and hostname separated by "@", to connect to. The hostname may
64 optionally be suffixed by a port ssh is listening on, separated by
65 ":", and then a container name, separated by "/", which connects
66 directly to a specific container on the specified host. This will
67 use SSH to talk to the remote machine manager instance. Container
68 names may be enumerated with machinectl -H HOST. Put IPv6 addresses
69 in brackets.
70
71 -M, --machine=
72 Execute operation on a local container. Specify a container name to
73 connect to.
74
75 --no-pager
76 Do not pipe output into a pager.
77
78 --no-legend
79 Do not print the legend, i.e. column headers and the footer with
80 hints.
81
82 -h, --help
83 Print a short help text and exit.
84
85 --version
86 Print a short version string and exit.
87
89 The following commands are understood:
90
91 Session Commands
92 list-sessions
93 List current sessions.
94
95 session-status [ID...]
96 Show terse runtime status information about one or more sessions,
97 followed by the most recent log data from the journal. Takes one or
98 more session identifiers as parameters. If no session identifiers
99 are passed, the status of the caller's session is shown. This
100 function is intended to generate human-readable output. If you are
101 looking for computer-parsable output, use show-session instead.
102
103 show-session [ID...]
104 Show properties of one or more sessions or the manager itself. If
105 no argument is specified, properties of the manager will be shown.
106 If a session ID is specified, properties of the session are shown.
107 By default, empty properties are suppressed. Use --all to show
108 those too. To select specific properties to show, use --property=.
109 This command is intended to be used whenever computer-parsable
110 output is required. Use session-status if you are looking for
111 formatted human-readable output.
112
113 activate [ID]
114 Activate a session. This brings a session into the foreground if
115 another session is currently in the foreground on the respective
116 seat. Takes a session identifier as argument. If no argument is
117 specified, the session of the caller is put into foreground.
118
119 lock-session [ID...], unlock-session [ID...]
120 Activates/deactivates the screen lock on one or more sessions, if
121 the session supports it. Takes one or more session identifiers as
122 arguments. If no argument is specified, the session of the caller
123 is locked/unlocked.
124
125 lock-sessions, unlock-sessions
126 Activates/deactivates the screen lock on all current sessions
127 supporting it.
128
129 terminate-session ID...
130 Terminates a session. This kills all processes of the session and
131 deallocates all resources attached to the session.
132
133 kill-session ID...
134 Send a signal to one or more processes of the session. Use
135 --kill-who= to select which process to kill. Use --signal= to
136 select the signal to send.
137
138 User Commands
139 list-users
140 List currently logged in users.
141
142 user-status [USER...]
143 Show terse runtime status information about one or more logged in
144 users, followed by the most recent log data from the journal. Takes
145 one or more user names or numeric user IDs as parameters. If no
146 parameters are passed, the status is shown for the user of the
147 session of the caller. This function is intended to generate
148 human-readable output. If you are looking for computer-parsable
149 output, use show-user instead.
150
151 show-user [USER...]
152 Show properties of one or more users or the manager itself. If no
153 argument is specified, properties of the manager will be shown. If
154 a user is specified, properties of the user are shown. By default,
155 empty properties are suppressed. Use --all to show those too. To
156 select specific properties to show, use --property=. This command
157 is intended to be used whenever computer-parsable output is
158 required. Use user-status if you are looking for formatted
159 human-readable output.
160
161 enable-linger [USER...], disable-linger [USER...]
162 Enable/disable user lingering for one or more users. If enabled for
163 a specific user, a user manager is spawned for the user at boot and
164 kept around after logouts. This allows users who are not logged in
165 to run long-running services. Takes one or more user names or
166 numeric UIDs as argument. If no argument is specified,
167 enables/disables lingering for the user of the session of the
168 caller.
169
170 See also KillUserProcesses= setting in logind.conf(5).
171
172 terminate-user USER...
173 Terminates all sessions of a user. This kills all processes of all
174 sessions of the user and deallocates all runtime resources attached
175 to the user.
176
177 kill-user USER...
178 Send a signal to all processes of a user. Use --signal= to select
179 the signal to send.
180
181 Seat Commands
182 list-seats
183 List currently available seats on the local system.
184
185 seat-status [NAME...]
186 Show terse runtime status information about one or more seats.
187 Takes one or more seat names as parameters. If no seat names are
188 passed the status of the caller's session's seat is shown. This
189 function is intended to generate human-readable output. If you are
190 looking for computer-parsable output, use show-seat instead.
191
192 show-seat [NAME...]
193 Show properties of one or more seats or the manager itself. If no
194 argument is specified, properties of the manager will be shown. If
195 a seat is specified, properties of the seat are shown. By default,
196 empty properties are suppressed. Use --all to show those too. To
197 select specific properties to show, use --property=. This command
198 is intended to be used whenever computer-parsable output is
199 required. Use seat-status if you are looking for formatted
200 human-readable output.
201
202 attach NAME DEVICE...
203 Persistently attach one or more devices to a seat. The devices
204 should be specified via device paths in the /sys file system. To
205 create a new seat, attach at least one graphics card to a
206 previously unused seat name. Seat names may consist only of a–z,
207 A–Z, 0–9, "-" and "_" and must be prefixed with "seat". To drop
208 assignment of a device to a specific seat, just reassign it to a
209 different seat, or use flush-devices.
210
211 flush-devices
212 Removes all device assignments previously created with attach.
213 After this call, only automatically generated seats will remain,
214 and all seat hardware is assigned to them.
215
216 terminate-seat NAME...
217 Terminates all sessions on a seat. This kills all processes of all
218 sessions on the seat and deallocates all runtime resources attached
219 to them.
220
222 On success, 0 is returned, a non-zero failure code otherwise.
223
225 Example 1. Querying user status
226
227 $ loginctl user-status
228 fatima (1005)
229 Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
230 State: active
231 Sessions: 5 *3
232 Unit: user-1005.slice
233 ├─user@1005.service
234 ...
235 ├─session-3.scope
236 ...
237 └─session-5.scope
238 ├─3473 login -- fatima
239 └─3515 -zsh
240
241 Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
242 session opened for user fatima by LOGIN(uid=0)
243 Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
244
245 There are two sessions, 3 and 5. Session 3 is a graphical session,
246 marked with a star. The tree of processing including the two
247 corresponding scope units and the user manager unit are shown.
248
250 $SYSTEMD_PAGER
251 Pager to use when --no-pager is not given; overrides $PAGER. If
252 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
253 pager implementations are tried in turn, including less(1) and
254 more(1), until one is found. If no pager implementation is
255 discovered no pager is invoked. Setting this environment variable
256 to an empty string or the value "cat" is equivalent to passing
257 --no-pager.
258
259 $SYSTEMD_LESS
260 Override the options passed to less (by default "FRSXMK").
261
262 Users might want to change two options in particular:
263
264 K
265 This option instructs the pager to exit immediately when Ctrl+C
266 is pressed. To allow less to handle Ctrl+C itself to switch
267 back to the pager command prompt, unset this option.
268
269 If the value of $SYSTEMD_LESS does not include "K", and the
270 pager that is invoked is less, Ctrl+C will be ignored by the
271 executable, and needs to be handled by the pager.
272
273 X
274 This option instructs the pager to not send termcap
275 initialization and deinitialization strings to the terminal. It
276 is set by default to allow command output to remain visible in
277 the terminal even after the pager exits. Nevertheless, this
278 prevents some pager functionality from working, in particular
279 paged output cannot be scrolled with the mouse.
280
281 See less(1) for more discussion.
282
283 $SYSTEMD_LESSCHARSET
284 Override the charset passed to less (by default "utf-8", if the
285 invoking terminal is determined to be UTF-8 compatible).
286
287 $SYSTEMD_COLORS
288 The value must be a boolean. Controls whether colorized output
289 should be generated. This can be specified to override the decision
290 that systemd makes based on $TERM and what the console is connected
291 to.
292
293 $SYSTEMD_URLIFY
294 The value must be a boolean. Controls whether clickable links
295 should be generated in the output for terminal emulators supporting
296 this. This can be specified to override the decision that systemd
297 makes based on $TERM and other conditions.
298
300 systemd(1), systemctl(1), systemd-logind.service(8), logind.conf(5)
301
302
303
304systemd 243 LOGINCTL(1)