dangerously-skip-permissions using a devcontainer

Status Fixed / completed
Maintainer reply ✓ Yes — bcherny
Activity 9 comments · opened May 1, 2025 · closed May 1, 2025
💡 Likely answer: A maintainer (bcherny, collaborator) responded on this thread — see the highlighted reply below.

I am getting

╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                        │
│ WARNING: Claude Code running in Bypass Permissions mode                                                                │
│                                                                                                                        │
│ In Bypass Permissions mode, Claude Code will not ask for your approval before running potentially dangerous commands.  │
│ This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be        │
│ restored if damaged.                                                                                                   │
│                                                                                                                        │
│ By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.               │
│                                                                                                                        │
│ https://docs.anthropic.com/s/claude-code-security                                                                      │
│                                                                                                                        │
│   1. No, exit                                                                                                          │
│ ❯ 2. Yes, I accept✔                                                                                                    │
│                                                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
   Enter to confirm · Esc to exit
root@cc-master:/workspace# claude --dangerously-skip-permissions
--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons

I totally understand the security concerns, but as I am in a self made dev-container, I explicity want also root to be able to run the skip-permission mode.

View original on GitHub ↗

9 Comments

bcherny collaborator · 1 year ago

Fixed in 0.2.98

bcherny collaborator · 1 year ago

Thanks for the report!

danieldeusing · 1 year ago

I am sorry, but it seems not to be the case

root@cc-master:/workspace# claude --dangerously-skip-permissions
--dangerously-skip-permissions cannot be used with root/sudo privileges for security reasons
╭────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╮
│                                                                                                                        │
│ WARNING: Claude Code running in Bypass Permissions mode                                                                │
│                                                                                                                        │
│ In Bypass Permissions mode, Claude Code will not ask for your approval before running potentially dangerous commands.  │
│ This mode should only be used in a sandboxed container/VM that has restricted internet access and can easily be        │
│ restored if damaged.                                                                                                   │
│                                                                                                                        │
│ By proceeding, you accept all responsibility for actions taken while running in Bypass Permissions mode.               │
│                                                                                                                        │
│ https://docs.anthropic.com/s/claude-code-security                                                                      │
│                                                                                                                        │
│   1. No, exit                                                                                                          │
│ ❯ 2. Yes, I accept✔                                                                                                    │
│                                                                                                                        │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
   Enter to confirm · Esc to exit
root@cc-master:/workspace# claude update
Current version: 0.2.98
Checking for updates...
Claude Code is up to date (0.2.98)
danieldeusing · 1 year ago

Can we re-open that ticket? This is somehow important to me.

Sure, I could add a user in the container, but actually I do not want to do that for other reasons, to be honest

Keno · 1 year ago

Same issue here with a custom sandboxing solution that only has the one root user.

josephrocca · 1 year ago

Same use case - can this be reopened @bcherny?

Edit: dangerously_unpatronize_user.sh:

grep -Rl --null -- '--dangerously-skip-permissions cannot be used with root' "$(npm root -g)/@anthropic-ai/claude-code" | xargs -0 sed -i -E '/--dangerously-skip-permissions cannot be used with root/s/process\.getuid\(\)===0\)/process.getuid()===0\&\&false)/'
max-sixty · 1 year ago

and iiuc _on a Mac_ a root user has (almost?) no security impact on the host vs a different user

to get around this, I'm just injecting all the tools into allowedTools...

josephrocca · 1 year ago

For others hitting this thread via google search, I see now that an environment variable has been added: IS_SANDBOX=1

So just launch like IS_SANDBOX=1 claude --dangerously-skip-permissions

github-actions[bot] · 1 year ago

This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.