All guides
Updated
Reading
12 min
By
Anlyon Team

How to run Claude Code without permission prompts, and what the flag does not protect

The exact flag, the settings that stop Claude Code asking for permission, the Codex equivalent, and what none of them protect: your credentials and MCP servers.

  • claude code
  • codex
  • permissions
  • mcp
  • sandbox
  • approvals
  • credentials

Short answer: claude --dangerously-skip-permissions starts Claude Code in bypassPermissions mode, where tool calls run without asking. It is the same as claude --permission-mode bypassPermissions. Claude Code's own docs say to use it only inside an isolated container or VM, because the mode "offers no protection against prompt injection or unintended actions".

This guide gives you the flag and its narrower alternatives first, for Claude Code and for Codex. Then it covers what skipping prompts leaves exposed, and the options for closing that gap, in order of effort. Every command and setting below was checked against the vendors' docs on 2026-11-13, and each section links its source.

TL;DR

  • Skip every prompt: claude --dangerously-skip-permissions. Codex: codex --dangerously-bypass-approvals-and-sandbox (alias --yolo).
  • Stop most prompts without skipping checks: allow rules in .claude/settings.json, acceptEdits mode, or auto mode.
  • The flag removes prompts. It does not remove what the agent can reach: your cloud logins, tokens in .env, and every MCP server in your config.
  • A sandbox or container limits what shell commands can touch. It does not cover MCP servers.
  • For calls that change production systems, put the approval on the server side, where the client's permission mode cannot turn it off.

How do you run Claude Code with --dangerously-skip-permissions?

# Start with every permission prompt skipped
claude --dangerously-skip-permissions

# The same thing, spelled as a mode
claude --permission-mode bypassPermissions

# Start in plan mode, with bypass available later in the Shift+Tab cycle
claude --permission-mode plan --allow-dangerously-skip-permissions

# One unattended run
claude -p "run the test suite and fix what fails" --dangerously-skip-permissions

What the permission modes docs say about this mode:

  • It skips permission prompts, including for writes to protected paths such as .git and .claude.
  • Deny rules still block. Allow rules have no effect in this mode.
  • A few things still prompt or are denied: an explicit ask rule that matches, MCP tools marked as requiring user interaction, and removals of critical paths.
  • You cannot switch into it from a session started without it. Enable it at launch, with the flag or --allow-dangerously-skip-permissions.
  • On Linux and macOS, Claude Code refuses to start in this mode as root or under sudo.
  • An administrator can block it by setting permissions.disableBypassPermissionsMode to "disable" in managed settings.

The docs' own warning is plain: "Only use this mode in isolated environments like containers, VMs, or dev containers without internet access, where Claude Code cannot damage your host system."

How do you make Claude Code stop asking for permission without the flag?

Most people who search for the flag want fewer prompts, not zero checks. Claude Code has four narrower settings.

Pick a permission mode

ModeRuns without askingUse it for
default (alias manual)Reads onlyReviewing every action
acceptEditsReads, file edits and common filesystem commands such as mkdir and mvIterating on code you are reviewing
planReads, with no edits to your source filesExploring before changing anything
autoEverything, with a classifier reviewing actions in the backgroundLong tasks with fewer prompts
dontAskReads and pre-approved tools. Anything that would prompt is deniedLocked-down CI and scripts
bypassPermissionsEverythingIsolated containers and VMs only

Start in a mode with claude --permission-mode acceptEdits, or cycle modes with Shift+Tab in a session. Source: permission modes.

Auto mode is the closest thing to the flag with a check left in. A separate classifier model reviews actions before they run and blocks what escalates beyond your request. The docs add: "Auto mode reduces permission prompts but does not guarantee safety."

dontAsk is the opposite of the flag and often the better choice for CI: nothing prompts, and anything you did not allow is denied.

Write allow rules

Allow rules let named commands run without a prompt. Put them in .claude/settings.json to share them with your team, in .claude/settings.local.json for yourself in one repository, or in ~/.claude/settings.json for all your projects.

{
  "permissions": {
    "allow": [
      "Bash(npm run *)",
      "Bash(git commit *)",
      "mcp__github__get_*"
    ],
    "deny": [
      "Bash(git push *)"
    ]
  }
}
  • Bash(npm run *) matches npm run build and npm run test --watch, and not npm install.
  • mcp__<server>__<tool> names one MCP tool. mcp__github__get_* matches the github server's get_ tools.
  • Rules are evaluated deny first, then ask, then allow. A deny rule cannot be overridden by a narrower allow rule.
  • /permissions inside a session lists every rule and the file it comes from.

Source: configure permissions. The same page notes that a Bash deny rule matches the command as written, so git -C . push is not caught by Bash(git push *). Treat deny rules as a guard rail, and use the sandbox when a restriction has to hold.

For a single run, --allowedTools does the same from the command line:

claude -p "summarise the last ten commits" --allowedTools "Bash(git log *)" "Bash(git diff *)" "Read"

Turn on the sandbox

Run /sandbox in a session, or set sandbox.enabled in a settings file. The sandbox is a boundary the operating system enforces around shell commands: Seatbelt on macOS, bubblewrap on Linux and WSL2. In its auto-allow mode, a command that runs inside the sandbox needs no prompt.

{
  "sandbox": {
    "enabled": true,
    "network": { "allowedDomains": ["github.com", "*.npmjs.org"] }
  }
}

Source: sandboxing. On native Windows, commands run unsandboxed, so use WSL2 there.

What is the Codex equivalent of --dangerously-skip-permissions?

Codex has no flag with that name. Its equivalent is:

# No sandbox, no approvals
codex --dangerously-bypass-approvals-and-sandbox

# The alias
codex --yolo

OpenAI's command reference describes it as: "Run every command without approvals or sandboxing. Only use inside an externally hardened environment."

Codex separates two settings that Claude Code's flag combines: when it asks (--ask-for-approval, values on-request or never) and what commands can touch (--sandbox, values read-only, workspace-write or danger-full-access). So there is a middle setting, with no prompts and the sandbox still on:

codex --sandbox workspace-write --ask-for-approval never

Or in ~/.codex/config.toml:

approval_policy = "never"
sandbox_mode = "workspace-write"

In workspace-write, Codex can edit and run commands in the working directory, and network access stays off unless you turn it on under [sandbox_workspace_write]. Source: agent approvals and security.

What does skipping permissions not protect?

A permission prompt is a check on what the agent does next. It was never a limit on what the agent can reach. With prompts on or off, the agent runs as you, and it can use what you can use.

Credentials on the machine. A signed-in gh, aws or gcloud, an .env file with a production key, an SSH key. Any command the agent runs can use them. Claude Code's sandbox docs state that by default the sandbox still allows reading credential files such as ~/.ssh and ~/.aws/credentials, and that there is no built-in credential deny list: you list what to protect.

MCP servers. Every MCP server in your config holds a token or a sign-in, and offers every tool it has. With prompts skipped, a tool that deletes an issue or merges a pull request runs as soon as the model calls it. The sandbox does not help here: Claude Code's docs say local MCP servers run outside it, with your full access.

Text the agent reads. A file, a web page, an issue or a tool result can carry instructions. With prompts on, you might notice the odd command before approving it. With prompts off, nothing stands between that text and a call.

Put together: the flag is safe exactly where nothing valuable is reachable. On a laptop with production access, it is not.

How do you make it safe? Four options, in order of effort

OptionEffortWhat it limitsWhat it leaves open
1. Narrower mode and allow rulesMinutesWhich calls run unpromptedWhatever you allowed, and anything a rule fails to match
2. SandboxMinutesFiles and network hosts shell commands can touchMCP servers, built-in file tools, credentials you did not list
3. Container or VMAn hourEverything on your hostWhatever you mount or pass in: tokens, MCP configs, network
4. Server-side approval for external callsAn hour or twoCalls that change production systems, whatever the client's modeCalls that do not go through that server

Option 1: allow what is routine, deny what is not

Allow the commands you approve fifty times a day. Deny the ones you never want unreviewed, such as pushes and deploys. Use acceptEdits or auto mode for the rest. This is enough for most local work, and it keeps a prompt on anything new.

Option 2: turn on the sandbox

The sandbox turns "the agent asked first" into "the agent cannot". Start with an empty network allow-list and add the hosts your build needs. Then list the credential files and variables the sandbox should deny or mask.

Option 3: run it in a container

This is what the flag was built for. Use a dev container, run as a non-root user, and mount only the repository. The container is only as empty as you keep it. If you pass in a cloud token and an MCP config so the agent can do real work, those are reachable again, and the flag is skipping prompts on them. OpenAI's docs make the same point about Codex: with full access inside a container, a malicious project could exfiltrate anything in the container, including credentials.

Option 4: move risky external calls behind a server that enforces approval

Options 1 to 3 limit the machine. They do not help with the calls you want the agent to make to production: merge the pull request, update the customer record, issue the refund. The agent needs those to work, so you cannot sandbox them away.

The fix is to change who makes the call. The agent asks a server to do it. The server holds the credential, checks the request, and makes a person approve the risky ones. Because the check runs on the server, it holds in every permission mode, including bypassPermissions. The client can skip its own prompts. It cannot skip the server's.

You can build this yourself: an internal API that wraps the few production operations your agent needs, with an approval step and a log. An MCP gateway with approval support does the same for MCP servers. The properties to keep, whoever builds it:

  • The agent's credential can ask for an operation and cannot approve one.
  • The approval is tied to the exact request, not to a tool name.
  • The production credential is never in the agent's environment.
  • The agent has no second route to the same system.

Where does Anlyon fit?

Anlyon is one way to get option 4 without building it. Your agent names an action and passes input, and Anlyon resolves the credentials at dispatch and makes the request. This holds for actions routed through Anlyon, and not for a tool your agent calls directly.

Connect Claude Code:

claude mcp add --transport http anlyon https://api.anlyon.com/mcp

Then run /mcp, pick anlyon and sign in. For Codex, add the same URL under [mcp_servers.anlyon] in ~/.codex/config.toml and run codex mcp login anlyon.

What changes when the agent runs with prompts skipped:

  1. Claude Code calls an Anlyon tool, such as action_github-merge-pull-request, without asking you. That is the flag doing its job.
  2. If the action requires approval, nothing is sent. The tool answers Awaiting human approval. Nothing has been sent. with an approval id.
  3. An approver decides in the console or in Slack, on the exact request. The credential that requested an approval can never be the one that decides it, so the agent's own connection cannot approve its request.
  4. On approval, Anlyon executes the approved request snapshot using the credentials bound to that action. The agent never held them.

A tool from another remote MCP server can go through the same path. Register the server with Anlyon, and a person adopts the tools the agent may call. See how to put a remote MCP server behind Anlyon.

Three limits, stated plainly:

  • It covers calls routed through Anlyon. Shell commands, file edits and anything the agent reaches with a token on the machine are outside it. Keep options 1 to 3 for those.
  • Remove the direct route. If the same MCP server is still in the agent's config, or its token is still in the environment, the agent can go around. The docs have the steps: remove the direct route.
  • Leave "Approve on your behalf" off for the agent. It is off unless you turn it on at sign-in.

A setup that works

For day-to-day work on your own machine:

  1. Use auto mode or acceptEdits, with allow rules for your routine commands and deny rules for pushes and deploys.
  2. Turn on the sandbox with a short network allow-list.
  3. Take production tokens out of .env files and the shell the agent runs in.
  4. Route production calls through a server that enforces approval.

For unattended runs, do the same inside a container, and then --dangerously-skip-permissions is a reasonable choice: the machine is disposable, and the calls that matter are checked somewhere the flag cannot reach.

Frequently asked questions

What does claude --dangerously-skip-permissions do?
It starts Claude Code in bypassPermissions mode, where tool calls run without a permission prompt. Claude Code's docs say it is equivalent to --permission-mode bypassPermissions, that deny rules still block, and that the mode offers no protection against prompt injection or unintended actions. They say to use it only in an isolated container or VM.
How do I make Claude Code stop asking for permission without the flag?
Use a narrower setting. Allow rules in .claude/settings.json let named commands run without asking, such as Bash(npm run *). acceptEdits mode stops prompts for file edits. Auto mode runs without routine prompts while a classifier reviews actions. The sandbox can auto-allow shell commands that run inside it.
Is --dangerously-skip-permissions safe?
Only inside an environment where nothing valuable is reachable. On your own machine the agent can use every credential your user can: cloud CLI logins, tokens in .env files and the MCP servers in your config. Skipping prompts removes the last check before those are used.
Does Codex have a dangerously skip permissions flag?
Codex's flag is --dangerously-bypass-approvals-and-sandbox, with the alias --yolo. OpenAI's docs describe it as no sandbox and no approvals, and say to use it only inside an externally hardened environment. A narrower choice is --sandbox workspace-write with --ask-for-approval never.
Can I run claude --dangerously-skip-permissions as root?
Not by default. On Linux and macOS, Claude Code refuses to start in bypassPermissions mode as root or under sudo. Its docs say the check is skipped inside a recognized sandbox, and recommend the dev container configuration, which runs Claude Code as a non-root user.

Let your agent act for your users, safely.

A few lines of server code, then send a user a connect link. Nothing to host.

$ claude mcp add --transport http anlyon https://api.anlyon.com/mcp