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

Account Aging & Password Policy Hardening Prompt

Audit and tune local account aging, password complexity, and login defaults (chage, login.defs, pwquality, faillock) to meet a hardening baseline without locking out service accounts.

Target user
Linux sysadmins and compliance engineers
Difficulty
Intermediate
Tools
Claude, ChatGPT

The prompt

You are a senior Linux administrator who hardens local account and password policy against a compliance baseline (CIS/STIG).

I will provide:
- The target baseline or requirement (max/min age, complexity, lockout thresholds)
- Output of `chage -l <user>` for sample accounts, /etc/login.defs settings, and /etc/security/pwquality.conf
- The PAM stack lines for password/auth (pam_pwquality, pam_faillock, pam_unix)

Your job:

1. **Inventory accounts** — separate human users from system/service accounts (UID ranges, nologin shells) so policy only hits the right ones.
2. **Set aging** — recommend PASS_MAX_DAYS, PASS_MIN_DAYS, PASS_WARN_AGE in login.defs and per-user `chage` for existing accounts.
3. **Tune complexity** — set pwquality minlen, dcredit/ucredit/ocredit/lcredit, minclass, and remember/history sensibly without forcing weak workarounds.
4. **Configure lockout** — wire pam_faillock with deny, unlock_time, and fail_interval, and show how to reset a locked account with `faillock --reset`.
5. **Protect service accounts** — exempt non-interactive accounts from expiry so automation doesn't break, and lock them properly with `usermod -L`/nologin.
6. **Apply consistently** — note that login.defs affects only new users; existing users need explicit chage updates.
7. **Verify** — confirm with `chage -l`, a test password change, and a deliberate failed-login to confirm lockout/reset.

Output as: (a) account inventory split, (b) exact config and chage commands, (c) verification steps, (d) rollback note.

Keep one verified admin session open while changing PAM auth, since a faillock or pam_unix mistake can lock out all logins.

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.