PAM_ELOGIND(8)
π PAM_ELOGIND(8) β the pam_elogind page, bestie edition π
okay so this is section 8 of the manual, all about pam_elogind β the PAM module that gets your user sessions registered with the elogind login manager. yes we're doing this. buckle up π
β¨ NAME β¨
pam_elogind β registers user sessions in the elogind login manager π«Ά
β¨ SYNOPSIS β¨
pam_elogind.so
that's it. that's the whole synopsis. iconic minimalist behavior π
πΈ DESCRIPTION πΈ
so pam_elogind registers user sessions with the elogind(8) login manager β and by extension, with the elogind control group hierarchy. main character module honestly π
the module also applies all the resource management and runtime parameters to the brand-new session, exactly as configured in the user's JSON User Records[1] β but only when one is actually defined for that user. no record, no fancy params, that's the vibe.
On login, this module makes sure of the following, no cap:
- if it doesn't exist yet, the user runtime directory
/run/user/$UIDis either created or mounted as a new"tmpfs"file system with quota applied β and its ownership is changed over to the user who's logging in π§ - the
$XDG_SESSION_IDenvironment variable gets initialized. if auditing is available andpam_loginuid.sowas run before this module (which is highly recommended, fr fr), then the variable is initialized from the auditing session id (/proc/self/sessionid). otherwise, an independent session counter is used. - the
"$TZ","$EMAIL"and"$LANG"environment variables are configured for the user, based on the respective data from the user's JSON record (if it's defined). on top of that, any environment variables explicitly configured in the user record get imported, and the umask, nice level, and resource limits are initialized too β¨
On logout, this module ensures:
- if it's enabled in
logind.conf(5)(KillUserProcesses=), all processes of the session are terminated π. and if the last concurrent session of a user ends, the user's elogind instance gets terminated too β and so does the user's slice unit. whole thing wraps up, periodt. - if the last concurrent session of a user ends, the user runtime directory
/run/user/$UIDand every single thing inside it gets removed too π«§
heads up bestie: if the system was not booted up with elogind as init system, this module does absolutely nothing and immediately returns PAM_SUCCESS. like, it's just gonna vibe there. π
π¦ OPTIONS π¦
here's everything the module understands:
class=β takes a string argument which sets the session class. theXDG_SESSION_CLASSenvironment variable (peep below) takes precedence. one of"user","greeter","lock-screen"or"background". seesd_session_get_class(3)for the deets about the session class.
Added in version 197.
type=β takes a string argument which sets the session type. theXDG_SESSION_TYPEenvironment variable (below, keep scrolling) takes precedence. one of"unspecified","tty","x11","wayland"or"mir". seesd_session_get_type(3)for details about the session type.
Added in version 209.
desktop=β takes a single, short identifier string for the desktop environment. theXDG_SESSION_DESKTOPenvironment variable (yep, below) takes precedence. this may be used to indicate the session desktop used, where this applies and if this information is available. for example:"GNOME", or"KDE". it's recommended to use the same identifiers and capitalization as for$XDG_CURRENT_DESKTOP, as defined by the Desktop Entry Specification[2]. (but like, note that the option only takes a single item, and not a colon-separated list like$XDG_CURRENT_DESKTOPdoes. so don't try it π ) seesd_session_get_desktop(3)for further details.
Added in version 240.
default-capability-bounding-set=,default-capability-ambient-set=β takes a comma-separated list of process capabilities (e.g.CAP_WAKE_ALARM,CAP_BLOCK_SUSPEND, ...) to set for the invoked session's processes, if the user record doesn't encode appropriate sets of capabilities directly. seecapabilities(7)for the whole capabilities concept. if not specified, the default bounding set is left as is (i.e. usually contains the full set of capabilities). the default ambient set is set toCAP_WAKE_ALARMfor regular users if the PAM session is associated with a local seat. otherwise, it defaults to the empty set.
Added in version 254.
debug[=]β takes an optional boolean argument. if yes, or with no argument at all, the module will log debugging information as it operates π
π§ MODULE TYPES PROVIDED π§
only session is provided. one module type, one job, no multitasking π
π ENVIRONMENT π
the following environment variables are initialized by the module and are available to the processes of the user's session:
$XDG_SESSION_IDβ a short session identifier, suitable to be used in filenames. the string itself should be considered opaque, although often it's just the audit session ID as reported by/proc/self/sessionid. each ID will be assigned only once during machine uptime. it may hence be used to uniquely label files or other resources of this session. combine this ID with the boot identifier, as returned bysd_id128_get_boot(3), for a globally unique identifier β¨$XDG_RUNTIME_DIRβ path to a user-private, user-writable directory that is bound to the user login time on the machine. it's automatically created the first time a user logs in and removed on the user's final logout. if a user logs in twice at the same time, both sessions will see the same$XDG_RUNTIME_DIRand the same contents. if a user logs in once, then logs out again, and logs in again, the directory contents will have been lost in between β but applications should not rely on this behavior and must be able to deal with stale files. to store session-private data in this directory, the user should include the value of$XDG_SESSION_IDin the filename. this directory shall be used for runtime file system objects such asAF_UNIXsockets, FIFOs, PID files and similar. it's guaranteed that this directory is local and offers the greatest possible file system feature set the operating system provides. for further details, see the XDG Base Directory Specification[3].$XDG_RUNTIME_DIRis not set if the current user is not the original user of the session. π«Ά$TZ,$EMAIL,$LANGβ if a JSON user record is known for the user logging in, these variables are initialized from the respective data in the record.
Added in version 245.
the following environment variables are read by the module and may be used by the PAM service to pass metadata to the module. if these variables aren't set when the PAM module is invoked but can be determined otherwise, they're set by the module β so that these variables are initialized for the session and applications if known at all:
$XDG_SESSION_TYPEβ the session type. this may be used instead oftype=on the module parameter line, and is usually preferred. β
Added in version 209.
$XDG_SESSION_CLASSβ the session class. this may be used instead ofclass=on the module parameter line, and is usually preferred.
Added in version 209.
$XDG_SESSION_DESKTOPβ the desktop identifier. this may be used instead ofdesktop=on the module parameter line, and is usually preferred.
Added in version 209.
$XDG_SEATβ the seat name the session shall be registered for, if any.
Added in version 209.
$XDG_VTNRβ the VT number the session shall be registered for, if any. (only applies to seats with a VT available, such as"seat0")
Added in version 209.
and if they're not set, pam_elogind will initialize $XDG_SEAT and $XDG_VTNR based on the $DISPLAY variable (if the latter is set). π
π₯ EXAMPLE π₯
here's an example PAM configuration fragment that lets user sessions be managed by elogind:
#%PAM-1.0
auth required pam_shells.so
auth required pam_nologin.so
auth include system-auth
account required pam_access.so
account required pam_nologin.so
account required pam_time.so
account include system-auth
password include system-auth
session optional pam_loginuid.so
session required pam_env.so envfile=/etc/profile.env
session optional pam_lastlog.so silent
session include system-auth
session optional pam_motd.so motd=/etc/motd
session optional pam_mail.so
-session optional pam_elogind.so
look at that last line. that's the one doing the work. obsessed. π
β SEE ALSO β
pam.conf(5), pam.d(5), pam(8), pam_loginuid(8),
π NOTES π
- JSON User Records
https://systemd.io/USER_RECORD - Desktop Entry Specification
https://standards.freedesktop.org/desktop-entry-spec/latest/ - XDG Base Directory Specification
https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
and that's the whole page babes π this was elogind 255.24, dated PAM_ELOGIND(8) β same manual section, same version, no cap. go forth and register your sessions responsibly π§β¨πΈ
π¦ where this page comes from
- alpine 3.24: elogind-doc 255.24-r0 Β· GPL-2.0-or-later LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms