Red Hat Training

A Red Hat training course is available for Red Hat Enterprise Linux

Chapter 2. logind

logind (or more specifically systemd-logind) is a system service that manages user logins. This service is responsible for the following:
  • keeping track of users and sessions, their processes and their idle states,
  • creating control groups for user processes,
  • providing PolicyKit-based access for users to operations such as system shutdown or sleep,
  • implementing a shutdown/sleep inhibition logic for applications,
  • handling of power/sleep hardware keys,
  • multi-seat management, session switch management, and device access management for users,
  • automatic spawning of text logins (gettys) on virtual terminal (console) activation and user runtime directory management.
The logind service is deeply integrated with systemd, the new initialization system in Red Hat Enterprise Linux 7, and replaces the upstart initialization system from Red Hat Enterprise Linux 6. With this change comes a number of new features and functions. The following is a summary of those most significant:
ConsoleKit
The ConsoleKit framework is deprecated in Red Hat Enterprise Linux 7. Equivalent functionality is now provided by systemd. Both ConsoleKit and logind are services for tracking the currently running user sessions.

Note

ConsoleKit had the ability to run arbitrary shell scripts any time the active session on the system changed (using virtual terminal switching). This functionality is no longer provided.
the /var/log/ConsoleKit/history file
Previously, ConsoleKit was sending log files to /var/log/ConsoleKit/history, which the present logind does not support. The file has been replaced by the traditional wtmp and utmp files which now keep track of all logins and logouts on the system. /var/log/ConsoleKit/history provided similar information as the wtmp file, though in a different format. Given the overlap in functionality, logind only adopted the wtmp file's role.
seat.d scripts
Since ConsoleKit is no longer in use, seat.d scripts no longer complement the ConsoleKit framework, and have been replaced by systemd-logind.
the ck-list-sessions command
ConsoleKit provided the ck-list-sessions command, which returned extended information about recent users, not only regular users but also GUI access with GDM. The comparable result can now be reached by running the loginctl command:
$ loginctl list-sessions
multi-seat support
logind along with GDM provide the multi-seat feature with which the user can attach another monitor, mouse, or keyboard to their machine. Doing so, an additional login screen appears and the user can log in as if they were using another machine.
To list seats that are available on the system, run the following command:
$ loginctl list-seats
To show the status of a specific seat on the system, run the following command:
$ loginctl seat-status seat
where seat is the name of the seat, for example seat0.
To assign specific hardware to a particular seat, run the following command:
# loginctl attach seat device
where seat is the name of the seat, for example seat1, and device is the device name specified with the /sys device path, for example /sys/devices/pci0000:00/0000:00:02.0/drm/card0.
To change the assignment, assign the hardware to a different seat, or use the loginctl flush-devices command.

Getting More Information

systemd-logind.service(8) – The man page for logind provides more information on the logind usage and features. It also covers the APIs systemd-logind provides (logind D-Bus API documentation).
logind.conf(5) – The man page for logind.conf discusses the login manager configuration file.
loginctl(1) – The man page for the systemd login manager includes more information on the multi-seat feature.