auth: improve pam flow and user status

This commit is contained in:
2025-12-28 16:47:43 +01:00
parent 5c9ef1ddcb
commit b566055d0a
6 changed files with 75 additions and 4 deletions

View File

@ -133,8 +133,15 @@ def disable_user(
if play_sound:
_play_sound_if_available()
_run(["sudo", "pkill", "-KILL", "-u", user])
steps.append("sessions terminated")
try:
_run(["sudo", "pkill", "-KILL", "-u", user])
steps.append("sessions terminated")
except subprocess.CalledProcessError as exc:
if exc.returncode == 1:
# pkill returns 1 when no matching processes exist; not an error here.
steps.append("no sessions to terminate")
else:
raise
if logged_in:
_run(["sudo", "shutdown", "now"])