Short answer: only in an isolated container or VM. Anthropic's permission-modes page says this mode is for "Isolated containers and VMs only". Run it as a non-root user, keep your real secrets off the machine, and treat everything on it as something the agent can read or delete.
What does --dangerously-skip-permissions do?
Normally Claude Code asks before it edits files or runs commands. The flag turns that off. It's an alias for the bypassPermissions permission mode, and the agent can run any command without asking.
One thing still applies. The docs say: "Deny rules block in every mode, including bypassPermissions." So you can still forbid specific commands in your settings.
What does Anthropic recommend?
The docs are consistent about this:
- The permission-modes table lists
bypassPermissionsas for "Isolated containers and VMs only". - For running fully unattended, the docs list isolation as "Required: a container, VM, or the sandbox runtime", and on Linux and macOS say to "run it as a non-root user".
- The security page advises: "Use virtual machines (VMs) to run scripts and make tool calls, especially when interacting with external web services."
What can go wrong?
- Destructive commands. A wrong
rm -rf, agit push --force, or a dropped database table. - Prompt injection. The agent reads a README, an issue or a web page with hidden instructions and follows them. The docs warn this mode offers no protection against prompt injection.
- Leaked credentials. The dev-container page is blunt: with the flag on, a container does not stop "a malicious project from exfiltrating anything accessible inside the container, including the Claude Code credentials stored in
~/.claude."
Isolation limits how far the damage reaches. It doesn't stop the damage from happening on the machine itself. That's why the machine should hold nothing you can't lose.
Container or VM?
Both count as isolated in Anthropic's docs. A container shares the host's kernel, while a VM has its own, which is a stronger boundary if the agent runs something nasty. We compare them in Containers vs microVMs for AI agents.
A checklist for a safe YOLO machine
- A separate machine. A cloud VM or a local VM. Not your laptop, not a server running production.
- A non-root user. The CLI rejects the flag when run as root.
useradd -m -s /bin/bash agent su - agent claude --dangerously-skip-permissions - No host secrets. Don't copy in
~/.sshor cloud credential files. Use a GitHub token limited to the one repo. - Deny rules for the commands you never want, like pushing to
main. - Limit the network if the task doesn't need the internet.
- Make it cheap to throw away. If you can recreate the machine in a minute, a bad run costs you a minute.
How does this look on Yurt?
Each Yurt VM is a Firecracker microVM with its own kernel, made to be thrown away. Create one per task, add the non-root user, and run the agent. When it's idle the VM sleeps with its memory saved, so a long unattended run can pause and resume without losing its place.
yurt new yolo-1 && yurt ssh yolo-1
root@yolo-1:~# useradd -m -s /bin/bash agent && su - agent
agent@yolo-1:~$ claude --dangerously-skip-permissions
Questions
Is it safe to use --dangerously-skip-permissions?
Only in an isolated environment. Anthropic's docs list the bypassPermissions mode as for isolated containers and VMs only.
Why does Claude Code refuse --dangerously-skip-permissions as root?
The CLI rejects the flag when run as root, and the docs say to run unattended sessions as a non-root user. Create a normal user and run it from there.
Do deny rules still work with --dangerously-skip-permissions?
Yes. The docs say deny rules block in every mode, including bypassPermissions.
Does a dev container protect my credentials?
Not fully. Anthropic's docs say a dev container does not prevent a malicious project from exfiltrating anything inside it, including the Claude Code credentials in ~/.claude.
Is a VM safer than a container for an AI agent?
A VM has its own kernel, so escaping it means breaking the hypervisor, not just the host kernel. Both count as isolated in Anthropic's docs.
Sources
- Claude Code permission modes, read 2026-11-29
- Claude Code dev containers, read 2026-11-29
- Claude Code security, read 2026-11-29
Give your agent its own computer. Full root, its own IPv6, and it sleeps with its memory when idle. Plans from $20/month, paid back as VM time.
curl -fsSL https://getyurt.dev/install | shKeep reading
Setup
How do you run Claude Code in the cloud?
Run Claude Code on a cloud VM instead of your laptop: what machine you need, the install command, logging in without a browser, and keeping it running after you disconnect.
Setup
How do you keep Claude Code running when your laptop is closed?
Claude Code stops when your laptop sleeps or SSH drops. Three ways to keep it running: tmux on a server, headless claude -p jobs, and a VM that sleeps with its memory.
Guide
Containers vs microVMs for AI agents
Why we give every AI agent its own kernel instead of a container: isolation, systemd, Docker inside, and whole-machine snapshots. Plus where containers still win.