systemd-logind Session and Lingering Review Prompt
Review systemd-logind sessions, seats, and user lingering to fix leftover sessions, runaway user services, and processes that survive (or die on) logout on multi-user Linux hosts.
- Target user
- Linux sysadmins managing shared and service accounts
- Difficulty
- Intermediate
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux systems engineer who audits systemd-logind sessions, lingering, and per-user service managers on shared production hosts. I will provide: - `loginctl list-sessions`, `loginctl list-users`, and `loginctl show-user <u>` output - The contents of /etc/systemd/logind.conf and any KillUserProcesses / lingering expectations - The problem (zombie sessions, user services not starting at boot, processes killed at logout, or unexpected survivors) Your job: 1. **Map the state** — summarize active sessions, seats, and which users have lingering enabled, and flag stale or orphaned sessions. 2. **Explain the behavior** — tie the symptom to KillUserProcesses, lingering, and the user@.service / user runtime dir lifecycle. 3. **Audit lingering scope** — identify which accounts should have lingering (service-like users) versus interactive users where it is inappropriate. 4. **Diagnose leftovers** — determine why specific processes survive logout or get killed, including scopes vs slices and tmpfiles cleanup. 5. **Prescribe fixes** — give exact `loginctl enable-linger`/`disable-linger`, logind.conf settings, and session-cleanup commands. 6. **Plan rollout** — note logind reload/restart impact and how to drain sessions safely. Output as: a session/lingering inventory table, a root-cause explanation, and an ordered remediation command list with caveats. Default to caution: restarting systemd-logind can disrupt active GUI/SSH sessions, so prefer reload and schedule restarts in a window.
Run this prompt with AI
Test it, get an AI-improved version, or compare models — live in the Prompt Workspace. No copy-paste.
Related prompts
-
Runtime Capability & Ambient Set Audit (getpcaps) Prompt
Audit what Linux capabilities a running process actually holds across its permitted/effective/inheritable/ambient/bounding sets, and decide whether a service is over-privileged or whether a 'permission denied' is a missing capability.
-
systemd Encrypted Credentials (systemd-creds) Design Prompt
Replace plaintext secrets in environment variables and EnvironmentFile= with TPM-backed or host-bound encrypted credentials delivered to units via systemd-creds and LoadCredentialEncrypted=.
-
systemd-nspawn and machinectl Container Management Prompt
Build, network, and lifecycle-manage lightweight OS containers with systemd-nspawn and machinectl for test environments without pulling in a full container runtime.
-
systemd-sysext Extension Image Management Prompt
Design and troubleshoot systemd-sysext system extension images so tools overlay onto an immutable or read-only base OS at runtime without modifying the underlying image.
More Linux Admins prompts & error guides
Browse every Linux Admins prompt and troubleshooting guide in one place.
Reading prompts? Get all 500 in one free PDF
500 battle-tested, copy-paste AI prompts engineered by a senior systems engineer — every one with fill-in placeholders and safety/back-out notes. Drop your email and it's yours.
- 500 prompts: Linux · Kubernetes · Terraform · OpenStack · GitLab · Docker · Monitoring · Incident Response
- Instant PDF download — yours free, forever
- Plus one practical AI-workflow email a week (no spam)
Single opt-in · unsubscribe anytime · no spam.