Free resources · Rules and hooks
Claude dangerously skip permissions: what the flag skips, and a safer setup
What claude dangerously skip permissions really turns off, what it still stops, why it can still ask, and one deny rule you can write and check in two minutes.
What does --dangerously-skip-permissions actually do?
It is the same as bypassPermissions mode. A permission mode is the overall setting for how often Claude Code asks you. In this mode nearly every action runs at once, even writes to Claude's own settings and your .git folder.
What still holds:
- Deny rules. A rule is one line in a settings.json file, such as Read(./.env). A deny rule means "never" for what it matches, in every mode.
- Ask rules, which mean "always ask me first".
- A prompt before an rm or rmdir that Claude Code sees will remove a critical folder, such as your home or project folder; in a run with nobody at the keyboard it is refused instead.
Allow rules, which pre-approve actions, stop mattering.
Should I always use it?
No, not on your own machine. Since version 2.1.283, auto mode is the mode Claude Code starts in for interactive terminal and VS Code sessions. It runs most actions without asking and checks risky ones in the background. It guarantees nothing, but keeps a check the flag removes.
The command looks like this:
claude --dangerously-skip-permissions
In our view, the flag belongs only in an unattended run inside a container, virtual machine or dev container with no internet access unless the job needs it: a walled-off computer where a mistake stays put. Give that box the least reach the job needs, with no production keys and no copy of your home folder. Before the run, commit your work as a fresh checkpoint.
What can go wrong?
A bad day looks like one of these:
- Deleted files. A cleanup goes one step too far. Git brings back only what you committed, so uncommitted work is gone.
- A secret read. Claude runs as you, so it can open your .env file, your SSH keys or your cloud login.
- Prompt injection: text hidden in a file, issue or web page that gives Claude new orders. The flag does nothing against it; isolation limits the damage.
The danger peaks when one agent holds your private data, reads content from strangers and can send data out. On your laptop Claude has all three, and the flag removes the person watching.
Is Claude Code secure enough to run this way?
Not on its own. Claude Code enforces its rules, and Claude cannot talk its way past one. Still, a rule only matches what Claude asks for, the command text or the file name, so the same program called another way, or a script that opens the file itself, can get past it. Your real protection is isolation: the container, run as a normal user, holding nothing you could not lose.
Why does it still ask, or refuse to start?
Usually:
- It still asks: an ask rule or a risky rm is in play, which is by design.
- It still asks: you typed --allow-dangerously-skip-permissions. That flag only adds bypass to the modes Shift+Tab cycles through; it does not start you in it.
- It will not start as root, the default user in many Docker images. Use a normal user; the message is:
--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons
- It ignores your project file: setting permissions.defaultMode to bypassPermissions in a project's .claude/settings.json or .claude/settings.local.json is ignored, and the session starts in Manual mode. Use your user file, ~/.claude/settings.json, or the flag.
- A background session (claude --bg) refuses it or ignores it until ~/.claude/settings.json holds "skipDangerousModePermissionPrompt": true; accepting the warning once in an interactive session writes it.
- It refuses the flag outright: you or your company set permissions.disableBypassPermissionsMode to "disable" in a settings file.
What is one safe step I can take today?
Write one deny rule, the kind that holds in every mode, the flag included. Paste this into a Mac or Linux terminal to make a throwaway folder, a made-up .env file and a settings file denying it:
mkdir -p ~/deny-rule-test/.claude
cd ~/deny-rule-test
printf 'API_KEY=made-up-not-real\n' > .env
cat > .claude/settings.json <<'EOF'
{
"permissions": {
"deny": ["Read(./.env)"]
}
}
EOFIt prints nothing when it works.
- .claude/settings.json is the project's shared settings file.
- Read(./.env) blocks Claude's file tools from reading the .env file in this folder. Deny rules in a project file apply at once, with no trust prompt.
Anyone who can commit to a repository can change this file. Look for rules you did not expect in any repository you clone. Later, repeat it on your own project with your real secrets file; never share a real key.
Optional, if signed in: start Claude Code here and type /permissions to see your rule and its file.
Where do I set this up next?
Check that the rule is in the file
Run this:
grep -n 'Read(./.env)' ~/deny-rule-test/.claude/settings.json
It should print exactly:
3: "deny": ["Read(./.env)"]
The 3 is the line number. If nothing prints, or it says No such file or directory, run the first block again.