Home / Agents

Setup

How do you run Claude Code in the cloud?

Put the agent on a machine that never sleeps, never runs out of battery and can't touch your laptop. Here's the full setup, from an empty Linux server to a logged-in agent.

Updated 2026-11-29 · 7 min read

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:

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.

OptionGood forWatch out for
A plain VPSOne always-on agent, lowest monthly priceYou pay 24/7, you set up and secure it yourself
Agent sandbox (per-second billing)Many short tasksSession time limits on some plans, per-hour prices are higher
Persistent VM that sleeps (Yurt)Agents that work in bursts and sit idle in betweenNewer 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:

  1. Press c to copy the login URL, and open it in the browser on your own computer.
  2. Sign in. If the browser shows a code instead of redirecting, paste it into the terminal at the Paste code here if prompted prompt.
  3. 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

  1. Claude Code setup, read 2026-11-29
  2. Claude Code authentication, read 2026-11-29
  3. 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 | sh

Keep reading