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 container name, separated by ":", which
65 connects directly to a specific container on the specified host.
66 This will use SSH to talk to the remote machine manager instance.
67 Container names may be enumerated with machinectl -H HOST.
68
69 -M, --machine=
70 Execute operation on a local container. Specify a container name to
71 connect to.
72
73 --no-pager
74 Do not pipe output into a pager.
75
76 --no-legend
77 Do not print the legend, i.e. column headers and the footer with
78 hints.
79
80 -h, --help
81 Print a short help text and exit.
82
83 --version
84 Print a short version string and exit.
85
87 The following commands are understood:
88
89 Session Commands
90 list-sessions
91 List current sessions.
92
93 session-status [ID...]
94 Show terse runtime status information about one or more sessions,
95 followed by the most recent log data from the journal. Takes one or
96 more session identifiers as parameters. If no session identifiers
97 are passed, the status of the caller's session is shown. This
98 function is intended to generate human-readable output. If you are
99 looking for computer-parsable output, use show-session instead.
100
101 show-session [ID...]
102 Show properties of one or more sessions or the manager itself. If
103 no argument is specified, properties of the manager will be shown.
104 If a session ID is specified, properties of the session are shown.
105 By default, empty properties are suppressed. Use --all to show
106 those too. To select specific properties to show, use --property=.
107 This command is intended to be used whenever computer-parsable
108 output is required. Use session-status if you are looking for
109 formatted human-readable output.
110
111 activate [ID]
112 Activate a session. This brings a session into the foreground if
113 another session is currently in the foreground on the respective
114 seat. Takes a session identifier as argument. If no argument is
115 specified, the session of the caller is put into foreground.
116
117 lock-session [ID...], unlock-session [ID...]
118 Activates/deactivates the screen lock on one or more sessions, if
119 the session supports it. Takes one or more session identifiers as
120 arguments. If no argument is specified, the session of the caller
121 is locked/unlocked.
122
123 lock-sessions, unlock-sessions
124 Activates/deactivates the screen lock on all current sessions
125 supporting it.
126
127 terminate-session ID...
128 Terminates a session. This kills all processes of the session and
129 deallocates all resources attached to the session.
130
131 kill-session ID...
132 Send a signal to one or more processes of the session. Use
133 --kill-who= to select which process to kill. Use --signal= to
134 select the signal to send.
135
136 User Commands
137 list-users
138 List currently logged in users.
139
140 user-status [USER...]
141 Show terse runtime status information about one or more logged in
142 users, followed by the most recent log data from the journal. Takes
143 one or more user names or numeric user IDs as parameters. If no
144 parameters are passed, the status is shown for the user of the
145 session of the caller. This function is intended to generate
146 human-readable output. If you are looking for computer-parsable
147 output, use show-user instead.
148
149 show-user [USER...]
150 Show properties of one or more users or the manager itself. If no
151 argument is specified, properties of the manager will be shown. If
152 a user is specified, properties of the user are shown. By default,
153 empty properties are suppressed. Use --all to show those too. To
154 select specific properties to show, use --property=. This command
155 is intended to be used whenever computer-parsable output is
156 required. Use user-status if you are looking for formatted
157 human-readable output.
158
159 enable-linger [USER...], disable-linger [USER...]
160 Enable/disable user lingering for one or more users. If enabled for
161 a specific user, a user manager is spawned for the user at boot and
162 kept around after logouts. This allows users who are not logged in
163 to run long-running services. Takes one or more user names or
164 numeric UIDs as argument. If no argument is specified,
165 enables/disables lingering for the user of the session of the
166 caller.
167
168 See also KillUserProcesses= setting in logind.conf(5).
169
170 terminate-user USER...
171 Terminates all sessions of a user. This kills all processes of all
172 sessions of the user and deallocates all runtime resources attached
173 to the user.
174
175 kill-user USER...
176 Send a signal to all processes of a user. Use --signal= to select
177 the signal to send.
178
179 Seat Commands
180 list-seats
181 List currently available seats on the local system.
182
183 seat-status [NAME...]
184 Show terse runtime status information about one or more seats.
185 Takes one or more seat names as parameters. If no seat names are
186 passed the status of the caller's session's seat is shown. This
187 function is intended to generate human-readable output. If you are
188 looking for computer-parsable output, use show-seat instead.
189
190 show-seat [NAME...]
191 Show properties of one or more seats or the manager itself. If no
192 argument is specified, properties of the manager will be shown. If
193 a seat is specified, properties of the seat are shown. By default,
194 empty properties are suppressed. Use --all to show those too. To
195 select specific properties to show, use --property=. This command
196 is intended to be used whenever computer-parsable output is
197 required. Use seat-status if you are looking for formatted
198 human-readable output.
199
200 attach NAME DEVICE...
201 Persistently attach one or more devices to a seat. The devices
202 should be specified via device paths in the /sys file system. To
203 create a new seat, attach at least one graphics card to a
204 previously unused seat name. Seat names may consist only of a–z,
205 A–Z, 0–9, "-" and "_" and must be prefixed with "seat". To drop
206 assignment of a device to a specific seat, just reassign it to a
207 different seat, or use flush-devices.
208
209 flush-devices
210 Removes all device assignments previously created with attach.
211 After this call, only automatically generated seats will remain,
212 and all seat hardware is assigned to them.
213
214 terminate-seat NAME...
215 Terminates all sessions on a seat. This kills all processes of all
216 sessions on the seat and deallocates all runtime resources attached
217 to them.
218
220 On success, 0 is returned, a non-zero failure code otherwise.
221
223 Example 1. Querying user status
224
225 $ loginctl user-status
226 fatima (1005)
227 Since: Sat 2016-04-09 14:23:31 EDT; 54min ago
228 State: active
229 Sessions: 5 *3
230 Unit: user-1005.slice
231 ├─user@1005.service
232 ...
233 ├─session-3.scope
234 ...
235 └─session-5.scope
236 ├─3473 login -- fatima
237 └─3515 -zsh
238
239 Apr 09 14:40:30 laptop login[2325]: pam_unix(login:session):
240 session opened for user fatima by LOGIN(uid=0)
241 Apr 09 14:40:30 laptop login[2325]: LOGIN ON tty3 BY fatima
242
243 There are two sessions, 3 and 5. Session 3 is a graphical session,
244 marked with a star. The tree of processing including the two
245 corresponding scope units and the user manager unit are shown.
246
248 $SYSTEMD_PAGER
249 Pager to use when --no-pager is not given; overrides $PAGER. If
250 neither $SYSTEMD_PAGER nor $PAGER are set, a set of well-known
251 pager implementations are tried in turn, including less(1) and
252 more(1), until one is found. If no pager implementation is
253 discovered no pager is invoked. Setting this environment variable
254 to an empty string or the value "cat" is equivalent to passing
255 --no-pager.
256
257 $SYSTEMD_LESS
258 Override the options passed to less (by default "FRSXMK").
259
260 $SYSTEMD_LESSCHARSET
261 Override the charset passed to less (by default "utf-8", if the
262 invoking terminal is determined to be UTF-8 compatible).
263
265 systemd(1), systemctl(1), systemd-logind.service(8), logind.conf(5)
266
267
268
269systemd 239 LOGINCTL(1)