Part of Sunlight Linux · slinit · slpam · slinstaller · slkernel · slpkgs · sldocs · slmanifests
The PAM module that registers logins with slinit-logind, so a system
can log users in without pam_elogind.so. pam_slinit.so is loaded
into login, sshd, su and display managers; at session open it calls
CreateSession on org.freedesktop.login1, and at close
ReleaseSession. slpam-audit checks a system's PAM stacks before and
after the change, and prints the change itself as a diff (--migrate). libslinit-login answers the sd-login calls programs
make through libelogind, from slinit-logind's records, so that
libelogind.so.0 can go too (docs/LIBSLINIT-LOGIN.md).
| Project | Details |
|---|---|
| Latest release | v1.14.0 (2026-12-01) — see CHANGELOG.md |
| Works with | slinit-logind 3.16+, or elogind — see Compatibility for what each version gives |
| Requires | libpam and libdbus-1 (pam-devel, dbus-devel to build); the built module needs exactly libc, libdbus-1 and libpam |
| License | Apache 2.0, except the functions slpam-audit ported from Linux-PAM (tools/pamconf.c) and OpenSSH (tools/sshconf.c), under their own licences (NOTICE) |
slinit-logind already owns
org.freedesktop.login1 — sessions, seats, users, inhibitors, sleep;
this module is the login hook that was missing, and it follows the
rules pam_systemd (systemd v262) applies before CreateSession, so a
session looks the same to the daemon whichever module registered it.
It is written in C against libdbus-1 rather than in Go or against
sd-bus, because it is dlopened into privileged processes that fork;
docs/DESIGN.md has the evidence.
Deliberately out of scope: the packaging that removes elogind from a
system, which is Sunlight's (slpkgs); sd-bus and sd-event, which the
programs that need them get from basu rather than from here; enforcing session resource limits, which the module
sends and the daemon applies (slinit-logind after 4.8.0); systemd's
user service manager (slinit-logind starts slinit's own, from the class
the module picks); the Varlink services other than io.systemd.Login,
which it registers sessions with; and the userdb services behind
systemd's JSON user records (the module reads the records' drop-in
files; there is no userdbd).
New here? Read docs/MIGRATING.md: moving a system from
pam_elogind.soto this module, checking it worked, and going back.
make # src/pam_slinit.so, tools/slpam-audit, lib/libslinit-login.so.0
make check # the built object: two symbols, NODELETE, three libraries
make check-lib # the library: its 99 symbols and versions (libelogind's 80, 19 newer), libc only
sudo make install # module, slpam-audit, libslinit-login, the manual pages, NOTICEmake install-elogind-compat also links libelogind.so.0 to
libslinit-login.so.0, for programs already built against libelogind.
It is separate from install because that link replaces a file the
libelogind package owns (docs/LIBSLINIT-LOGIN.md).
| Installed | Default path (PREFIX=/usr) |
|---|---|
pam_slinit.so |
$(PREFIX)/lib/security (SECURITYDIR) |
slpam-audit |
$(PREFIX)/bin (BINDIR) |
pam_slinit.8, slpam-audit.8 |
$(PREFIX)/share/man/man8 (MAN8DIR) |
NOTICE |
$(PREFIX)/share/doc/slpam (DOCDIR) |
libslinit-login.so.0, headers, libslinit-login.pc |
$(PREFIX)/lib, $(PREFIX)/include/slinit-login, $(PREFIX)/lib/pkgconfig |
The system bus address is compiled in (SYSTEM_BUS_ADDRESS, by default
what dbus-1.pc says) and never read from the environment; override it
only to point a test build at a private bus.
slpam-audit # is the PAM stack safe for it? (reads only)
slpam-audit --migrate # the change, as a diff to read
slpam-audit --migrate | patch -d / -p1 # and to applyThat changes, in the shared login stack (/etc/pam.d/system-login on
Void, common-session on Debian) and in every other file that names it,
pam_elogind.so to pam_slinit.so; by hand, the line becomes:
-session optional pam_slinit.so
Log in on another console and check echo $XDG_SESSION_ID. On Void,
the display managers' greeter stacks name pam_elogind.so directly as
well; --migrate changes them too, and
docs/MIGRATING.md lists them. On Sunlight,
pam-base 0.4_5 already has this line.
No XDG_SESSION_ID? Add debug to the module's line, log in again and
read the log: docs/TROUBLESHOOTING.md explains
every message the module writes.
| Area | Behaviour |
|---|---|
| Registration | io.systemd.Login.CreateSession over Varlink, as pam_systemd, falling back to D-Bus CreateSessionWithPIDFD, then CreateSession; type, class, desktop, seat and VT from XDG_* in the PAM environment, then the process environment, then type=, class=, desktop=; the VT of an X display asked of the X server |
| Release | ReleaseSession at close, only for a session this handle created; a session also ends with its leader process |
| Exported | XDG_SESSION_ID, XDG_SESSION_TYPE, XDG_SESSION_CLASS, XDG_SESSION_DESKTOP, XDG_SEAT, XDG_VTNR, XDG_RUNTIME_DIR (when it exists and is the user's), DBUS_SESSION_BUS_ADDRESS (when a user bus listens), HOME |
As pam_systemd |
inhibitor lock (inhibit=), areas (area=), OSC 3008 session markers, shell credentials, capability sets (default-capability-bounding-set=, default-capability-ambient-set=), session resource limits from pam_set_data() sent as CreateSession properties |
| Failure | a login that fails after the session was created releases it and removes what it exported; SessionBusy (su, sudo) is success with no session; class none registers nothing |
| Untrusted input | no DBUS_SYSTEM_BUS_ADDRESS; non-UTF-8 strings left out instead of letting libdbus abort; the bus handshake bounded to ten seconds |
slpam-audit |
follows each service's stack through its includes the way libpam does, and reports pam_env.so user_readenv=1 ahead of the module, AcceptEnv/PermitUserEnvironment reaching XDG_*, a second session module, ignored arguments; --root audits an installer's target |
Where it still differs from pam_systemd and pam_elogind, and why, is
in docs/DESIGN.md.
| Daemon | What the module gets from it |
|---|---|
| slinit-logind 3.16+ | CreateSessionWithPIDFD; older versions get CreateSession and the pid |
| slinit-logind 4.0.6+ (4.0 line), 4.1.1+ | The session's cgroup is removed at logout; 4.1.0 itself leaves an empty cgroup per logout |
| slinit-logind 4.9.0+ | Session limits (systemd.memory_max and the rest) are applied |
| slinit-logind 4.11.0+ | Registration over Varlink (io.systemd.Login), and with it XDG_SESSION_EXTRA_DEVICE_ACCESS, which only Varlink carries; without it the module uses D-Bus |
| elogind | Works; its session FIFO is kept until logout. The classes elogind 252 does not know (user-early, user-light, user-incomplete, background-light) are registered as user or background after a first refusal, with a warning at each such login — root's and system users' logins included |
The module opens and releases sessions, and is in use on Sunlight:
pam-base 0.4_5 names it in system-login (and no longer loads
pam_dumb_runtime_dir.so after it), so console and ssh logins go
through it, and sddm 0.21.0_3 names it in sddm-greeter. Since
slpkgs' next of 2026-11-29 (snapshot tag
next-2026-11-29-b7a77e033a24)
gdm, lightdm and xdm name it too, the desktop metapackages
depend on slpam instead of elogind, and the elogind package is no
longer needed; a demo VM ran SDDM, GDM and LightDM sessions without it.
libelogind can go as well: since 2026-11-29 slpkgs' next has libslinit-login-elogind, which provides
libelogind.so.0 from libslinit-login and replaces the libelogind
package, and conflicts with the older builds of the packages that also
use sd-bus, which are rebuilt against basu. slpam-audit on a demo VM (November 2026)
found no error or warning; no test suite covers a display manager or a
console login on a real VT.
TODO.md lists what remains;
the plan for dropping the elogind
package
covers the distribution side.
| Document | Contents |
|---|---|
| docs/MIGRATING.md | Start here: moving a system from pam_elogind.so, checking it, going back |
man pam_slinit (man/pam_slinit.8) |
The administrator's reference: every argument, variable, return value, example stacks |
man slpam-audit (man/slpam-audit.8) |
What the audit checks, and why each finding matters |
| docs/TROUBLESHOOTING.md | Every message the module logs, what it means and what to do |
| docs/USER-RECORDS.md | Per-user settings (umask, environment, language, time zone, limits) with systemd JSON user records in /etc/userdb |
| docs/DESIGN.md | The decisions and their evidence (C, libdbus-1, the session lifetime), what the module sends, what it does not trust, where it differs from pam_systemd |
| docs/ARCHITECTURE.md | The source files, what each owns, and where a change goes |
| docs/TESTING.md | What each test suite runs, against what, and what none of them shows |
| docs/LIBSLINIT-LOGIN.md | The library that replaces libelogind: what it answers, where it matches libelogind's oddities and where it differs |
| examples/pam.d/ | A migrated Void login stack and a greeter stack, to compare against |
| TODO.md | What remains, in order |
| CHANGELOG.md | Release history, and what an operator will notice |
| CONTRIBUTING.md | How to work on a module that can lock you out, and how to submit |
| SECURITY.md | Reporting a bypass or a lockout |
In sldocs, the cross-repository view: the login-session architecture, the requirement that login not depend on elogind, and the plan for dropping the elogind package.
make test # session rules, options, capabilities, limits, OSC, areas, JSON: no PAM, no bus
make test-san # the same under ASan and UBSan
make test-audit # slpam-audit against the fixture trees in tests/audit
make e2e # the module in a real PAM application, against a mock daemon
make integration LOGIND=... # login(1) and sshd against slinit-logind, in Docker
tests/integration/pam-elogind.sh LOGIND # elogind's own pam_elogind.so against slinit-logind, in Docker
tests/audit-differential/run.sh # slpam-audit against libpam and sshd -T (root, in a container)
make fuzz # libFuzzer over the parsers, FUZZ_SECONDS (60) long; needs clang
make lint-man # the manual pages through mandoc -Tlint, warnings fatal
make test-lib # libslinit-login against fixture trees, plain and under ASan/UBSan
tests/lib/differential.sh LIBELOGIND # libslinit-login against libelogind, answer by answermake e2e also needs dbus-daemon and python3 with dbus and gi;
with SLPAM_E2E_LOGIND or SLPAM_E2E_ELOGIND naming a daemon, and as
root in a privileged container, it runs the same cases against the real
slinit-logind or elogind. Nothing touches the machine's own /etc/pam.d
or bus. CI runs all of it, except tests/lib/differential -p (a live
system), on every pull request and every push to main, with gcc and
clang, two static analysers and on musl. None of it shows a display manager or a console
login on a real VT. docs/TESTING.md has what each
suite covers.
CONTRIBUTING.md first: a bug in a PAM module is a
machine nobody can log into, so develop in a local VM with console
access. The short version: make && make check && make test && make e2e
must pass, and the pull request says how the change was tested.
Apache License 2.0, with the exceptions listed in NOTICE.