]> git.ipfire.org Git - thirdparty/systemd.git/blob - man/org.freedesktop.login1.xml
17ffd493ab385b126d81e02dcf09ed1b6833a038
[thirdparty/systemd.git] / man / org.freedesktop.login1.xml
1 <?xml version='1.0'?>
2 <!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN"
3 "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd" >
4 <!-- SPDX-License-Identifier: LGPL-2.1+ -->
5
6 <refentry id="org.freedesktop.login1" conditional='ENABLE_LOGIND'
7 xmlns:xi="http://www.w3.org/2001/XInclude">
8 <refentryinfo>
9 <title>org.freedesktop.login1</title>
10 <productname>systemd</productname>
11 </refentryinfo>
12
13 <refmeta>
14 <refentrytitle>org.freedesktop.login1</refentrytitle>
15 <manvolnum>5</manvolnum>
16 </refmeta>
17
18 <refnamediv>
19 <refname>org.freedesktop.login1</refname>
20 <refpurpose>The D-Bus interface of systemd-logind</refpurpose>
21 </refnamediv>
22
23 <refsect1>
24 <title>Introduction</title>
25
26 <para><citerefentry><refentrytitle>systemd-logind.service</refentrytitle><manvolnum>8</manvolnum></citerefentry>
27 is a system service that keeps track of user logins and seats.</para>
28
29 <para>The daemon provides both a C library interface as well as a D-Bus interface. The library interface
30 may be used to introspect and watch the state of user logins and seats. The bus interface provides the
31 same functionality but in addition may also be used to make changes to the system state. For more information please
32 consult <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>.
33 </para>
34 </refsect1>
35
36 <refsect1>
37 <title>The Manager Object</title>
38
39 <para>The service exposes the following interfaces on the Manager object on the bus:</para>
40
41 <programlisting executable="systemd-logind" node="/org/freedesktop/login1" interface="org.freedesktop.login1.Manager">
42 node /org/freedesktop/login1 {
43 interface org.freedesktop.login1.Manager {
44 methods:
45 GetSession(in s session_id,
46 out o object_path);
47 GetSessionByPID(in u pid,
48 out o object_path);
49 GetUser(in u uid,
50 out o object_path);
51 GetUserByPID(in u pid,
52 out o object_path);
53 GetSeat(in s seat_id,
54 out o object_path);
55 ListSessions(out a(susso) sessions);
56 ListUsers(out a(uso) users);
57 ListSeats(out a(so) seats);
58 ListInhibitors(out a(ssssuu) inhibitors);
59 CreateSession(in u uid,
60 in u pid,
61 in s service,
62 in s type,
63 in s class,
64 in s desktop,
65 in s seat_id,
66 in u vtnr,
67 in s tty,
68 in s display,
69 in b remote,
70 in s remote_user,
71 in s remote_host,
72 in a(sv) properties,
73 out s session_id,
74 out o object_path,
75 out s runtime_path,
76 out h fifo_fd,
77 out u uid,
78 out s seat_id,
79 out u vtnr,
80 out b existing);
81 ReleaseSession(in s session_id);
82 ActivateSession(in s session_id);
83 ActivateSessionOnSeat(in s session_id,
84 in s seat_id);
85 LockSession(in s session_id);
86 UnlockSession(in s session_id);
87 LockSessions();
88 UnlockSessions();
89 KillSession(in s session_id,
90 in s who,
91 in i signal_number);
92 KillUser(in u uid,
93 in i signal_number);
94 TerminateSession(in s session_id);
95 TerminateUser(in u uid);
96 TerminateSeat(in s seat_id);
97 SetUserLinger(in u uid,
98 in b enable,
99 in b interactive);
100 AttachDevice(in s seat_id,
101 in s sysfs_path,
102 in b interactive);
103 FlushDevices(in b interactive);
104 PowerOff(in b interactive);
105 Reboot(in b interactive);
106 Halt(in b interactive);
107 Suspend(in b interactive);
108 Hibernate(in b interactive);
109 HybridSleep(in b interactive);
110 SuspendThenHibernate(in b interactive);
111 CanPowerOff(out s result);
112 CanReboot(out s result);
113 CanHalt(out s result);
114 CanSuspend(out s result);
115 CanHibernate(out s result);
116 CanHybridSleep(out s result);
117 CanSuspendThenHibernate(out s result);
118 ScheduleShutdown(in s type,
119 in t usec);
120 CancelScheduledShutdown(out b cancelled);
121 Inhibit(in s what,
122 in s who,
123 in s why,
124 in s mode,
125 out h pipe_fd);
126 CanRebootParameter(out s result);
127 SetRebootParameter(in s parameter);
128 CanRebootToFirmwareSetup(out s result);
129 SetRebootToFirmwareSetup(in b enable);
130 CanRebootToBootLoaderMenu(out s result);
131 SetRebootToBootLoaderMenu(in t timeout);
132 CanRebootToBootLoaderEntry(out s result);
133 SetRebootToBootLoaderEntry(in s boot_loader_entry);
134 SetWallMessage(in s wall_message,
135 in b enable);
136 signals:
137 SessionNew(s session_id,
138 o object_path);
139 SessionRemoved(s session_id,
140 o object_path);
141 UserNew(u uid,
142 o object_path);
143 UserRemoved(u uid,
144 o object_path);
145 SeatNew(s seat_id,
146 o object_path);
147 SeatRemoved(s seat_id,
148 o object_path);
149 PrepareForShutdown(b start);
150 PrepareForSleep(b start);
151 properties:
152 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
153 @org.freedesktop.systemd1.Privileged("true")
154 readwrite b EnableWallMessages = ...;
155 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
156 @org.freedesktop.systemd1.Privileged("true")
157 readwrite s WallMessage = '...';
158 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
159 readonly u NAutoVTs = ...;
160 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
161 readonly as KillOnlyUsers = ['...', ...];
162 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
163 readonly as KillExcludeUsers = ['...', ...];
164 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
165 readonly b KillUserProcesses = ...;
166 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
167 readonly s RebootParameter = '...';
168 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
169 readonly b RebootToFirmwareSetup = ...;
170 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
171 readonly t RebootToBootLoaderMenu = ...;
172 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
173 readonly s RebootToBootLoaderEntry = '...';
174 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
175 readonly as BootLoaderEntries = ['...', ...];
176 readonly b IdleHint = ...;
177 readonly t IdleSinceHint = ...;
178 readonly t IdleSinceHintMonotonic = ...;
179 readonly s BlockInhibited = '...';
180 readonly s DelayInhibited = '...';
181 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
182 readonly t InhibitDelayMaxUSec = ...;
183 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
184 readonly t UserStopDelayUSec = ...;
185 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
186 readonly s HandlePowerKey = '...';
187 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
188 readonly s HandleSuspendKey = '...';
189 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
190 readonly s HandleHibernateKey = '...';
191 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
192 readonly s HandleLidSwitch = '...';
193 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
194 readonly s HandleLidSwitchExternalPower = '...';
195 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
196 readonly s HandleLidSwitchDocked = '...';
197 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
198 readonly t HoldoffTimeoutUSec = ...;
199 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
200 readonly s IdleAction = '...';
201 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
202 readonly t IdleActionUSec = ...;
203 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
204 readonly b PreparingForShutdown = ...;
205 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
206 readonly b PreparingForSleep = ...;
207 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
208 readonly (st) ScheduledShutdown = ...;
209 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
210 readonly b Docked = ...;
211 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
212 readonly b LidClosed = ...;
213 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
214 readonly b OnExternalPower = ...;
215 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
216 readonly b RemoveIPC = ...;
217 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
218 readonly t RuntimeDirectorySize = ...;
219 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
220 readonly t RuntimeDirectoryInodesMax = ...;
221 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
222 readonly t InhibitorsMax = ...;
223 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
224 readonly t NCurrentInhibitors = ...;
225 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
226 readonly t SessionsMax = ...;
227 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
228 readonly t NCurrentSessions = ...;
229 };
230 interface org.freedesktop.DBus.Peer { ... };
231 interface org.freedesktop.DBus.Introspectable { ... };
232 interface org.freedesktop.DBus.Properties { ... };
233 };
234 </programlisting>
235
236 <!--Autogenerated cross-references for systemd.directives, do not edit-->
237
238 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/>
239
240 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Manager"/>
241
242 <variablelist class="dbus-method" generated="True" extra-ref="GetSession()"/>
243
244 <variablelist class="dbus-method" generated="True" extra-ref="GetSessionByPID()"/>
245
246 <variablelist class="dbus-method" generated="True" extra-ref="GetUser()"/>
247
248 <variablelist class="dbus-method" generated="True" extra-ref="GetUserByPID()"/>
249
250 <variablelist class="dbus-method" generated="True" extra-ref="GetSeat()"/>
251
252 <variablelist class="dbus-method" generated="True" extra-ref="ListSessions()"/>
253
254 <variablelist class="dbus-method" generated="True" extra-ref="ListUsers()"/>
255
256 <variablelist class="dbus-method" generated="True" extra-ref="ListSeats()"/>
257
258 <variablelist class="dbus-method" generated="True" extra-ref="ListInhibitors()"/>
259
260 <variablelist class="dbus-method" generated="True" extra-ref="CreateSession()"/>
261
262 <variablelist class="dbus-method" generated="True" extra-ref="ReleaseSession()"/>
263
264 <variablelist class="dbus-method" generated="True" extra-ref="ActivateSession()"/>
265
266 <variablelist class="dbus-method" generated="True" extra-ref="ActivateSessionOnSeat()"/>
267
268 <variablelist class="dbus-method" generated="True" extra-ref="LockSession()"/>
269
270 <variablelist class="dbus-method" generated="True" extra-ref="UnlockSession()"/>
271
272 <variablelist class="dbus-method" generated="True" extra-ref="LockSessions()"/>
273
274 <variablelist class="dbus-method" generated="True" extra-ref="UnlockSessions()"/>
275
276 <variablelist class="dbus-method" generated="True" extra-ref="KillSession()"/>
277
278 <variablelist class="dbus-method" generated="True" extra-ref="KillUser()"/>
279
280 <variablelist class="dbus-method" generated="True" extra-ref="TerminateSession()"/>
281
282 <variablelist class="dbus-method" generated="True" extra-ref="TerminateUser()"/>
283
284 <variablelist class="dbus-method" generated="True" extra-ref="TerminateSeat()"/>
285
286 <variablelist class="dbus-method" generated="True" extra-ref="SetUserLinger()"/>
287
288 <variablelist class="dbus-method" generated="True" extra-ref="AttachDevice()"/>
289
290 <variablelist class="dbus-method" generated="True" extra-ref="FlushDevices()"/>
291
292 <variablelist class="dbus-method" generated="True" extra-ref="PowerOff()"/>
293
294 <variablelist class="dbus-method" generated="True" extra-ref="Reboot()"/>
295
296 <variablelist class="dbus-method" generated="True" extra-ref="Halt()"/>
297
298 <variablelist class="dbus-method" generated="True" extra-ref="Suspend()"/>
299
300 <variablelist class="dbus-method" generated="True" extra-ref="Hibernate()"/>
301
302 <variablelist class="dbus-method" generated="True" extra-ref="HybridSleep()"/>
303
304 <variablelist class="dbus-method" generated="True" extra-ref="SuspendThenHibernate()"/>
305
306 <variablelist class="dbus-method" generated="True" extra-ref="CanPowerOff()"/>
307
308 <variablelist class="dbus-method" generated="True" extra-ref="CanReboot()"/>
309
310 <variablelist class="dbus-method" generated="True" extra-ref="CanHalt()"/>
311
312 <variablelist class="dbus-method" generated="True" extra-ref="CanSuspend()"/>
313
314 <variablelist class="dbus-method" generated="True" extra-ref="CanHibernate()"/>
315
316 <variablelist class="dbus-method" generated="True" extra-ref="CanHybridSleep()"/>
317
318 <variablelist class="dbus-method" generated="True" extra-ref="CanSuspendThenHibernate()"/>
319
320 <variablelist class="dbus-method" generated="True" extra-ref="ScheduleShutdown()"/>
321
322 <variablelist class="dbus-method" generated="True" extra-ref="CancelScheduledShutdown()"/>
323
324 <variablelist class="dbus-method" generated="True" extra-ref="Inhibit()"/>
325
326 <variablelist class="dbus-method" generated="True" extra-ref="CanRebootParameter()"/>
327
328 <variablelist class="dbus-method" generated="True" extra-ref="SetRebootParameter()"/>
329
330 <variablelist class="dbus-method" generated="True" extra-ref="CanRebootToFirmwareSetup()"/>
331
332 <variablelist class="dbus-method" generated="True" extra-ref="SetRebootToFirmwareSetup()"/>
333
334 <variablelist class="dbus-method" generated="True" extra-ref="CanRebootToBootLoaderMenu()"/>
335
336 <variablelist class="dbus-method" generated="True" extra-ref="SetRebootToBootLoaderMenu()"/>
337
338 <variablelist class="dbus-method" generated="True" extra-ref="CanRebootToBootLoaderEntry()"/>
339
340 <variablelist class="dbus-method" generated="True" extra-ref="SetRebootToBootLoaderEntry()"/>
341
342 <variablelist class="dbus-method" generated="True" extra-ref="SetWallMessage()"/>
343
344 <variablelist class="dbus-signal" generated="True" extra-ref="SessionNew"/>
345
346 <variablelist class="dbus-signal" generated="True" extra-ref="SessionRemoved"/>
347
348 <variablelist class="dbus-signal" generated="True" extra-ref="UserNew"/>
349
350 <variablelist class="dbus-signal" generated="True" extra-ref="UserRemoved"/>
351
352 <variablelist class="dbus-signal" generated="True" extra-ref="SeatNew"/>
353
354 <variablelist class="dbus-signal" generated="True" extra-ref="SeatRemoved"/>
355
356 <variablelist class="dbus-signal" generated="True" extra-ref="PrepareForShutdown"/>
357
358 <variablelist class="dbus-signal" generated="True" extra-ref="PrepareForSleep"/>
359
360 <variablelist class="dbus-property" generated="True" extra-ref="EnableWallMessages"/>
361
362 <variablelist class="dbus-property" generated="True" extra-ref="WallMessage"/>
363
364 <variablelist class="dbus-property" generated="True" extra-ref="NAutoVTs"/>
365
366 <variablelist class="dbus-property" generated="True" extra-ref="KillOnlyUsers"/>
367
368 <variablelist class="dbus-property" generated="True" extra-ref="KillExcludeUsers"/>
369
370 <variablelist class="dbus-property" generated="True" extra-ref="KillUserProcesses"/>
371
372 <variablelist class="dbus-property" generated="True" extra-ref="RebootParameter"/>
373
374 <variablelist class="dbus-property" generated="True" extra-ref="RebootToFirmwareSetup"/>
375
376 <variablelist class="dbus-property" generated="True" extra-ref="RebootToBootLoaderMenu"/>
377
378 <variablelist class="dbus-property" generated="True" extra-ref="RebootToBootLoaderEntry"/>
379
380 <variablelist class="dbus-property" generated="True" extra-ref="BootLoaderEntries"/>
381
382 <variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
383
384 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
385
386 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
387
388 <variablelist class="dbus-property" generated="True" extra-ref="BlockInhibited"/>
389
390 <variablelist class="dbus-property" generated="True" extra-ref="DelayInhibited"/>
391
392 <variablelist class="dbus-property" generated="True" extra-ref="InhibitDelayMaxUSec"/>
393
394 <variablelist class="dbus-property" generated="True" extra-ref="UserStopDelayUSec"/>
395
396 <variablelist class="dbus-property" generated="True" extra-ref="HandlePowerKey"/>
397
398 <variablelist class="dbus-property" generated="True" extra-ref="HandleSuspendKey"/>
399
400 <variablelist class="dbus-property" generated="True" extra-ref="HandleHibernateKey"/>
401
402 <variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitch"/>
403
404 <variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchExternalPower"/>
405
406 <variablelist class="dbus-property" generated="True" extra-ref="HandleLidSwitchDocked"/>
407
408 <variablelist class="dbus-property" generated="True" extra-ref="HoldoffTimeoutUSec"/>
409
410 <variablelist class="dbus-property" generated="True" extra-ref="IdleAction"/>
411
412 <variablelist class="dbus-property" generated="True" extra-ref="IdleActionUSec"/>
413
414 <variablelist class="dbus-property" generated="True" extra-ref="PreparingForShutdown"/>
415
416 <variablelist class="dbus-property" generated="True" extra-ref="PreparingForSleep"/>
417
418 <variablelist class="dbus-property" generated="True" extra-ref="ScheduledShutdown"/>
419
420 <variablelist class="dbus-property" generated="True" extra-ref="Docked"/>
421
422 <variablelist class="dbus-property" generated="True" extra-ref="LidClosed"/>
423
424 <variablelist class="dbus-property" generated="True" extra-ref="OnExternalPower"/>
425
426 <variablelist class="dbus-property" generated="True" extra-ref="RemoveIPC"/>
427
428 <variablelist class="dbus-property" generated="True" extra-ref="RuntimeDirectorySize"/>
429
430 <variablelist class="dbus-property" generated="True" extra-ref="RuntimeDirectoryInodesMax"/>
431
432 <variablelist class="dbus-property" generated="True" extra-ref="InhibitorsMax"/>
433
434 <variablelist class="dbus-property" generated="True" extra-ref="NCurrentInhibitors"/>
435
436 <variablelist class="dbus-property" generated="True" extra-ref="SessionsMax"/>
437
438 <variablelist class="dbus-property" generated="True" extra-ref="NCurrentSessions"/>
439
440 <!--End of Autogenerated section-->
441
442 <refsect2>
443 <title>Methods</title>
444
445 <para><function>GetSession()</function> may be used to get the session object path for the session with
446 the specified ID. Similarly, <function>GetUser()</function> and <function>GetSeat()</function> get the
447 user and seat objects, respectively. <function>GetSessionByPID()</function> and
448 <function>GetUserByPID()</function> get the session/user object the specified PID belongs to if there
449 is any.</para>
450
451 <para><function>ListSessions()</function> returns an array of all current sessions. The structures in
452 the array consist of the following fields: session id, user id, user name, seat id, session object
453 path. If a session does not have a seat attached, the seat id field will be an empty string.</para>
454
455 <para><function>ListUsers()</function> returns an array of all currently logged in users. The
456 structures in the array consist of the following fields: user id, user name, user object path.</para>
457
458 <para><function>ListSeats()</function> returns an array of all currently available seats. The
459 structure in the array consists of the following fields: seat id, seat object path.</para>
460
461 <para><function>ListInhibitors()</function> lists all currently active inhibitors. It returns an array of
462 structures consisting of <varname>what</varname>, <varname>who</varname>, <varname>why</varname>,
463 <varname>mode</varname>, <varname>uid</varname> (user ID), and <varname>pid</varname> (process ID).</para>
464
465 <para><function>CreateSession()</function> and <function>ReleaseSession()</function> may be used to
466 open or close login sessions. These calls should <emphasis>never</emphasis> be invoked directly by
467 clients. Creating/closing sessions is exclusively the job of PAM and its
468 <citerefentry><refentrytitle>pam_systemd</refentrytitle><manvolnum>8</manvolnum></citerefentry>
469 module.</para>
470
471 <para><function>ActivateSession()</function> brings the session with the specified ID into the
472 foreground. <function>ActivateSessionOnSeat()</function> does the same, but only if the seat id
473 matches.</para>
474
475 <para><function>LockSession()</function> asks the session with the specified ID to activate the screen
476 lock. <function>UnlockSession()</function> asks the session with the specified ID to remove an active
477 screen lock, if there is any. This is implemented by sending out the Lock() and Unlock() signals from
478 the respective session object which session managers are supposed to listen on.</para>
479
480 <para><function>LockSessions()</function> asks all sessions to activate their screen locks. This may be
481 used to lock access to the entire machine in one action. Similarly, <function>UnlockSessions()</function>
482 asks all sessions to deactivate their screen locks.</para>
483
484 <para><function>KillSession()</function> may be used to send a Unix signal to one or all processes of a
485 session. As arguments it takes the session id, either the string <literal>leader</literal> or
486 <literal>all</literal> and a signal number. If <literal>leader</literal> is passed only the session
487 <literal>leader</literal> is killed. If <literal>all</literal> is passed all processes of the session
488 are killed.</para>
489
490 <para><function>KillUser()</function> may be used to send a Unix signal to all processes of a user. As
491 arguments it takes the user id and a signal number.</para>
492
493 <para><function>TerminateSession()</function>, <function>TerminateUser()</function>,
494 <function>TerminateSeat()</function> may be used to forcibly terminate one specific session, all
495 processes of a user, and all sessions attached to a specific seat, respectively. The session, user,
496 and seat are identified by their respective IDs.</para>
497
498 <para><function>SetUserLinger()</function> enables or disables user lingering. If enabled, the runtime
499 directory of a user is kept around and they may continue to run processes while logged out. If
500 disabled, the runtime directory goes away as soon as they log out. <function>SetUserLinger()</function>
501 expects three arguments: the UID, a boolean whether to enable/disable and a boolean controlling the
502 <ulink url="https://www.freedesktop.org/software/polkit/docs/latest/">polkit</ulink>
503 authorization interactivity (see below). Note that the user linger state is persistently
504 stored on disk.</para>
505
506 <para><function>AttachDevice()</function> may be used to assign a specific device to a specific
507 seat. The device is identified by its <filename>/sys/</filename> path and must be eligible for seat
508 assignments. <function>AttachDevice()</function> takes three arguments: the seat id, the sysfs path,
509 and a boolean for controlling polkit interactivity (see below). Device assignments are persistently
510 stored on disk. To create a new seat, simply specify a previously unused seat id. For more information
511 about the seat assignment logic see
512 <citerefentry><refentrytitle>sd-login</refentrytitle><manvolnum>3</manvolnum></citerefentry>.</para>
513
514 <para><function>FlushDevices()</function> removes all explicit seat assignments for devices, resetting
515 all assignments to the automatic defaults. The only argument it takes is the polkit interactivity
516 boolean (see below).</para>
517
518 <para><function>PowerOff()</function>, <function>Reboot()</function>, <function>Halt()</function>,
519 <function>Suspend()</function>, and <function>Hibernate()</function> result in the system being powered
520 off, rebooted, halted (shut down without turning off power), suspended (the system state is
521 saved to RAM and the CPU is turned off), or hibernated (the system state is saved to disk and
522 the machine is powered down). <function>HybridSleep()</function> results in the system entering a
523 hybrid-sleep mode, i.e. the system is both hibernated and suspended.
524 <function>SuspendThenHibernate()</function> results in the system being suspended, then later woken
525 using an RTC timer and hibernated. The only argument is the polkit interactivity boolean
526 <varname>interactive</varname> (see below). The main purpose of these calls is that they enforce
527 polkit policy and hence allow powering off/rebooting/suspending/hibernating even by unprivileged
528 users. They also enforce inhibition locks. UIs should expose these calls as the primary mechanism to
529 poweroff/reboot/suspend/hibernate the machine.</para>
530
531 <para><function>SetRebootParameter()</function> sets a parameter for a subsequent reboot operation.
532 See the description of <command>reboot</command> in
533 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> and
534 <citerefentry project="man-pages"><refentrytitle>reboot</refentrytitle><manvolnum>2</manvolnum></citerefentry>
535 for more information.</para>
536
537 <para><function>SetRebootToFirmwareSetup()</function>,
538 <function>SetRebootToBootLoaderMenu()</function>, and <function>SetRebootToBootLoaderEntry()</function>
539 configure the action to be taken from the boot loader after a reboot: respectively entering firmware
540 setup mode, the boot loader menu, or a specific boot loader entry. See
541 <citerefentry><refentrytitle>systemctl</refentrytitle><manvolnum>1</manvolnum></citerefentry> for the
542 corresponding command line interface.</para>
543
544 <para><function>CanPowerOff()</function>, <function>CanReboot()</function>,
545 <function>CanHalt()</function>, <function>CanSuspend()</function>, <function>CanHibernate()</function>,
546 <function>CanHybridSleep()</function>, <function>CanSuspendThenHibernate()</function>,
547 <function>CanRebootParameter()</function>, <function>CanRebootToFirmwareSetup()</function>,
548 <function>CanRebootToBootLoaderMenu()</function>, and
549 <function>CanRebootToBootLoaderEntry()</function> test whether the system supports the respective
550 operation and whether the calling user is allowed to execute it. Returns one of <literal>na</literal>,
551 <literal>yes</literal>, <literal>no</literal>, and <literal>challenge</literal>. If
552 <literal>na</literal> is returned, the operation is not available because hardware, kernel, or drivers
553 do not support it. If <literal>yes</literal> is returned, the operation is supported and the user may
554 execute the operation without further authentication. If <literal>no</literal> is returned, the
555 operation is available but the user is not allowed to execute the operation. If
556 <literal>challenge</literal> is returned, the operation is available but only after
557 authorization.</para>
558
559 <para><function>ScheduleShutdown()</function> schedules a shutdown operation <varname>type</varname> at
560 time <varname>usec</varname> in microseconds since the UNIX epoch. <varname>type</varname> can be one
561 of <literal>poweroff</literal>, <literal>dry-poweroff</literal>, <literal>reboot</literal>,
562 <literal>dry-reboot</literal>, <literal>halt</literal>, and <literal>dry-halt</literal>. (The
563 <literal>dry-</literal> variants do not actually execute the shutdown action.)
564 <function>CancelScheduledShutdown()</function> cancels a scheduled shutdown. The output parameter
565 <varname>cancelled</varname> is true if a shutdown operation was scheduled.</para>
566
567 <para><function>SetWallMessage()</function> sets the wall message (the message that will be sent out to
568 all terminals and stored in a
569 <citerefentry project="man-pages"><refentrytitle>utmp</refentrytitle><manvolnum>5</manvolnum></citerefentry> record) for a
570 subsequent scheduled shutdown operation. The parameter <varname>wall_message</varname> specifies the
571 shutdown reason (and may be empty) which will be included in the shutdown message. The parameter
572 <varname>enable</varname> specifies whether to print a wall message on shutdown.</para>
573
574 <para><function>Inhibit()</function> creates an inhibition lock. It takes four parameters:
575 <varname>what</varname>, <varname>who</varname>, <varname>why</varname>, and
576 <varname>mode</varname>. <varname>what</varname> is one or more of <literal>shutdown</literal>,
577 <literal>sleep</literal>, <literal>idle</literal>, <literal>handle-power-key</literal>,
578 <literal>handle-suspend-key</literal>, <literal>handle-hibernate-key</literal>,
579 <literal>handle-lid-switch</literal>, separated by colons, for inhibiting poweroff/reboot,
580 suspend/hibernate, the automatic idle logic, or hardware key handling. <varname>who</varname> should be
581 a short human readable string identifying the application taking the lock. <varname>why</varname>
582 should be a short human readable string identifying the reason why the lock is taken. Finally,
583 <varname>mode</varname> is either <literal>block</literal> or <literal>delay</literal> which encodes
584 whether the inhibit shall be consider mandatory or whether it should just delay the operation to a
585 certain maximum time. The method returns a file descriptor. The lock is released the moment this file
586 descriptor and all its duplicates are closed. For more information on the inhibition logic see
587 <ulink url="http://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor Locks</ulink>.
588 </para>
589 </refsect2>
590
591 <refsect2>
592 <title>Signals</title>
593
594 <para>Whenever the inhibition state or idle hint changes, <function>PropertyChanged</function>
595 signals are sent out to which clients can subscribe.</para>
596
597 <para>The <function>SessionNew</function>, <function>SessionRemoved</function>,
598 <function>UserNew</function>, <function>UserRemoved</function>, <function>SeatNew</function>, and
599 <function>SeatRemoved</function> signals are sent each time a session is created or removed, a user
600 logs in or out, or a seat is added or removed. They each contain the ID of the object plus the object
601 path.</para>
602
603 <para>The <function>PrepareForShutdown()</function> and <function>PrepareForSleep()</function> signals
604 are sent right before (with the argument <literal>true</literal>) or after (with the argument
605 <literal>false</literal>) the system goes down for reboot/poweroff and suspend/hibernate,
606 respectively. This may be used by applications to save data on disk, release memory, or do other jobs
607 that should be done shortly before shutdown/sleep, in conjunction with delay inhibitor locks. After
608 completion of this work they should release their inhibition locks in order to not delay the operation
609 any further. For more information see
610 <ulink url="http://www.freedesktop.org/wiki/Software/systemd/inhibit">Inhibitor Locks</ulink>.
611 </para>
612 </refsect2>
613
614 <refsect2>
615 <title>Properties</title>
616
617 <para>Most properties simply reflect the configuration, see
618 <citerefentry><refentrytitle>logind.conf</refentrytitle><manvolnum>5</manvolnum></citerefentry>. This
619 includes: <varname>NAutoVTs</varname>, <varname>KillOnlyUsers</varname>,
620 <varname>KillExcludeUsers</varname>, <varname>KillUserProcesses</varname>, <varname>IdleAction</varname>,
621 <varname>InhibitDelayMaxUSec</varname>,
622 <varname>InhibitorsMax</varname>,
623 <varname>UserStopDelayUSec</varname>,
624 <varname>HandlePowerKey</varname>, <varname>HandleSuspendKey</varname>,
625 <varname>HandleHibernateKey</varname>, <varname>HandleLidSwitch</varname>,
626 <varname>HandleLidSwitchExternalPower</varname>, <varname>HandleLidSwitchDocked</varname>,
627 <varname>IdleActionUSec</varname>, <varname>HoldoffTimeoutUSec</varname>,
628 <varname>RemoveIPC</varname>, <varname>RuntimeDirectorySize</varname>,
629 <varname>RuntimeDirectoryInodesMax</varname>, <varname>InhibitorsMax</varname>, and
630 <varname>SessionsMax</varname>.
631 </para>
632
633 <para>The <varname>IdleHint</varname> property reflects the idle hint state of the system. If the
634 system is idle it might get into automatic suspend or shutdown depending on the configuration.</para>
635
636 <para><varname>IdleSinceHint</varname> and <varname>IdleSinceHintMonotonic</varname> encode the
637 timestamps of the last change of the idle hint boolean, in <constant>CLOCK_REALTIME</constant> and
638 <constant>CLOCK_MONOTONIC</constant> timestamps, respectively, in microseconds since the epoch.</para>
639
640 <para>The <varname>BlockInhibited</varname> and <varname>DelayInhibited</varname> properties encode
641 the currently active locks of the respective modes. They are colon separated lists of
642 <literal>shutdown</literal>, <literal>sleep</literal>, and <literal>idle</literal> (see above).</para>
643
644 <para><varname>NCurrentSessions</varname> and <varname>NCurrentInhibitors</varname> contain the number
645 of currently registered sessions and inhibitors.</para>
646
647 <para>The <varname>BootLoaderEntries</varname> property contains a list of boot loader entries.
648 This includes boot loader entries defined in configuration and any additional loader entries
649 reported by the boot loader. See
650 <citerefentry><refentrytitle>systemd-boot</refentrytitle><manvolnum>7</manvolnum></citerefentry>
651 for more information.</para>
652
653 <para>The <varname>PreparingForShutdown</varname> and <varname>PreparingForSleep</varname> boolean
654 properties are true during the interval between the two <function>PrepareForShutdown</function> and
655 <function>PrepareForSleep</function> signals respectively. Note that these properties do not
656 send out <function>PropertyChanged</function> signals.</para>
657
658 <para>The <varname>RebootParameter</varname> property shows the value set with the
659 <function>SetRebootParameter()</function> method described above.</para>
660
661 <para><varname>ScheduledShutdown</varname> shows the value pair set with the
662 <function>ScheduleShutdown()</function> method described above.</para>
663
664 <para><varname>RebootToFirmwareSetup</varname>, <varname>RebootToBootLoaderMenu</varname>, and
665 <varname>RebootToBootLoaderEntry</varname> are true when the resprective post-reboot operation was
666 selected with <function>SetRebootToFirmwareSetup</function>,
667 <function>SetRebootToBootLoaderMenu</function>, or
668 <function>SetRebootToBootLoaderEntry</function>.</para>
669
670 <para>The <varname>WallMessage</varname> and <varname>EnableWallMessages</varname> properties reflect the
671 shutdown reason and wall message enablement switch which can be set with the
672 <function>SetWallMessage()</function> method described above.</para>
673
674 <para><varname>Docked</varname> is true if the machine is connected to a dock.
675 <varname>LidClosed</varname> is true when the lid (of a laptop) is closed.
676 <varname>OnExternalPower</varname> is true when the machine is connected to an external power supply.
677 </para>
678 </refsect2>
679
680 <refsect2>
681 <title>Security</title>
682
683 <para>A number of operations are protected via the polkit privilege
684 system. <function>SetUserLinger()</function> requires the
685 <interfacename>org.freedesktop.login1.set-user-linger</interfacename>
686 privilege. <function>AttachDevice()</function> requires
687 <interfacename>org.freedesktop.login1.attach-device</interfacename> and
688 <function>FlushDevices()</function> requires
689 <interfacename>org.freedesktop.login1.flush-devices</interfacename>. <function>PowerOff()</function>,
690 <function>Reboot()</function>, <function>Halt()</function>, <function>Suspend()</function>,
691 <function>Hibernate()</function> require
692 <interfacename>org.freedesktop.login1.power-off</interfacename>,
693 <interfacename>org.freedesktop.login1.power-off-multiple-sessions</interfacename>,
694 <interfacename>org.freedesktop.login1.power-off-ignore-inhibit</interfacename>,
695 <interfacename>org.freedesktop.login1.reboot</interfacename>,
696 <interfacename>org.freedesktop.login1.reboot-multiple-sessions</interfacename>,
697 <interfacename>org.freedesktop.login1.reboot-ignore-inhibit</interfacename>,
698 <interfacename>org.freedesktop.login1.halt</interfacename>,
699 <interfacename>org.freedesktop.login1.halt-multiple-sessions</interfacename>,
700 <interfacename>org.freedesktop.login1.halt-ignore-inhibit</interfacename>,
701 <interfacename>org.freedesktop.login1.suspend</interfacename>,
702 <interfacename>org.freedesktop.login1.suspend-multiple-sessions</interfacename>,
703 <interfacename>org.freedesktop.login1.suspend-ignore-inhibit</interfacename>,
704 <interfacename>org.freedesktop.login1.hibernate</interfacename>,
705 <interfacename>org.freedesktop.login1.hibernate-multiple-sessions</interfacename>,
706 <interfacename>org.freedesktop.login1.hibernate-ignore-inhibit</interfacename>,
707 respectively depending on whether there are other sessions around or active inhibits are present.
708 <function>HybridSleep()</function> and <function>SuspendThenHibernate()</function>
709 use the same privileges as <function>Hibernate()</function>.
710 <function>SetRebootParameter()</function> requires
711 <interfacename>org.freedesktop.login1.set-reboot-parameter</interfacename>.</para>
712
713 <para><function>SetRebootToFirmwareSetup</function> requires
714 <interfacename>org.freedesktop.login1.set-reboot-to-firmware-setup</interfacename>.
715 <function>SetRebootToBootLoaderMenu</function> requires
716 <interfacename>org.freedesktop.login1.set-reboot-to-boot-loader-menu</interfacename>.
717 <function>SetRebootToBootLoaderEntry</function> requires
718 <interfacename>org.freedesktop.login1.set-reboot-to-boot-loader-entry</interfacename>.
719 </para>
720
721 <para><function>ScheduleShutdown</function> and <function>CancelScheduledShutdown</function> require
722 the same privileges (listed above) as the immediate poweroff/reboot/halt operations.</para>
723
724 <para><function>Inhibit()</function> is protected via one of
725 <interfacename>org.freedesktop.login1.inhibit-block-shutdown</interfacename>,
726 <interfacename>org.freedesktop.login1.inhibit-delay-shutdown</interfacename>,
727 <interfacename>org.freedesktop.login1.inhibit-block-sleep</interfacename>,
728 <interfacename>org.freedesktop.login1.inhibit-delay-sleep</interfacename>,
729 <interfacename>org.freedesktop.login1.inhibit-block-idle</interfacename>,
730 <interfacename>org.freedesktop.login1.inhibit-handle-power-key</interfacename>,
731 <interfacename>org.freedesktop.login1.inhibit-handle-suspend-key</interfacename>,
732 <interfacename>org.freedesktop.login1.inhibit-handle-hibernate-key</interfacename>,
733 <interfacename>org.freedesktop.login1.inhibit-handle-lid-switch</interfacename> depending on the lock
734 type and mode taken.</para>
735
736 <para>The <varname>interactive</varname> boolean parameters can be used to control whether polkit
737 should interactively ask the user for authentication credentials if required.</para>
738 </refsect2>
739 </refsect1>
740
741 <refsect1>
742 <title>Seat Objects</title>
743
744 <programlisting executable="systemd-logind" node="/org/freedesktop/login1/seat/seat0" interface="org.freedesktop.login1.Seat">
745 node /org/freedesktop/login1/seat/seat0 {
746 interface org.freedesktop.login1.Seat {
747 methods:
748 Terminate();
749 ActivateSession(in s session_id);
750 SwitchTo(in u vtnr);
751 SwitchToNext();
752 SwitchToPrevious();
753 properties:
754 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
755 readonly s Id = '...';
756 readonly (so) ActiveSession = ...;
757 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
758 readonly b CanTTY = ...;
759 readonly b CanGraphical = ...;
760 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
761 readonly a(so) Sessions = [...];
762 readonly b IdleHint = ...;
763 readonly t IdleSinceHint = ...;
764 readonly t IdleSinceHintMonotonic = ...;
765 };
766 interface org.freedesktop.DBus.Peer { ... };
767 interface org.freedesktop.DBus.Introspectable { ... };
768 interface org.freedesktop.DBus.Properties { ... };
769 };
770 </programlisting>
771
772 <!--Autogenerated cross-references for systemd.directives, do not edit-->
773
774 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Seat"/>
775
776 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Seat"/>
777
778 <variablelist class="dbus-method" generated="True" extra-ref="Terminate()"/>
779
780 <variablelist class="dbus-method" generated="True" extra-ref="ActivateSession()"/>
781
782 <variablelist class="dbus-method" generated="True" extra-ref="SwitchTo()"/>
783
784 <variablelist class="dbus-method" generated="True" extra-ref="SwitchToNext()"/>
785
786 <variablelist class="dbus-method" generated="True" extra-ref="SwitchToPrevious()"/>
787
788 <variablelist class="dbus-property" generated="True" extra-ref="Id"/>
789
790 <variablelist class="dbus-property" generated="True" extra-ref="ActiveSession"/>
791
792 <variablelist class="dbus-property" generated="True" extra-ref="CanTTY"/>
793
794 <variablelist class="dbus-property" generated="True" extra-ref="CanGraphical"/>
795
796 <variablelist class="dbus-property" generated="True" extra-ref="Sessions"/>
797
798 <variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
799
800 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
801
802 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
803
804 <!--End of Autogenerated section-->
805
806 <refsect2>
807 <title>Methods</title>
808
809 <para><function>Terminate()</function> and <function>ActivateSession()</function> work similar to
810 TerminateSeat(), ActivationSessionOnSeat() on the Manager object.</para>
811
812 <para><function>SwitchTo()</function> switches to the session on the virtual terminal
813 <varname>vtnr</varname>. <function>SwitchToNext()</function> and
814 <function>SwitchToPrevious()</function> switch to, respectively, the next and previous sessions on the
815 seat in the order of virtual terminals. If there is no active session, they switch to, respectively,
816 the first and last session on the seat.</para>
817 </refsect2>
818
819 <refsect2>
820 <title>Signals</title>
821
822 <para>Whenever <function>ActiveSession</function>, <function>Sessions</function>,
823 <function>CanGraphical</function>, <function>CanTTY</function>,
824 or the idle state changes, <function>PropertyChanged</function> signals are sent out to which clients
825 can subscribe.</para>
826 </refsect2>
827
828 <refsect2>
829 <title>Properties</title>
830
831 <para>The <varname>Id</varname> property encodes the ID of the seat.</para>
832
833 <para><varname>ActiveSession</varname> encodes the currently active session if there is one. It is a
834 structure consisting of the session id and the object path.</para>
835
836 <para><varname>CanTTY</varname> encodes whether the session is suitable for text logins, and
837 <varname>CanGraphical</varname> whether it is suitable for graphical sessions.</para>
838
839 <para>The <varname>Sessions</varname> property is an array of all current sessions of this seat, each
840 encoded in a structure consisting of the ID and the object path.</para>
841
842 <para>The <varname>IdleHint</varname>, <varname>IdleSinceHint</varname>, and
843 <varname>IdleSinceHintMonotonic</varname> properties encode the idle state, similar to the ones exposed
844 on the <interfacename>Manager</interfacename> object, but specific for this seat.</para>
845 </refsect2>
846 </refsect1>
847
848 <refsect1>
849 <title>User Objects</title>
850
851 <programlisting executable="systemd-logind" node="/org/freedesktop/login1/user/_1000" interface="org.freedesktop.login1.User">
852 node /org/freedesktop/login1/user/_1000 {
853 interface org.freedesktop.login1.User {
854 methods:
855 Terminate();
856 Kill(in i signal_number);
857 properties:
858 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
859 readonly u UID = ...;
860 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
861 readonly u GID = ...;
862 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
863 readonly s Name = '...';
864 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
865 readonly t Timestamp = ...;
866 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
867 readonly t TimestampMonotonic = ...;
868 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
869 readonly s RuntimePath = '...';
870 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
871 readonly s Service = '...';
872 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
873 readonly s Slice = '...';
874 readonly (so) Display = ...;
875 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
876 readonly s State = '...';
877 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
878 readonly a(so) Sessions = [...];
879 readonly b IdleHint = ...;
880 readonly t IdleSinceHint = ...;
881 readonly t IdleSinceHintMonotonic = ...;
882 @org.freedesktop.DBus.Property.EmitsChangedSignal("false")
883 readonly b Linger = ...;
884 };
885 interface org.freedesktop.DBus.Peer { ... };
886 interface org.freedesktop.DBus.Introspectable { ... };
887 interface org.freedesktop.DBus.Properties { ... };
888 };
889 </programlisting>
890
891 <!--Autogenerated cross-references for systemd.directives, do not edit-->
892
893 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.User"/>
894
895 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.User"/>
896
897 <variablelist class="dbus-method" generated="True" extra-ref="Terminate()"/>
898
899 <variablelist class="dbus-method" generated="True" extra-ref="Kill()"/>
900
901 <variablelist class="dbus-property" generated="True" extra-ref="UID"/>
902
903 <variablelist class="dbus-property" generated="True" extra-ref="GID"/>
904
905 <variablelist class="dbus-property" generated="True" extra-ref="Name"/>
906
907 <variablelist class="dbus-property" generated="True" extra-ref="Timestamp"/>
908
909 <variablelist class="dbus-property" generated="True" extra-ref="TimestampMonotonic"/>
910
911 <variablelist class="dbus-property" generated="True" extra-ref="RuntimePath"/>
912
913 <variablelist class="dbus-property" generated="True" extra-ref="Service"/>
914
915 <variablelist class="dbus-property" generated="True" extra-ref="Slice"/>
916
917 <variablelist class="dbus-property" generated="True" extra-ref="Display"/>
918
919 <variablelist class="dbus-property" generated="True" extra-ref="State"/>
920
921 <variablelist class="dbus-property" generated="True" extra-ref="Sessions"/>
922
923 <variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
924
925 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
926
927 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
928
929 <variablelist class="dbus-property" generated="True" extra-ref="Linger"/>
930
931 <!--End of Autogenerated section-->
932
933 <refsect2>
934 <title>Methods</title>
935
936 <para><function>Terminate()</function> and <function>Kill()</function> work similar to the
937 <function>TerminateUser()</function> and <function>KillUser()</function> methods on the manager
938 object.</para>
939 </refsect2>
940
941 <refsect2>
942 <title>Signals</title>
943
944 <para>Whenever <varname>Sessions</varname> or the idle state changes,
945 <function>PropertyChanged</function> signals are sent out to which clients can subscribe.</para>
946 </refsect2>
947
948 <refsect2>
949 <title>Properties</title>
950
951 <para>The <varname>UID</varname> and <varname>GID</varname> properties encode the Unix UID and primary
952 GID of the user.</para>
953
954 <para>The <varname>Name</varname> property encodes the user name.</para>
955
956 <para><varname>Timestamp</varname> and <varname>TimestampMonotonic</varname> encode the login time of
957 the user in microseconds since the epoch, in the <constant>CLOCK_REALTIME</constant> and
958 <constant>CLOCK_MONOTONIC</constant> clocks, respectively.</para>
959
960 <para><varname>RuntimePath</varname> encodes the runtime path of the user,
961 i.e. <varname>$XDG_RUNTIME_DIR</varname>. For details see the
962 <ulink url="https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html">
963 XDG Basedir Specification
964 </ulink>.</para>
965
966 <para><varname>Service</varname> contains the unit name of the user systemd service of this
967 user. Each logged in user is assigned a user service that runs a user systemd instance. This is
968 usually an instance of <filename>user@.service</filename>.</para>
969
970 <para><varname>Slice</varname> contains the unit name of the user systemd slice of this user. Each
971 logged in user gets a private slice.</para>
972
973 <para><varname>Display</varname> encodes which graphical session should be used as the primary UI display
974 for the user. It is a structure encoding the session ID and the object path of the session to use.</para>
975
976 <para><varname>State</varname> encodes the user state and is one of <literal>offline</literal>,
977 <literal>lingering</literal>, <literal>online</literal>, <literal>active</literal>, or
978 <literal>closing</literal>. See
979 <citerefentry><refentrytitle>sd_uid_get_state</refentrytitle><manvolnum>3</manvolnum></citerefentry>
980 for more information about the states.</para>
981
982 <para><varname>Sessions</varname> is an array of structures encoding all current sessions of the
983 user. Each structure consists of the ID and object path.</para>
984
985 <para>The <varname>IdleHint</varname>, <varname>IdleSinceHint</varname>, and
986 <varname>IdleSinceHintMonotonic</varname> properties encode the idle hint state of the user, similar to
987 the <interfacename>Manager</interfacename>'s properties, but specific for this user.</para>
988
989 <para>The <varname>Linger</varname> property shows whether lingering is enabled for this user.</para>
990 </refsect2>
991 </refsect1>
992
993 <refsect1>
994 <title>Session Objects</title>
995
996 <programlisting executable="systemd-logind" node="/org/freedesktop/login1/session/1" interface="org.freedesktop.login1.Session">
997 node /org/freedesktop/login1/session/1 {
998 interface org.freedesktop.login1.Session {
999 methods:
1000 Terminate();
1001 Activate();
1002 Lock();
1003 Unlock();
1004 SetIdleHint(in b idle);
1005 SetLockedHint(in b locked);
1006 Kill(in s who,
1007 in i signal_number);
1008 TakeControl(in b force);
1009 ReleaseControl();
1010 SetType(in s type);
1011 TakeDevice(in u major,
1012 in u minor,
1013 out h fd,
1014 out b inactive);
1015 ReleaseDevice(in u major,
1016 in u minor);
1017 PauseDeviceComplete(in u major,
1018 in u minor);
1019 SetBrightness(in s subsystem,
1020 in s name,
1021 in u brightness);
1022 signals:
1023 PauseDevice(u major,
1024 u minor,
1025 s type);
1026 ResumeDevice(u major,
1027 u minor,
1028 h fd);
1029 Lock();
1030 Unlock();
1031 properties:
1032 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1033 readonly s Id = '...';
1034 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1035 readonly (uo) User = ...;
1036 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1037 readonly s Name = '...';
1038 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1039 readonly t Timestamp = ...;
1040 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1041 readonly t TimestampMonotonic = ...;
1042 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1043 readonly u VTNr = ...;
1044 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1045 readonly (so) Seat = ...;
1046 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1047 readonly s TTY = '...';
1048 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1049 readonly s Display = '...';
1050 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1051 readonly b Remote = ...;
1052 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1053 readonly s RemoteHost = '...';
1054 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1055 readonly s RemoteUser = '...';
1056 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1057 readonly s Service = '...';
1058 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1059 readonly s Desktop = '...';
1060 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1061 readonly s Scope = '...';
1062 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1063 readonly u Leader = ...;
1064 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1065 readonly u Audit = ...;
1066 readonly s Type = '...';
1067 @org.freedesktop.DBus.Property.EmitsChangedSignal("const")
1068 readonly s Class = '...';
1069 readonly b Active = ...;
1070 readonly s State = '...';
1071 readonly b IdleHint = ...;
1072 readonly t IdleSinceHint = ...;
1073 readonly t IdleSinceHintMonotonic = ...;
1074 readonly b LockedHint = ...;
1075 };
1076 interface org.freedesktop.DBus.Peer { ... };
1077 interface org.freedesktop.DBus.Introspectable { ... };
1078 interface org.freedesktop.DBus.Properties { ... };
1079 };
1080 </programlisting>
1081
1082 <!--Autogenerated cross-references for systemd.directives, do not edit-->
1083
1084 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Session"/>
1085
1086 <variablelist class="dbus-interface" generated="True" extra-ref="org.freedesktop.login1.Session"/>
1087
1088 <variablelist class="dbus-method" generated="True" extra-ref="Terminate()"/>
1089
1090 <variablelist class="dbus-method" generated="True" extra-ref="Activate()"/>
1091
1092 <variablelist class="dbus-method" generated="True" extra-ref="Lock()"/>
1093
1094 <variablelist class="dbus-method" generated="True" extra-ref="Unlock()"/>
1095
1096 <variablelist class="dbus-method" generated="True" extra-ref="SetIdleHint()"/>
1097
1098 <variablelist class="dbus-method" generated="True" extra-ref="SetLockedHint()"/>
1099
1100 <variablelist class="dbus-method" generated="True" extra-ref="Kill()"/>
1101
1102 <variablelist class="dbus-method" generated="True" extra-ref="TakeControl()"/>
1103
1104 <variablelist class="dbus-method" generated="True" extra-ref="ReleaseControl()"/>
1105
1106 <variablelist class="dbus-method" generated="True" extra-ref="SetType()"/>
1107
1108 <variablelist class="dbus-method" generated="True" extra-ref="TakeDevice()"/>
1109
1110 <variablelist class="dbus-method" generated="True" extra-ref="ReleaseDevice()"/>
1111
1112 <variablelist class="dbus-method" generated="True" extra-ref="PauseDeviceComplete()"/>
1113
1114 <variablelist class="dbus-method" generated="True" extra-ref="SetBrightness()"/>
1115
1116 <variablelist class="dbus-signal" generated="True" extra-ref="PauseDevice"/>
1117
1118 <variablelist class="dbus-signal" generated="True" extra-ref="ResumeDevice"/>
1119
1120 <variablelist class="dbus-signal" generated="True" extra-ref="Lock"/>
1121
1122 <variablelist class="dbus-signal" generated="True" extra-ref="Unlock"/>
1123
1124 <variablelist class="dbus-property" generated="True" extra-ref="Id"/>
1125
1126 <variablelist class="dbus-property" generated="True" extra-ref="User"/>
1127
1128 <variablelist class="dbus-property" generated="True" extra-ref="Name"/>
1129
1130 <variablelist class="dbus-property" generated="True" extra-ref="Timestamp"/>
1131
1132 <variablelist class="dbus-property" generated="True" extra-ref="TimestampMonotonic"/>
1133
1134 <variablelist class="dbus-property" generated="True" extra-ref="VTNr"/>
1135
1136 <variablelist class="dbus-property" generated="True" extra-ref="Seat"/>
1137
1138 <variablelist class="dbus-property" generated="True" extra-ref="TTY"/>
1139
1140 <variablelist class="dbus-property" generated="True" extra-ref="Display"/>
1141
1142 <variablelist class="dbus-property" generated="True" extra-ref="Remote"/>
1143
1144 <variablelist class="dbus-property" generated="True" extra-ref="RemoteHost"/>
1145
1146 <variablelist class="dbus-property" generated="True" extra-ref="RemoteUser"/>
1147
1148 <variablelist class="dbus-property" generated="True" extra-ref="Service"/>
1149
1150 <variablelist class="dbus-property" generated="True" extra-ref="Desktop"/>
1151
1152 <variablelist class="dbus-property" generated="True" extra-ref="Scope"/>
1153
1154 <variablelist class="dbus-property" generated="True" extra-ref="Leader"/>
1155
1156 <variablelist class="dbus-property" generated="True" extra-ref="Audit"/>
1157
1158 <variablelist class="dbus-property" generated="True" extra-ref="Type"/>
1159
1160 <variablelist class="dbus-property" generated="True" extra-ref="Class"/>
1161
1162 <variablelist class="dbus-property" generated="True" extra-ref="Active"/>
1163
1164 <variablelist class="dbus-property" generated="True" extra-ref="State"/>
1165
1166 <variablelist class="dbus-property" generated="True" extra-ref="IdleHint"/>
1167
1168 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHint"/>
1169
1170 <variablelist class="dbus-property" generated="True" extra-ref="IdleSinceHintMonotonic"/>
1171
1172 <variablelist class="dbus-property" generated="True" extra-ref="LockedHint"/>
1173
1174 <!--End of Autogenerated section-->
1175
1176 <refsect2>
1177 <title>Methods</title>
1178
1179 <para><function>Terminate()</function>, <function>Activate()</function>, <function>Lock()</function>,
1180 <function>Unlock()</function>, and <function>Kill()</function> work similarly to the respective calls on
1181 the <interfacename>Manager</interfacename> object.</para>
1182
1183 <para><function>SetIdleHint()</function> is called by the session object to update the idle state
1184 of the session whenever it changes.</para>
1185
1186 <para><function>TakeControl()</function> allows a process to take exclusive managed device
1187 access-control for that session. Only one D-Bus connection can be a controller for a given session at any
1188 time. If the <varname>force</varname> argument is set (root only), an existing controller is kicked
1189 out and replaced. Otherwise, this method fails if there is already a controller. Note that this method is
1190 limited to D-Bus users with the effective UID set to the user of the session or root.</para>
1191
1192 <para><function>ReleaseControl()</function> drops control of a given session. Closing the D-Bus
1193 connection implicitly releases control as well. See <function>TakeControl()</function> for more
1194 information. This method also releases all devices for which the controller requested ownership via
1195 <function>TakeDevice()</function>.</para>
1196
1197 <para><function>SetType()</function> allows the type of the session to be changed dynamically. It can
1198 only be called by session's current controller. If <function>TakeControl()</function> has not been
1199 called, this method will fail. In addition, the session type will be reset to its original value once
1200 control is released, either by calling <function>ReleaseControl()</function> or closing the D-Bus
1201 connection. This should help prevent a session from entering an inconsistent state, for example if the
1202 controller crashes. The only argument <varname>type</varname> is the new session type.</para>
1203
1204 <para><function>TakeDevice()</function> allows a session controller to get a file descriptor for a
1205 specific device. Pass in the major and minor numbers of the character device and
1206 <filename>systemd-logind</filename> will return a file descriptor for the device. Only a limited set of
1207 device-types is currently supported (but may be extended). <filename>systemd-logind</filename>
1208 automatically mutes the file descriptor if the session is inactive and resumes it once the session is
1209 activated again. This guarantees that a session can only access session devices if the session is
1210 active. Note that this revoke/resume mechanism is asynchronous and may happen at any given time. This
1211 only works on devices that are attached to the seat of the given session. A process is not required to
1212 have direct access to the device node. <filename>systemd-logind</filename> only requires you to be the
1213 active session controller (see <function>TakeControl()</function>). Also note that any device can only
1214 be requested once. As long as you don't release it, further <function>TakeDevice()</function> calls
1215 will fail.</para>
1216
1217 <para><function>ReleaseDevice()</function> releases a device again (see
1218 <function>TakeDevice()</function>). This is also implicitly done by
1219 <function>ReleaseControl()</function> or when closing the D-Bus connection.</para>
1220
1221 <para><function>PauseDeviceComplete()</function> allows a session controller to synchronously pause a
1222 device after receiving a <function>PauseDevice(<literal>pause</literal>)</function> signal. Forced
1223 signals (or after an internal timeout) are automatically completed by
1224 <filename>systemd-logind</filename> asynchronously.</para>
1225
1226 <para><function>SetLockedHint()</function> may be used to set the "locked hint" to
1227 <varname>locked</varname>, i.e. information whether the session is locked. This is intended to be used
1228 by the desktop environment to tell <command>systemd-logind</command> when the session is locked and
1229 unlocked.</para>
1230
1231 <para><function>SetBrightness()</function> may be used to set the display brightness. This is intended
1232 to be used by the desktop environment and allows unprivileged programs to access hardware settings in
1233 a controlled way. The <varname>subsystem</varname> parameter specifies a kernel subsystem, either
1234 <literal>backlight</literal> or <literal>leds</literal>. The <varname>name</varname> parameter
1235 specifies a device name under the specified subsystem. The <varname>brightness</varname> parameter
1236 specifies the brightness. The range is defined by individual drivers, see
1237 <filename>/sys/class/<varname>subsystem</varname>/<varname>name</varname>/max_brightness</filename>.
1238 </para>
1239 </refsect2>
1240
1241 <refsect2>
1242 <title>Signals</title>
1243
1244 <para>The active session controller exclusively gets <function>PauseDevice</function> and
1245 <function>ResumeDevice</function> events for any device it requested via
1246 <function>TakeDevice()</function>. They notify the controller whenever a device is paused or resumed. A
1247 device is never resumed if its session is inactive. Also note that <function>PauseDevice</function>
1248 signals are sent before the <function>PropertyChanged</function> signal for the
1249 <function>Active</function> state. The inverse is true for <function>ResumeDevice</function>. A device
1250 may remain paused for unknown reasons even though the <interfacename>Session</interfacename> is active.
1251 </para>
1252
1253 <para>A <function>PauseDevice</function> signal carries the major and minor numbers and a string describing the
1254 type as arguments. <function>force</function> means the device was already paused by
1255 <filename>systemd-logind</filename> and the signal is only an asynchronous
1256 notification. <function>pause</function> means <filename>systemd-logind</filename> grants you a limited amount of time to pause the device. You must respond to this via
1257 <function>PauseDeviceComplete()</function>. This synchronous pausing mechanism is used for
1258 backwards-compatibility to VTs and <filename>systemd-logind</filename> is free to not make use of
1259 it. It is also free to send a forced <function>PauseDevice</function> if you don't respond in a timely
1260 manner (or for any other reason). <function>gone</function> means the device was unplugged from the
1261 system and you will no longer get any notifications about it. There is no need to call
1262 <function>ReleaseDevice()</function>. You may call <function>TakeDevice()</function> again if a new
1263 device is assigned the major+minor combination.</para>
1264
1265 <para><function>ResumeDevice</function> is sent whenever a session is active and a device is
1266 resumed. It carries the major/minor numbers as arguments and provides a new open file descriptor. You should
1267 switch to the new descriptor and close the old one. They are not guaranteed to have the same underlying
1268 open file descriptor in the kernel (except for a limited set of device types).</para>
1269
1270 <para>Whenever <function>Active</function> or the idle state changes,
1271 <function>PropertyChanged</function> signals are sent out to which clients can subscribe.</para>
1272
1273 <para><function>Lock</function>/<function>Unlock</function> is sent when the session is asked to be
1274 screen-locked/unlocked. A session manager of the session should listen to this signal and act
1275 accordingly. This signal is sent out as a result of the <function>Lock()</function> and
1276 <function>Unlock()</function> methods, respectively.</para>
1277 </refsect2>
1278
1279 <refsect2>
1280 <title>Properties</title>
1281
1282 <para><varname>Id</varname> encodes the session ID.</para>
1283
1284 <para><varname>User</varname> encodes the user ID of the user this session belongs to. This is a
1285 structure consisting of the Unix UID and the object path.</para>
1286
1287 <para><varname>Name</varname> encodes the user name.</para>
1288
1289 <para><varname>Timestamp</varname> and <varname>TimestampMonotonic</varname> encode the microseconds
1290 since the epoch when the session was created, in <constant>CLOCK_REALTIME</constant> or
1291 <constant>CLOCK_MONOTONIC</constant>, respectively.</para>
1292
1293 <para><varname>VTNr</varname> encodes the virtual terminal number of the session if there is any, 0
1294 otherwise.</para>
1295
1296 <para><varname>Seat</varname> encodes the seat this session belongs to if there is any. This is a
1297 structure consisting of the ID and the seat object path.</para>
1298
1299 <para><varname>TTY</varname> encodes the kernel TTY path of the session if this is a text login. If not
1300 this is an empty string.</para>
1301
1302 <para><varname>Display</varname> encodes the X11 display name if this is a graphical login. If not,
1303 this is an empty string.</para>
1304
1305 <para><varname>Remote</varname> encodes whether the session is local or remote.</para>
1306
1307 <para><varname>RemoteHost</varname> and <varname>RemoteUser</varname> encode the remote host and user
1308 if this is a remote session, or an empty string otherwise.</para>
1309
1310 <para><varname>Service</varname> encodes the PAM service name that registered the session.</para>
1311
1312 <para><varname>Desktop</varname> describes the desktop environment running in the session (if
1313 known).</para>
1314
1315 <para><varname>Scope</varname> contains the systemd scope unit name of this session.</para>
1316
1317 <para><varname>Leader</varname> encodes the PID of the process that registered the session.</para>
1318
1319 <para><varname>Audit</varname> encodes the Kernel Audit session ID of the session if auditing is
1320 available.</para>
1321
1322 <para><varname>Type</varname> encodes the session type. It's one of <literal>unspecified</literal> (for
1323 cron PAM sessions and suchlike), <literal>tty</literal> (for text logins) or
1324 <literal>x11</literal>/<literal>mir</literal>/<literal>wayland</literal> (for graphical logins).</para>
1325
1326 <para><varname>Class</varname> encodes the session class. It's one of <literal>user</literal> (for
1327 normal user sessions), <literal>greeter</literal> (for display manager pseudo-sessions), or
1328 <literal>lock-screen</literal> (for display lock screens).</para>
1329
1330 <para><varname>Active</varname> is a boolean that is true if the session is active, i.e. currently in the
1331 foreground. This field is semi-redundant due to <varname>State</varname>.</para>
1332
1333 <para><varname>State</varname> encodes the session state and one of <literal>online</literal>,
1334 <literal>active</literal>, or <literal>closing</literal>. See
1335 <citerefentry><refentrytitle>sd_session_get_state</refentrytitle><manvolnum>3</manvolnum></citerefentry>
1336 for more information about the states.</para>
1337
1338 <para><varname>IdleHint</varname>, <varname>IdleSinceHint</varname>, and
1339 <varname>IdleSinceHintMonotonic</varname> encapsulate the idle hint state of this session, similarly to
1340 how the respective properties on the manager object do it for the whole system.</para>
1341
1342 <para><varname>LockedHint</varname> shows the locked hint state of this session, as set by the
1343 <function>SetLockedHint()</function> method described above.</para>
1344 </refsect2>
1345 </refsect1>
1346
1347 <refsect1>
1348 <title>Examples</title>
1349
1350 <example>
1351 <title>Introspect <interfacename>org.freedesktop.login1.Manager</interfacename> on the bus</title>
1352
1353 <programlisting>$ gdbus introspect --system --dest org.freedesktop.login1 \
1354 --object-path /org/freedesktop/login1
1355 </programlisting>
1356 </example>
1357
1358 <example>
1359 <title>Introspect <interfacename>org.freedesktop.login1.Seat</interfacename> on the bus</title>
1360
1361 <programlisting>$ gdbus introspect --system --dest org.freedesktop.login1 \
1362 --object-path /org/freedesktop/login1/seat/seat0
1363 </programlisting>
1364 </example>
1365
1366 <example>
1367 <title>Introspect <interfacename>org.freedesktop.login1.User</interfacename> on the bus</title>
1368
1369 <programlisting>$ gdbus introspect --system --dest org.freedesktop.login1 \
1370 --object-path /org/freedesktop/login1/user/_1000
1371 </programlisting>
1372 </example>
1373
1374 <example>
1375 <title>Introspect <interfacename>org.freedesktop.login1.Session</interfacename> on the bus</title>
1376
1377 <programlisting>$ gdbus introspect --system --dest org.freedesktop.login1 \
1378 --object-path /org/freedesktop/login1/session/45
1379 </programlisting>
1380 </example>
1381 </refsect1>
1382
1383 <refsect1>
1384 <title>Versioning</title>
1385
1386 <para>These D-Bus interfaces follow <ulink url="http://0pointer.de/blog/projects/versioning-dbus.html">
1387 the usual interface versioning guidelines</ulink>.</para>
1388 </refsect1>
1389 </refentry>