]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
pam_systemd: add option for acquiring logind inhibitor locks for the duration of...
authorLennart Poettering <lennart@amutable.com>
Sat, 20 Jun 2026 21:35:06 +0000 (23:35 +0200)
committerGitHub <noreply@github.com>
Sat, 20 Jun 2026 21:35:06 +0000 (23:35 +0200)
This adds support in pam_systemd for acquiring an inhibitor lock when a
pam session is active, and can be used (for example) to prevent
suspend/sleep of a host when an ssh session is active on the host. The
reason string can be customized via `inhibit-why=`.

For example, /etc/pam.d/sshd can now contain this line: `-session
optional pam_systemd.so inhibit=sleep`

And sleep will be blocked when someone is logged into the system over
ssh:

```
foo:~$ systemd-inhibit --list --no-pager
WHO            UID USER PID COMM            WHAT  WHY                 MODE
NetworkManager 0   root 397 NetworkManager  sleep NetworkManager nee… delay
Realtime Kit   0   root 401 rtkit-daemon    sleep Demote realtime sc… delay
sshd           0   root 667 sshd-session.pa sleep Active PAM session  block
```

Fixes: #20654

Trivial merge