Originally published in German on syntaxlabor.de. As of October 27, 2026; commands checked against Anthropic, Cursor, and OpenAI docs. Contabo prices from contabo.com/de/vps (promo pricing for the first 24 months — confirm in checkout).
Long agent runs have a boring failure mode: you close the laptop and the session dies. Claude Code, the Cursor CLI, and the Codex CLI all run in a terminal, so you can start them on a small Linux VPS over SSH and reattach later.
Why a server at all?
- The agent keeps going while your laptop sleeps or you are offline. Reattach over SSH.
- Isolation: shell access on the VPS instead of on a personal machine full of browser logins.
- Phone control: Claude Code supports Remote Control (paid plans; see below).
A VPS does not change model costs. You still need a subscription or an API key. Use a cost calculator if you want monthly tool spend side by side.
How much server do you need?
Claude Code’s docs want Ubuntu 20.04+ / Debian 10+ / Alpine 3.19+, at least 4 GB RAM, x64 or ARM64, and a network. The models run in the vendor cloud; RAM is mostly for your project (build, tests, DB, dev server).
Example entry-level Contabo VPS (site prices, retrieved 2026-10-27; promo for first 24 months):
| Plan | vCPU | RAM | Storage | Listed price |
|---|---|---|---|---|
| VPS 4 | 4 | 8 GB | 100 GB SSD | from ~€4.40/mo |
| VPS 6 | 6 | 12 GB | 200 GB SSD or 100 GB NVMe | from ~€6.00/mo |
| VPS 8 | 8 | 24 GB | 300 GB SSD or 150 GB NVMe | from ~€11.20/mo |
Setup fees and post-promo prices: check the order flow. Source: contabo.com/de/vps (no tracking link in this cross-post).
Step 1: Prepare the box
sudo apt update && sudo apt install -y git tmux
tmux new -s agent # start
# … later …
tmux attach -t agent # reattach
tmux is the important bit: the session survives disconnects. Anthropic also recommends tmux/screen when you start Claude on a remote machine.
Step 2: Claude Code — install & login
curl -fsSL https://claude.ai/install.sh | bash
claude --version
claude doctor
- Interactive SSH:
claude→ presscto copy the login URL, open it locally, paste the code back. - Scripts:
claude setup-token→ year-long OAuth token asCLAUDE_CODE_OAUTH_TOKEN(or useANTHROPIC_API_KEY). - Headless:
claude -p "…". -
Remote Control (phone):
claude remote-control//remote-control— Pro/Max/Team/Enterprise only; needs a normalclaude auth login, not API key / setup-token. Outbound HTTPS only.
Free plan does not include Claude Code.
Step 3: Cursor CLI
curl https://cursor.com/install -fsS | bash
NO_OPEN_BROWSER=1 agent login # prints the login URL
agent status
# headless / plan modes: agent -p … · --mode=plan|ask
# background → Cloud Agents: agent & then agent ls / agent resume
CURSOR_API_KEY works for non-interactive use. Docs: cursor.com/docs/cli.
Step 4: Codex CLI
curl -fsSL https://chatgpt.com/codex/install.sh | sh
codex login --device-auth # device-code login (beta; enable in ChatGPT security settings)
# SSH tip: tunnel local port 1455 if the flow needs it
codex exec "…"
codex resume
codex login status
Treat ~/.codex/auth.json like a password. OpenAI warns not to expose Codex execution in untrusted/public environments. API path: --with-api-key (API pricing).
Security checklist
- Separate non-root user; SSH keys only; no password auth if you can.
- Secrets in env / secret store — not in the repo the agent can
cat. - Firewall: only SSH (and what you deliberately open).
- Don’t point an agent with broad shell access at production credentials.
- Prefer
tmuxso a dropped SSH session does not orphan a half-finished run without a way back.
What does it cost overall?
VPS (a few €/month) plus the tool plan or API spend. The VPS is usually the smaller line item; token/subscription cost dominates. Measure before stacking Ultra + Max “just in caseâ€.
Verdict
A small Linux VPS, a dedicated user, tmux, and the right headless login path (NO_OPEN_BROWSER=1, device-auth, setup-token / OAuth) are enough to keep coding agents alive when the laptop is closed. Start with one tool you already pay for, confirm login over SSH once, then automate.
Sources
- Claude Code · Setup, authentication / remote-control docs (retrieved 2026-10-27)
- Cursor CLI · Overview & authentication
- Codex CLI · install & auth
- Contabo VPS (prices change — verify at checkout)
I write Syntaxlabor, a free **German-language* digest on AI coding tools (Cursor, Claude Code, agents) for indie devs, 3× a week. Archive without signup: syntaxlabor.de/digest.*
Top comments (0)