Claude Code --dangerously-skip-permissions: usage and limits
claude --dangerously-skip-permissions starts Claude Code in bypassPermissions mode, so Claude edits files, runs shell commands and calls tools without asking you first. It creates no sandbox, it refuses to start as root on Linux and macOS, and Anthropic recommends it only for isolated containers and VMs.
claude --dangerously-skip-permissionsTo run it away from your laptop, start a disposable sandbox on Lizard Sandboxes with Claude Code already installed: lizard sandbox create -t claude -s small --timeout 3600000. Each sandbox is a Firecracker microVM with its own kernel, and you delete it when the job is done. Its shell runs as root, so read the root section before you start.
We checked Anthropic's documentation and the Claude Code changelog on November 12, 2026 (latest release: 2.1.322). The root, IS_SANDBOX and network results below come from runs in Lizard Sandboxes that day; everything else is from the documentation.
What does dangerously-skip-permissions do?
The flag selects the same permission mode as claude --permission-mode bypassPermissions. Claude continues without the usual approval stops. It keeps the operating-system identity and access of the process you launched: it does not grant root privileges, invent credentials or open a network your environment blocks. Claude Code permission modes.
Some actions still prompt or get denied in this mode. Anthropic lists them as actions no mode auto-approves: explicit ask rules, tools that need user interaction such as AskUserQuestion, recognized rm and rmdir removals of critical paths (the filesystem root, your home directory, your working directory), and a few cross-session messaging checks. Deny rules apply in every mode, and allow rules have no effect in bypass mode. Do not treat those exceptions as protection for arbitrary files or cloud resources. A command can harm a project without deleting a filesystem root.
Bypass mode writes to protected paths such as .git, .claude, .vscode and .bashrc without a prompt. Manual mode prompts for those writes, and auto mode sends them to its classifier. Protected paths.
Consider a routine request: "Fix the failing tests." Claude might edit a test, install a package or change configuration. If the same process can also read a cloud key and call its API, a disposable local folder alone does not restrict those remote actions. Your setup must limit that access before the run begins.
Commands for interactive and unattended use
Start an interactive session
Open a terminal inside your prepared environment and run:
claude --dangerously-skip-permissionsThe status bar shows ⏵⏵ bypass permissions on. The first time you start an interactive session in this mode, Claude Code shows a warning dialog. If you accept, it saves skipDangerousModePermissionPrompt: true in ~/.claude/settings.json and later sessions skip the dialog. If you decline, Claude Code exits. Non-interactive runs show no dialog. Bypass permissions mode.
Run one task and capture its result
For a current Claude Code release with API-key authentication:
claude --bare -p \
"Fix the failing unit test in this checkout. Run the relevant tests. Report changed files and failures. Do not commit or push." \
--dangerously-skip-permissions \
--max-turns 12 \
--output-format json > /tmp/claude-result.jsonHere, -p runs a non-interactive task, and --output-format json makes its response easier for a runner to collect. --max-turns limits the agent loop in print mode; it does not impose a wall-clock deadline on the whole job. Configure that deadline in your runner too. CLI flag reference.
--bare skips hooks, plugins, auto-memory and CLAUDE.md discovery. For Anthropic's API it needs ANTHROPIC_API_KEY (or an apiKeyHelper); it never reads your subscription's OAuth login. Supply that key through the runner's secret settings. Programmatic runs and bare mode.
Without a permission flag, a claude -p run starts in Manual mode (config value default) in Claude Code 2.1.302 and later, and calls that need approval are denied. The bypass flag is what lets such a run use tools freely. Which mode a session starts in.
The prompt's "Do not commit or push" describes the task. Enforce the restriction by withholding write access to the remote repository. A sentence in a prompt cannot replace a credential scope or network policy.
For more on collecting results and handling failed jobs, see our Claude Code headless guide.
Enable bypass for later in the session
The similarly named flag has a different effect:
claude --permission-mode plan --allow-dangerously-skip-permissions--allow-dangerously-skip-permissions adds bypassPermissions to the Shift+Tab mode cycle without starting in it. You cannot enter bypass mode from a session that was started without one of these flags or a bypassPermissions default; restart with the enabling flag. CLI reference.
Why does it fail as root or with sudo?
On Linux and macOS, Claude Code refuses bypass mode when it runs as root or under sudo. The exact message, from Claude Code 2.1.322 as root in a sandbox on Lizard:
--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasonsThe process exits with code 1. Anthropic's docs say the check is skipped automatically inside a recognized sandbox, and they recommend the dev container setup, which runs Claude Code as a non-root user. Root restriction.
Many Docker images give you a root shell by default, which is why this error tops GitHub issues such as #58150. There are two ways out:
-
Run Claude Code as a normal user. This is the documented route:
useradd -m agent su - agent -c 'cd /workspace && claude --dangerously-skip-permissions'In our test, the same flag run as a new non-root user passed the root check and stopped only at "Not logged in", because the new user had no Claude credentials. Sign that user in, or pass
ANTHROPIC_API_KEYto it. -
Set
IS_SANDBOX=1. In Claude Code 2.1.322 as root,IS_SANDBOX=1 claude --dangerously-skip-permissions -p "..."passed the root check and also stopped only at the login step. The variable does not appear in Anthropic's environment-variable reference as of November 12, 2026, so it can change without notice. Use it only inside a throwaway container or VM, never on a host you care about.
Is auto mode now the default in Claude Code?
Yes. With Claude Code v2.1.283 or later, interactive terminal and VS Code sessions start in auto mode when nothing else sets a permission mode, on every plan and provider. A --permission-mode flag, --dangerously-skip-permissions or permissions.defaultMode in a settings file still overrides it. claude -p and Agent SDK runs still start in Manual mode, and so do organizations that disable auto mode or use Anthropic's HIPAA configuration. Which mode a session starts in; the changelog lists the change under 2.1.284.
The CLI now calls the old ask-before-acting mode Manual. Its config value is still default, and manual works as an alias.
Auto mode vs dangerously-skip-permissions
Choose the least permissive mode that lets the task finish:
| Mode | What runs without asking | A practical use |
|---|---|---|
default (Manual) | Reads only | Sensitive files or shared systems |
acceptEdits | Reads, file edits and common filesystem commands | Local coding with review of other actions |
plan | Reads, plus classifier-approved commands when auto mode is available | Exploring a codebase before changing it |
auto | Everything, with a classifier reviewing actions in the background | Long tasks with fewer interruptions |
dontAsk | Reads in the working directories and pre-approved tools; anything else is denied | CI jobs with a narrow set of allowed tools |
bypassPermissions | Everything, apart from the documented exceptions | A bounded job in an isolated container or VM |
The mode names and behavior come from the permission modes reference.
Auto mode uses a separate classifier model to review actions such as shell commands and external tool calls. It can block an action and let Claude try another approach, and it can make mistakes. Anthropic's own warning on bypass mode says it "offers no protection against prompt injection or unintended actions" and points to auto mode for far fewer prompts with background checks. How Anthropic built auto mode.
Since auto mode is now the default for interactive sessions, many people who reach for the bypass flag no longer need it. If an interactive session still asks too often, check the status bar first: ⏵⏵ auto mode on means the classifier is active. To start in it explicitly:
claude --permission-mode autoIf your job only needs known tools, consider dontAsk with narrow allow rules. Missing permission fails the action instead of leaving the job waiting for a person. Inspect denied actions before widening the rules.
How do I use bypass permissions in the VS Code extension?
The VS Code extension hides bypass mode until you turn it on:
- Open the extension settings and enable Allow dangerously skip permissions (
allowDangerouslySkipPermissions, defaultfalse). This adds Bypass permissions to the mode indicator at the bottom of the prompt box. - Pick Bypass permissions from the mode indicator for a conversation, or set
claudeCode.initialPermissionModetobypassPermissionsin your VS Code user settings so new conversations start in it. The extension ignores workspace values of this setting.
Without the toggle, a bypassPermissions value starts the conversation in Manual mode instead. Picking Bypass permissions from the indicator applies to that conversation only. VS Code extension settings, switch permission modes.
If the extension still prompts for shell commands, check whether the conversation is in plan mode. Plan mode keeps its blocks in the VS Code chat panel even when bypass is available, unlike an interactive terminal session. That matches reports such as #95401. Running claude --dangerously-skip-permissions in VS Code's integrated terminal follows the CLI rules above, including the root check.
Does Remote Control work with bypass permissions?
Only partly. The Claude app and claude.ai/code offer Manual, Accept edits, Plan and Auto for a Remote Control session; you can't select Bypass permissions from the app, and the app's mode dropdown does not show it. Switch permission modes, Web and mobile.
In Claude Code 2.1.322, claude remote-control --help lists bypassPermissions among the values of --permission-mode for the sessions the server spawns. Users report that changing the mode from the phone moves a bypass session to Accept edits with no way back to bypass from the app (#100895), and there is an open request for an opt-in setting (#107282). If you need a long unattended run, start it in the mode you want from the terminal and avoid switching modes from the phone.
In the other modes, permission prompts reach your phone and stay open until you answer them. To get a push notification for each one, run /config in the terminal and turn on Push when actions required. Remote Control. Remote Control also needs a claude.ai sign-in on the machine; API keys are not supported.
What is the Codex and Antigravity equivalent of dangerously-skip-permissions?
Both agents have a flag with a similar name and a similar warning:
| Agent | Flag | What it does |
|---|---|---|
| Claude Code | claude --dangerously-skip-permissions | Starts in bypassPermissions: no approval prompts |
| OpenAI Codex CLI | codex --dangerously-bypass-approvals-and-sandbox (alias --yolo) | Skips all approval prompts and runs commands without Codex's sandbox |
| Google Antigravity CLI | agy --dangerously-skip-permissions | Auto-approves every tool permission request (always-proceed mode) |
Codex 0.167.2's --help describes its flag as "EXTREMELY DANGEROUS. Intended solely for running in environments that are externally sandboxed"; --yolo is an alias defined in the Codex CLI source. Codex differs from Claude Code here: its normal mode runs commands in its own sandbox, and this flag removes that sandbox too. For a milder setting, Codex has --ask-for-approval never with a --sandbox policy. Our Codex sandbox guide covers those modes.
The Antigravity CLI docs show agy -p "Run the test suite and report failures" --dangerously-skip-permissions for headless runs and recommend scoped permissions.allow rules instead where possible. Antigravity CLI reference, headless mode.
Does Claude Code's sandbox make bypass safe?
Claude Code's built-in Bash sandbox restricts shell access to files and the network. Its auto-allow option can approve sandboxed commands without a prompt. That option is separate from auto mode's classifier. Bash sandbox configuration.
The built-in Bash sandbox does not contain the whole application. File tools, MCP servers and hooks need their own boundary, or an outer environment that contains the entire Claude Code process. A VM and a container also provide different isolation. Choose based on what code you intend to run and what failure you can tolerate. Sandbox environment comparison.
Check the retry behavior too. With bypass enabled, an unsandboxed retry can run without asking. The following settings disable that retry and make Claude Code exit at startup if the sandbox can't start:
{
"sandbox": {
"enabled": true,
"failIfUnavailable": true,
"allowUnsandboxedCommands": false
}
}Review any excludedCommands entries as well; they can still run outside the Bash sandbox. For centrally enforced settings, use managed policy that the agent cannot edit. Administrators can also block bypass mode entirely with permissions.disableBypassPermissionsMode: "disable" in managed settings. Strict sandbox settings.
A practical workflow for an unattended run
Take a small failing-test task as an example. The output you want is a patch and a test report. There is no reason for this job to hold deployment access.
1. Prepare a separate checkout
Create a fresh container or VM and copy in the repository at a known commit. Prefer a copy to a writable mount of your main working directory. A worktree helps separate changes, but does not isolate the operating system or credentials.
Install the required runtime and packages during setup. Record the starting commit and tool versions. Use a non-root account for the agent. If you start with a dev container, inspect its mounts: a writable host directory exposes those host files to edits inside the container. Anthropic's dev container guide explains the setup and its limits.
2. Give the job only the access it needs
Pass the model credential separately. If the repository is private, use read-only repository access for checkout. Keep deployment keys, your SSH agent, the Docker socket and unrelated home-directory files outside the environment.
Allow the model endpoint and the package or source hosts the task needs. Restrict other outbound access in the environment's network controls. If a dependency download fails, identify the required host before opening more destinations.
This is also where you decide which MCP servers, if any, the task needs. A database or cloud MCP connection adds remote capabilities even when the local filesystem is disposable.
3. Run a task with a clear end condition
Use the headless command above once authentication and dependencies are ready. Put the job under a runner timeout and capture its exit status, stdout and stderr. Keep the test command under your control so that the result does not depend only on the agent's summary.
Start with a small change: one failing test or one documented bug. "Clean up the entire repository" leaves too much room for edits you did not intend to review.
4. Review the actual files
After the job ends, inspect the checkout:
git status --short
git diff --stat
git diff --check
git diff
git ls-files --others --exclude-standardThe last command lists untracked files, which a plain diff misses. Inspect them too. Compare the final commit with the starting commit so an unexpected commit does not hide changes from the working-tree diff. Re-run the relevant tests from your trusted runner, then review the patch before merging it.
Export the files you need before stopping the environment. Keep credentials out of logs and artifacts. Expire the task's credentials and destroy the disposable workspace after the review material is safe.
Where Lizard Sandboxes fit
Lizard Sandboxes can provide the remote workspace for this pattern: create an environment, run a task, collect its files and delete it. Sandboxes run as Firecracker microVMs, each with its own kernel. The claude template comes with Claude Code installed. Start with the Sandboxes quickstart.
Anthropic's --help text recommends bypass mode "only for sandboxes with no internet access". Lizard CLI can create a sandbox whose outbound traffic is closed except for the hosts you name:
lizard sandbox create -t claude -s small --timeout 3600000 \
--allow-host api.anthropic.comIn our test, a sandbox created this way reached api.anthropic.com, while example.com and registry.npmjs.org were blocked. --allow-host implies --no-internet for the sandbox's whole life, so add one --allow-host per package registry or source host your task needs. A Small sandbox has 2 vCPU and 4 GB RAM and costs $0.0162 an hour, billed per second, so a full one-hour run costs under 2 cents of compute. --timeout is in milliseconds; without it the sandbox gets 5 minutes. On the trial, a sandbox lives at most one hour. Pricing, runtime documentation.
The template's shell runs as root, so use a non-root user for the agent as shown in the root section. Delete the sandbox when you have the files: lizard sandbox rm <id>.
Remote execution helps when you need a fresh workspace for each job or many jobs at once. It still needs a network policy and a review step. A sandbox with a production database token can reach that database regardless of where the sandbox runs.
Frequently asked questions
Can I use dangerously-skip-permissions by default?
Yes. For a dedicated container or VM worker, merge this into that worker user's ~/.claude/settings.json:
{
"permissions": {
"defaultMode": "bypassPermissions"
}
}New terminal sessions then start in bypass mode. Keep this default confined to the disposable worker; for individual jobs, use the explicit launch flag. The value has no effect in a repository's .claude/settings.json or .claude/settings.local.json: a session started from there opens in Manual mode. Cloud sessions ignore it too, and managed policy may disable the mode. Settings scope and precedence.
Do subagents inherit bypass permissions?
Yes. When the main conversation is in bypassPermissions, its subagents run in the same mode and Claude Code ignores their own permissionMode setting. A subagent is not a separate security boundary. Subagent permissions.
Why does Claude still ask a question?
An approval prompt and a question about the task are different. AskUserQuestion, ask rules and critical-path rm commands still stop for you in bypass mode. Read the actual prompt before assuming the flag failed. For unattended jobs, specify the expected output and failure behavior up front.
Does the flag make Claude Code free or remove rate limits?
No. It changes permission handling. Your model provider still controls authentication, usage charges and rate limits. Repeated retries can use more tokens even when no approval prompt appears.
For daily interactive work, try auto mode first; it is now the default in terminal and VS Code sessions. For unattended bypass runs, make the environment disposable, run the agent as a non-root user, restrict what it can reach, and review the resulting files before they affect your main project.
Related guides: Claude Code sandbox: /sandbox, Docker or a cloud VM · Codex sandbox modes · AI sandbox: isolation, code execution, and costs
Build with AI. Ship with Lizard.
You don't need a platform team to go live. Your whole cloud, one CLI command away.
- Services
- —
- Add-ons
- —
- Deployments
- —
- Sandbox starts
- —