Short answer: rent a Linux VM with at least 4 GB of RAM, install Claude Code with curl -fsSL https://claude.ai/install.sh | bash, run claude and complete the login by pasting a code from your browser, then run it inside tmux so it keeps going after you disconnect.
Why run Claude Code on a remote machine?
On a laptop, the agent stops when the lid closes, competes with your browser for RAM, and runs with access to everything in your home directory. A cloud machine fixes all three:
- It keeps working while you don't. Long refactors and test loops finish overnight.
- You can run several at once. One VM per task, so agents don't fight over ports, branches or
node_modules. - Mistakes stay on the VM. If the agent deletes the wrong directory, it deletes it on a machine you can throw away.
What kind of machine do you need?
Anthropic's setup page lists 4 GB+ of RAM and Ubuntu 20.04+, Debian 10+ or Alpine 3.19+. The agent itself is light. What needs the resources is everything it runs: builds, test suites, dev servers, Docker.
| Option | Good for | Watch out for |
|---|---|---|
| A plain VPS | One always-on agent, lowest monthly price | You pay 24/7, you set up and secure it yourself |
| Agent sandbox (per-second billing) | Many short tasks | Session time limits on some plans, per-hour prices are higher |
| Persistent VM that sleeps (Yurt) | Agents that work in bursts and sit idle in between | Newer product, fewer integrations so far |
We compare the actual prices in How much does a cloud VM for an AI agent cost?
How do you install Claude Code on a Linux server?
SSH in and use the native installer from Anthropic's docs:
curl -fsSL https://claude.ai/install.sh | bash
If you'd rather use npm, the package needs Node.js 22 or later. The docs say not to use sudo with it:
npm install -g @anthropic-ai/claude-code@latest
You need a paid plan. The docs say Claude Code requires a Pro, Max, Ultra, Team, Enterprise or Console account, and the free claude.ai plan doesn't include it.
How do you log in without a browser on the server?
Run claude. A server has no browser to open, so:
- Press
cto copy the login URL, and open it in the browser on your own computer. - Sign in. If the browser shows a code instead of redirecting, paste it into the terminal at the
Paste code here if promptedprompt. - Wait for
Login successful.
On Linux the credentials are stored in ~/.claude/.credentials.json. For scripts and CI, the docs describe claude setup-token, which creates a long-lived token you pass as CLAUDE_CODE_OAUTH_TOKEN. An ANTHROPIC_API_KEY works too, billed per token instead of through your subscription.
How do you keep it running after you disconnect?
If you start claude straight from SSH, it dies when the connection drops. Start it inside tmux:
tmux new -s agent # start a session, run claude inside it
# press Ctrl-b then d to detach; the agent keeps running
tmux attach -t agent # come back later, from any computer
More options, including running it without a terminal at all: How to keep Claude Code running when your laptop is closed.
Can you let it run without asking permission?
Yes, with --dangerously-skip-permissions, and a cloud VM is exactly where Anthropic says it belongs. Read Is --dangerously-skip-permissions safe? before turning it on. Among other things, the CLI refuses the flag when you run it as root.
How does this look on Yurt?
yurt new agent-1 # a Firecracker VM with root and its own IPv6
yurt ssh agent-1
root@agent-1:~# claude # preinstalled; log in once
When the agent goes idle, the VM sleeps with its memory saved and stops billing. When you come back it wakes in about 0.04 seconds, with the session still where you left it. How that works.
Questions
Do I need a paid plan to run Claude Code on a server?
Yes. Anthropic's docs say Claude Code requires a Pro, Max, Ultra, Team, Enterprise or Console account. The free claude.ai plan does not include it.
How much RAM does Claude Code need?
Anthropic lists 4 GB or more. Give it more if the agent will run builds, test suites or Docker.
How do I log in to Claude Code over SSH?
Run claude, press c to copy the login URL, open it on your own computer, sign in, and paste the code it shows back into the terminal.
Where does Claude Code store credentials on Linux?
In ~/.claude/.credentials.json, readable only by your user.
Will Claude Code keep running if I close my SSH session?
Not if it was started directly from SSH. Run it inside tmux or screen, or as a headless claude -p job.
Sources
- Claude Code setup, read 2026-11-29
- Claude Code authentication, read 2026-11-29
- Claude Code permission modes, 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
Safety
Is --dangerously-skip-permissions safe?
What Claude Code's --dangerously-skip-permissions flag does, what Anthropic's docs say about where to run it, what can go wrong, and a checklist for running it safely on a VM.
Costs
How much does a cloud VM for an AI agent cost?
2026 prices for running AI coding agents on cloud VMs: per-hour rates for Boat, E2B, Daytona, exe.dev and Yurt, plan fees, what $20, $100 and $500 buy, and a cost calculator.
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.