pam_systemd_home - Automatically mount home directories managed by systemd-homed.service on login, and unmount them on logout
pam_systemd_home ensures that home directories managed by systemd-homed.service(8) are automatically activated (mounted) on user login, and are deactivated (unmounted) when the last session of the user ends.
The following options are understood:
Note that TTY logins generally do not support re-authentication on system resume. Re-authentication on system resume is primarily a concept implementable in graphical environments, in the form of lock screens brought up automatically when the system goes to sleep. This means that if a user concurrently uses graphical login sessions that implement the required re-authentication mechanism and console logins that do not, the home directory is not locked during suspend, due to the logic explained above. That said, it is possible to set this field for TTY logins too, ignoring the fact that TTY logins actually don't support the re-authentication mechanism. In that case the TTY sessions will appear hung until the user logs in on another virtual terminal (regardless if via another TTY session or graphically) which will resume the home directory and unblock the original TTY session. (Do note that lack of screen locking on TTY sessions means even though the TTY session appears hung, keypresses can still be queued into it, and the existing screen contents be read without re-authentication; this limitation is unrelated to the home directory management pam_systemd_home and systemd-homed.service implement.)
Turning this option on by default is highly recommended for all sessions, but only if the service managing these sessions correctly implements the aforementioned re-authentication. Note that the re-authentication must take place from a component running outside of the user's context, so that it does not require access to the user's home directory for operation. Traditionally, most desktop environments do not implement screen locking this way, and need to be updated accordingly.
This setting may also be controlled via the $SYSTEMD_HOME_SUSPEND environment variable (see below), which pam_systemd_home reads during initialization and sets for sessions. If both the environment variable is set and the module parameter specified the latter takes precedence.
The module provides all four management operations: auth, account, session, password.
The following environment variables are initialized by the module and available to the processes of the user's session:
Here's an example PAM configuration fragment that permits users managed by systemd-homed.service to log in:
#%PAM-1.0 auth sufficient pam_unix.so -auth sufficient pam_systemd_home.so auth required pam_deny.so account required pam_nologin.so -account sufficient pam_systemd_home.so account sufficient pam_unix.so account required pam_permit.so -password sufficient pam_systemd_home.so password sufficient pam_unix.so sha512 shadow try_first_pass use_authtok password required pam_deny.so -session optional pam_keyinit.so revoke -session optional pam_loginuid.so -session optional pam_systemd_home.so -session optional pam_systemd.so session required pam_unix.so