Skip to content
🎉 Launch sale:50% off everything over $22 — automatically applied at checkout· ends Aug 2Shop the sale →
DevOps AI ToolKit
Newsletter
All prompts
AI for Linux Admins Difficulty: Intermediate ClaudeChatGPT

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

More Linux Admins prompts & error guides

Browse every Linux Admins prompt and troubleshooting guide in one place.

Free download · 368-page PDF

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.