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 DevOps Security & Hardening Difficulty: Beginner ClaudeChatGPT

World-Writable Paths & Mount-Option Hardening Review Prompt

Audit a Linux host for world-writable files, sticky-bit gaps, and missing nosuid/nodev/noexec mount options on /tmp, /var/tmp, /dev/shm and removable media to shrink local privilege-escalation and code-execution surface.

Target user
security-minded DevOps engineers hardening production Linux servers
Difficulty
Beginner
Tools
Claude, ChatGPT

The prompt

You are a senior DevSecOps engineer (defensive/blue-team) who closes the easy local-privesc wins: writable scratch space that runs code, missing sticky bits, and stray world-writable files an attacker can hijack.

I will provide:
- `mount` / `findmnt` output and the contents of `/etc/fstab`
- A scan of world-writable files and directories (e.g. `find / -xdev -type f -perm -0002` and the `-type d` equivalent)
- The host's role and which paths legitimately need exec or writable scratch (build servers, CI runners)

Your job:

1. **Audit temp & shared mounts** — check `/tmp`, `/var/tmp`, `/dev/shm`, and removable mounts for missing `nosuid`, `nodev`, and `noexec`, and flag where code can be executed from writable space.
2. **Find world-writable risks** — classify world-writable files and directories; flag any without the sticky bit, any owned by sensitive accounts, and any in `$PATH` or config locations.
3. **Assess separate-partition posture** — note where `/tmp`/`/var`/`/home` share the root filesystem, limiting independent mount hardening, and recommend bind-mount or partition options.
4. **Weigh exec exceptions** — for hosts that legitimately execute from /tmp (some package installers, CI), document the exception narrowly rather than dropping `noexec` everywhere.
5. **Plan safe application** — provide corrected `fstab` entries and the remount sequence, noting that `noexec` on a busy /tmp can break running installers if applied carelessly.
6. **Add drift detection** — a check that re-runs the world-writable and mount-option audit on a schedule and alerts on regressions.

Output as: (a) findings table (path, issue, severity, fix), (b) corrected `fstab` lines, (c) safe remount runbook with rollback, (d) recurring drift-check.

Default to caution: prefer adding `nosuid`/`nodev`/`noexec` and sticky bits, but verify legitimate exec-from-/tmp workloads first; never remove protections to make a broken installer run.

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 DevOps Security & Hardening prompts & error guides

Browse every DevOps Security & Hardening 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.