login.defs, umask & Account-Defaults Hardening Review Prompt
Audit Linux account-creation defaults — login.defs, default umask, password aging, UID/GID ranges, and shell/skeleton settings — so every new and existing account inherits a safe, least-privilege baseline.
- Target user
- security-minded DevOps engineers standardizing account hardening across a fleet
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior DevSecOps engineer (defensive/blue-team) who fixes insecure defaults at the source: a weak `login.defs` or loose default umask quietly creates world-readable files and unaging passwords on every account a host ever provisions. I will provide: - `/etc/login.defs`, the default umask sources (`/etc/profile`, `/etc/bashrc`, PAM `pam_umask`, systemd `UMASK`) - `/etc/default/useradd`, the skeleton dir (`/etc/skel`), and current `chage -l` output for a sample of accounts - Compliance baseline if any (CIS, internal standard) and the host's role Your job: 1. **Audit password aging defaults** — review `PASS_MAX_DAYS`, `PASS_MIN_DAYS`, `PASS_WARN_AGE`, and encryption method (`ENCRYPT_METHOD`/`SHA_CRYPT_ROUNDS`); flag weak hashing and missing expiry. 2. **Check the default umask** — trace umask across profile scripts, PAM, and systemd, flag any path yielding world-readable (022 where 027/077 is warranted) and confirm consistency so it cannot be bypassed. 3. **Review UID/GID ranges & defaults** — assess `UID_MIN`/`SYS_UID_MAX`, default group behavior (USERGROUPS_ENAB), inactive-account handling (`INACTIVE`), and default shell for service accounts. 4. **Inspect /etc/skel** — flag any sensitive or world-readable files new users would inherit, and confirm dotfile permissions are sane. 5. **Reconcile with existing accounts** — note that login.defs only affects future accounts; produce the `chage`/`chmod` steps to bring current accounts up to the new baseline. 6. **Produce a remediation plan** — corrected config files and an ordered apply sequence, with the compliance mapping where a baseline was provided. Output as: (a) findings table (setting, current, recommended, rationale), (b) corrected `login.defs`/`useradd`/umask config, (c) remediation steps for existing accounts, (d) compliance mapping. Default to caution: tighten defaults to least privilege, but verify a stricter umask (e.g. 027) does not break service accounts that rely on group-readable files before fleet rollout.
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
-
GraphQL API Security Hardening Review Prompt
Review a GraphQL API for the abuse vectors unique to the query model — unbounded depth, introspection exposure, batching amplification, and field-level authorization gaps — and get a hardened schema and gateway config.
-
SAML SSO Assertion Security Review Prompt
Review a SAML single sign-on integration for the assertion-handling flaws that cause authentication bypass — signature validation gaps, XML canonicalization tricks, audience/recipient scoping, and replay — and get a hardened SP configuration.
-
Inbound Webhook HMAC Signature Verification Review Prompt
Review how your service authenticates inbound webhooks (Stripe, GitHub, Slack, custom senders) so forged, replayed, or tampered payloads are rejected before they trigger business logic.
-
SELinux Targeted Policy Troubleshooting Prompt
Diagnose SELinux denials from audit logs and produce minimal, least-privilege policy fixes — booleans, file contexts, or scoped custom modules — instead of disabling enforcement.
More DevOps Security & Hardening prompts & error guides
Browse every DevOps Security & Hardening 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.