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
-
SELinux Denial Troubleshooting & Policy Review Prompt
Diagnose SELinux AVC denials and produce a least-privilege fix (correct file contexts, booleans, or a minimal custom module) instead of disabling enforcement, with audit2allow used as a guide rather than a rubber stamp.
-
Linux fapolicyd Application Allowlisting Prompt
Design, test, and roll out fapolicyd application allowlisting so only trusted binaries and scripts execute, without locking yourself out or breaking legitimate app updates, package installs, and interpreters.
-
Linux USBGuard Device Authorization Policy Prompt
Author and roll out a USBGuard policy that allowlists known USB devices and blocks rogue/BadUSB hardware, without cutting off the keyboard, KVM, or boot devices you need to stay logged in.
-
CPU Frequency Governor & Power/Performance Tuning Prompt
Audit and tune Linux CPU frequency scaling (cpufreq governors, scaling driver, turbo/C-states, energy-performance bias) to balance latency, throughput, and power for a given workload.
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.