Submit a toolSubmit

Claude Code’s Bash sandbox blocked writes outside the project. Allow the path

With the Bash sandbox on, `~/.npm` and `~/.kube` stay write-denied until you add `sandbox.filesystem.allowWrite`. A missing entry is not a broken tool. Short answer: 5 steps. 1) Confirm the failure is a sandbox write boundary; 2) Add the specific paths the tool must write; 3) Deny only what must stay protected; 4) Distinguish Edit/Write permission rules from Bash sandbox paths; 5) Re-test with a narrow probe, then the real command.

Last updated: · This page is the decision checklist; the tools list for “Open Claude Code sandbox write access outside the project” is a separate URL.

The problem: With the Bash sandbox on, `~/.npm` and `~/.kube` stay write-denied until you add `sandbox.filesystem.allowWrite`. A missing entry is not a broken tool.

How do I allow Claude Code sandbox writes outside the project?

  1. Confirm the failure is a sandbox write boundary

    If sandboxing is enabled (`/sandbox` or `sandbox.enabled: true`), Bash/PowerShell/Monitor and their child processes inherit OS-enforced write limits. Defaults allow the current working directory, a per-user temp directory, and directories you added with `--add-dir`, `/add-dir`, or `permissions.additionalDirectories`. Claude’s in-process Edit/Write tools are outside this Bash sandbox—so a shell write failure with a normal Edit success usually means filesystem allowWrite, not a missing editor permission. Docs: https://code.claude.com/docs/en/sandboxing

  2. Add the specific paths the tool must write

    In `~/.claude/settings.json` (or managed settings), set `sandbox.filesystem.allowWrite` to the directories that need writes—for example `~/.npm`, `~/.kube`, or `/tmp/build`. Prefer allowing those paths over excluding `npm` or `kubectl` from the sandbox with `excludedCommands`. Arrays merge across settings scopes; path forms like `/tmp/build` and `~/.kube` are documented for sandbox filesystem lists.

  3. Deny only what must stay protected

    Use `sandbox.filesystem.denyWrite` (and `denyRead` / `allowRead` when needed) for paths that should never be writable, such as system directories. Keep credential hardening in mind: default sandbox reads can still see files like `~/.ssh` unless you tighten read rules. Do not widen writes to your whole home directory just to unblock one tool.

  4. Distinguish Edit/Write permission rules from Bash sandbox paths

    To hard-block Claude’s file tools on a path, use `permissions.deny` with `Edit(...)` / `Read(...)` rules—`Write(path)` style permission rules do not match. Sandbox `filesystem.*` lists govern shell subprocesses. If you need the project tree itself expanded for both tools and Bash, `permissions.additionalDirectories` (or `/add-dir`) is the documented way to add another working directory. Permissions guide: https://code.claude.com/docs/en/permissions

  5. Re-test with a narrow probe, then the real command

    Ask Claude to run a sandboxed probe that writes a harmless file under the newly allowed path, then retry the install or deploy command. Approve an unsandboxed retry only for one trusted command. Keep network allowlists separate (`network.allowedDomains`) when the same command also needs outbound access—write and network failures look similar in logs but use different settings.

Which tools are best to open Claude Code sandbox write access outside the project?

Configure the sandboxed Bash tool

Default write boundary and sandbox.filesystem.allowWrite / denyWrite path lists.

Configure permissions

How sandbox filesystem rules relate to Edit/Read permission rules and additionalDirectories.

All settings reference

sandbox.filesystem object fields and merge behavior across settings scopes.

Choose a permission mode

When sandboxed commands auto-allow vs prompt after a write or network failure.

All tools for “Open Claude Code sandbox write access outside the project” →

Related fixes

See also AI tools launched today on the daily board.