How to run Claude Code 24/7 on a server

· 0x.cloud Team

How to run Claude Code 24/7 on a server

To run Claude Code 24/7, keep the claude process on a VPS inside tmux, steer it from your phone with Remote Control or Telegram, and let cron fire claude -p for recurring jobs. Close your laptop and the session keeps going. You need a server with at least 4 GB RAM (Claude Code's official minimum), a Claude subscription for phone access, and about 15 minutes of setup.

Here's the part most guides skip: an always-on agent rarely dies. It stalls, waiting on a permission prompt nobody is awake to answer. This guide covers the four official ways to stay connected to the agent and the permission settings that let it work overnight without wrecking anything.

Can Claude Code run 24/7? What that actually means

Claude Code isn't a daemon that goes looking for work. It's an agent that completes tasks: read code, make changes, run tests. "24/7" comes down to four things:

  1. The process survives a closed laptop or a closed console.
  2. You can reach the session from anywhere: phone, browser, chat app.
  3. Long tasks don't stall on permission prompts nobody is around to answer.
  4. Recurring jobs start on their own on a schedule.

tmux handles the first, Remote Control or Channels the second, your permission mode the third, and claude -p plus cron the fourth.

Why you need a server to run Claude Code 24/7

Anthropic's Remote Control docs are explicit: the session runs on your machine, so the computer has to stay on and the claude process has to keep running. Laptops sleep and home internet drops. A VPS doesn't:

  • it's on around the clock, independent of your network;
  • it keeps the agent away from your personal files, passwords and logged-in browser;
  • it has unmetered bandwidth at up to 1 Gbps for git clone, packages and Docker.

Claude Code's system requirements: 4 GB RAM or more, x64 or ARM64, Ubuntu 20.04+ or Debian 10+.

Workload 0x.cloud plan Specs Monthly Hourly
One session, web app, tests s2-4 2 vCPU, 4 GB RAM, 60 GB NVMe $15.99 ~$0.109520
Parallel sessions, Docker Compose, a browser s4-8 4 vCPU, 8 GB RAM, 120 GB NVMe $31.99 ~$0.219105

Why not the $7.99 s1-2? It's 2 GB, below the official minimum, and a build or npm install can trip the OOM killer. Install and login steps are in deploy Claude Code; the ready server setup is on Claude Code VPS. The 0x.cloud "AI agents" image ships with Node, Python, Git, tmux and Docker already installed.

Layer 1: tmux keeps the session alive

The simplest, sturdiest layer. Even the Remote Control docs say that when you run claude on a remote machine, start it inside tmux or screen.

tmux new -s claude        # new session
cd ~/project && claude    # start the agent
# Ctrl+B, then D to detach; the agent keeps working
tmux attach -t claude     # reattach later

That alone lets you leave a task running overnight and check in from the web console in your dashboard in the morning. Typing in a terminal on a small screen gets old fast, though, which is where the next two layers come in. More on tmux: tmux on a server.

Layer 2: Remote Control from your phone

Remote Control connects the Claude app (iOS, Android) or claude.ai/code to a session running on your server. Your code, files, MCP servers and tools stay on the VPS; the phone is a window into that session. You can even attach photos and files from your phone.

Requirements per the docs (checked 20.11.2026):

  • a paid Claude plan; API keys aren't supported;
  • a claude.ai sign-in via /login (or claude auth login); the long-lived token from claude setup-token can't open Remote Control sessions;
  • on Team and Enterprise, an Owner has to enable it first.

Start server mode inside tmux:

tmux new -s rc
cd ~/project
claude remote-control --name "My Project"
# first run: answer y to "Enable Remote Control?" and to trusting the folder
# press space to show a QR code, scan it with the Claude app

Useful flags: --spawn worktree gives each new session its own git worktree so parallel tasks don't edit the same files, and --permission-mode sets the starting permission mode (more on modes below).

What matters for always-on use:

  • No inbound ports. The server only makes outbound HTTPS requests to the Anthropic API, so your firewall can stay shut.
  • Push notifications. In /config, turn on "Push when actions required" (permission prompts and questions) and "Push when Claude decides." Your phone pings you when a task finishes or Claude needs a call from you.
  • Long network outages. In server mode the process exits after some time offline. Running claude remote-control --continue in the same folder brings the last session back for a limited time after it stopped.
  • Logins expire. When your claude.ai login ends, the Remote Control session disconnects. Check the date with claude auth status --text and renew early with /login.

Layer 3: Claude Code in Telegram with Channels

If you'd rather hand out tasks in a chat app, Anthropic offers Channels: an MCP server that pushes events into a session that's already running and sends replies back. The official plugins cover Telegram, Discord and iMessage (macOS only, so not for a VPS). It's a research preview, so flag syntax may change. It works with a claude.ai login or a Console API key; on Team and Enterprise an Owner turns it on.

Telegram setup from the docs:

  1. Create a bot with @BotFather using /newbot and copy the token.
  2. Install Bun; the channel plugins are Bun scripts.
  3. In Claude Code, run /plugin install telegram@claude-plugins-official, then /telegram:configure <token>.
  4. Restart with the channel enabled, inside tmux:
tmux new -s tg
claude --channels plugin:telegram@claude-plugins-official
  1. Message your bot, get a pairing code, run /telegram:access pair <code>, then /telegram:access policy allowlist so only you can reach it.

Messages arrive only while the session is open, so tmux isn't optional here. The Telegram plugin can relay permission prompts into the chat, so you can approve commands right from Telegram. That also means anyone on the allowlist can approve them, so keep it to yourself. Community-built Telegram bridges exist on GitHub too, but they're unofficial: read the code and check what access they need before installing one on your server.

Layer 4: permissions, so the agent doesn't stall at 3 a.m.

The most common reason "24/7" fails: the agent hits "may I run this command?" and nobody answers. The permission modes, per the docs:

Mode Runs without asking Use it when
default file reads in the working directory you're answering pushes from your phone
acceptEdits file edits plus mkdir, touch, rm, mv, cp, sed inside the working directory; other commands still prompt Claude writes code, you approve builds and network calls
auto everything, with a background safety classifier reviewing each action long overnight tasks; available on all plans with a supported model
bypassPermissions (--dangerously-skip-permissions) everything, unchecked isolated containers and VMs without internet access only

The practical choice on a server: auto for long tasks and acceptEdits plus phone approvals for everything else. The docs are blunt about --dangerously-skip-permissions: isolated environments without internet access only, with no protection against prompt injection. Claude Code also refuses to start in that mode as root or under sudo. Critical-path rm removals aren't auto-approved in any mode by default.

For more ways to fence in an agent (permissions, budget, access), see how to limit an AI agent.

Layer 5: scheduled jobs with claude -p and cron

Not everything needs a live session. For recurring work (nightly dependency bumps, log triage, a morning report) use non-interactive mode, claude -p: it runs the task, prints the result and exits.

crontab -e
# every day at 03:00 server time:
0 3 * * * cd /home/agent/project && /home/agent/.local/bin/claude -p "Update dependencies on branch night/deps, run the tests, commit" --permission-mode auto --permission-prompts none >> /home/agent/claude-night.log 2>&1

Things to know:

  • --permission-prompts none (in recent Claude Code versions) means nothing waits for an answer: anything that would prompt is denied and the run keeps going.
  • cron doesn't load your PATH, so the full path to claude is spelled out (the native installer puts it in ~/.local/bin).
  • If ANTHROPIC_API_KEY is set on the server, -p always uses it, so usage bills to the API instead of your subscription.

Inside an open session you also have /loop (for example, /loop 30m check CI), but those tasks only fire while the session is open and expire after a while. Anthropic's cloud scheduled tasks run without your server, on a fresh clone without your local files.

Options compared

Method Control from Claude runs on What you need
tmux plus the web console the web console in your dashboard your VPS just the server
Remote Control Claude app, claude.ai/code your VPS Claude subscription, /login sign-in, outbound HTTPS
Channels (Telegram, Discord) your chat app your VPS Bun, plugin, research preview
claude -p plus cron a schedule your VPS a login or API key, a no-prompt permission setup
Cloud sessions and cloud scheduled tasks claude.ai/code, a schedule Anthropic infrastructure a GitHub repo

They stack well: tmux as the base, Remote Control to supervise from your phone, Telegram for quick requests, cron for the routine stuff.

An overnight task, end to end

  1. In the evening, open the web console, run tmux attach -t rc and confirm Remote Control is connected.
  2. In the Claude app, write the task: "Switch to branch night/deps, update dependencies, fix failing tests, one commit per package. Don't push to main."
  3. The agent works on the server. If it needs approval, you get a push and answer from your phone or straight from Telegram.
  4. In the morning, review the branch history and the session's summary.

The separate branch and the no-push rule aren't red tape: any bad overnight result rolls back with one command.

Common mistakes (and why Remote Control stops working)

  • No tmux. The console closed and took the session with it.
  • Too little memory. On 2 GB the OOM killer ends the process mid-build. Stick to the official 4 GB minimum.
  • ANTHROPIC_API_KEY or a setup-token is active. Remote Control needs a claude.ai login and won't start with either. Check /status, remove the variable and run claude auth login.
  • The bot answers everyone. Without the Channels allowlist, anyone who finds your bot can give your agent orders.
  • The server rebooted and the agent is gone. tmux doesn't survive a reboot. After the first manual run (the confirmation and folder trust are saved), you can bring it back from cron with @reboot tmux new -d -s rc 'cd ~/project && ~/.local/bin/claude remote-control', using the full path since cron has no PATH.
  • Remote Control dropped after a few weeks. Your claude.ai login expired. Check claude auth status --text and renew ahead of time.
  • The disk fills with logs and node_modules. Run df -h weekly and clear out old checkouts and Docker images.

What it costs

An s2-4 server on 0x.cloud is $15.99/mo, or about $0.109520 an hour billed hourly, and hourly billing never costs more than the monthly price. A one-week trial (168 hours) stops at the $15.99 monthly price, since hourly charges in a calendar month never go above it: your first paid server needs one top-up of at least $5, and setup is $0. If it's not a fit, delete the server; billing stops right away and the remainder goes back to your balance. Your Claude subscription or API usage is billed separately by Anthropic. All plans are on the pricing page.

Your agent can create the server itself through the 0x.cloud MCP server or API:

Prompt for an AI agent

Create an s2-4 server with the AI agents image on Ubuntu 24.04 on 0x.cloud. Add a non-root user named agent, install Claude Code under it with the official installer (curl -fsSL https://claude.ai/install.sh | bash), plus Bun from bun.sh for Channels. Don't sign in to anything; I'll log in myself. Show me the dry_run price first.

Run Claude Code 24/7 FAQ

Can Claude Code run 24/7? Yes, as long as the claude process runs on a machine that stays on, such as a VPS inside tmux. The agent works task by task; between tasks it waits for your next message from the terminal, the Claude app or Telegram. For scheduled work, run claude -p from cron.

How do I control Claude Code from my phone? Use Remote Control. Run claude remote-control on the server, press space, scan the QR code with the Claude app, and continue the session on your phone or at claude.ai/code. It needs a paid Claude plan and a /login sign-in; API keys and setup-token tokens don't work.

Is there an official Claude Code Telegram plugin? Yes. Channels, a research preview feature, ships telegram@claude-plugins-official. It forwards your bot's messages into a running session and sends replies back. You need Bun and must start claude with the --channels flag. It works with a claude.ai login or a Console API key.

Why is Claude Code Remote Control not working on my server? The usual causes: ANTHROPIC_API_KEY or a setup-token is the active credential (Remote Control needs a claude.ai login), your login expired, a Team or Enterprise owner hasn't enabled it, or outbound HTTPS to the Anthropic API on port 443 is blocked. Run /status to see which credential is in use.

What VPS do I need to keep Claude Code running? Claude Code's official minimum is 4 GB RAM. On 0x.cloud that's s2-4 (2 vCPU, 4 GB, 60 GB NVMe) at $15.99/mo or about $0.109520 an hour. For parallel sessions plus Docker, use s4-8 with 8 GB.