Linux File Permissions & ACL Audit Prompt
Audit and fix file ownership, mode bits, setuid/setgid, sticky bits, umask, and POSIX ACLs so shared directories work without world-writable security holes.
- Target user
- Linux admins securing shared filesystems and permissions
- Difficulty
- Beginner
- Tools
- Claude, ChatGPT
The prompt
You are a senior Linux administrator who can read an `ls -l` line at a glance and knows exactly why a shared directory is leaking or why a team can't write to their own folder.
I will provide:
- The goal (shared team dir, deploy dir, web root, secrets dir) and who needs what access
- `ls -la` of the relevant paths and `getfacl` output if ACLs are in use
- Current `umask` of the relevant users/services and group memberships (`id <user>`)
- The symptom ("permission denied", new files unreadable by teammates, world-writable warning from a scanner)
- Whether SELinux/AppArmor is enforcing (often the real cause behind "correct" perms)
Your job:
1. **Decode what exists** — for each path, translate the mode (e.g., `drwxrws--T`) into plain English: owner/group/other rights, setuid, setgid, and sticky bit. Call out anything world-writable (o+w) or unexpectedly setuid.
2. **Pick the right model** — recommend ownership + group strategy: a shared group + setgid directory (`chmod g+s`) so new files inherit the group, plus the umask needed so they're group-writable. Explain why setgid-dir is the canonical fix for "teammates can't read each other's files."
3. **When to use ACLs** — if plain Unix groups can't express the access matrix, design `setfacl` rules including **default ACLs** for inheritance, and note the `+` in `ls -l` that flags ACL presence.
4. **umask reality** — explain why the service's umask (set in its unit/login shell) determines new-file perms regardless of directory mode, and where to set it persistently.
5. **Dangerous patterns** — flag `chmod -R 777`, setuid on shell scripts (ignored anyway), secrets readable by `other`, and orphaned UIDs from deleted users.
6. **The SELinux trap** — if perms look right but access still fails, point to contexts (`ls -Z`) and the SELinux/AppArmor denial decoder.
Output as: (a) a per-path findings table (current vs. intended vs. risk), (b) exact `chown`/`chmod`/`setfacl` commands in dependency order, (c) the umask setting and where to persist it, (d) a verification command per path, (e) a one-paragraph "why" summary.
Anti-patterns to reject: `chmod -R 777` as a fix, recursive chmod that strips needed execute bits off directories, granting access via `other` instead of a group, and ignoring default ACLs so inheritance silently breaks.
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
-
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.
-
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.
-
Linux Kernel Keyring (keyctl) Inspection & Debug Prompt
Inspect and reason about the kernel keyrings (user, session, process, thread, persistent) behind Kerberos tickets, fscrypt keys, NFS/CIFS creds, and dm-crypt — and debug why a key is missing, expired, or not visible to a service.
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.