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