---
url: https://clusto.app/docs/run-claude-code-on-a-server.md
description: >-
  Run Claude Code on a server or VPS so sessions keep working when your laptop
  is closed, then reattach from your phone, desktop, or browser with Clusto.
---

# Run Claude Code on a Server or VPS

You can run Claude Code on an always-on Linux server or VPS and keep working
with it from any device. Install the Clusto daemon (`clustod`) on the server,
start Claude Code sessions through it, and attach from the desktop app, the
Android app, or the web app. The sessions belong to the daemon, not to your
laptop or phone, so closing the lid or losing signal does not stop them.

## Why run Claude Code on a server

A long agent run needs a machine that stays on. On a laptop, the run stops or
stalls when the machine sleeps, changes networks, or shuts down. On a server or
VPS, the process keeps going, and you decide when to look at it.

A server also gives you a consistent environment: the same checkout, toolchain
and credentials every time, regardless of which device you are holding.

## The usual approach: SSH and tmux

Most people start with SSH and tmux, often with Tailscale so the server is
reachable from anywhere. It works, and it costs nothing:

* SSH into the server, start `tmux`, run `claude`, and detach.
* Reconnect later and run `tmux attach`.

The friction shows up in daily use:

* Typing into a terminal over a phone SSH client is awkward, and a dropped
  connection means reconnecting and reattaching by hand.
* Nothing tells you an agent is waiting for a permission prompt. You check the
  pane to find out.
* Each machine is a separate SSH target with its own tmux server, so a view
  across several machines is something you build yourself.
* There is no graphical view of a conversation, only the terminal.

See [A tmux Alternative for AI Coding Agents](/tmux-alternative-for-ai-agents)
for a longer comparison.

## The Clusto way

Clusto runs a small daemon on the server. The daemon owns each session and its
process, keeps a replayable output stream, and lets any number of clients attach
over a WebSocket. The details are in [Architecture](/architecture) and
[Transport and Resume](/transport).

### 1. Install Claude Code on the server

Install the Claude Code CLI on the server and sign in. If the CLI is missing
when you create a session, the app shows the install command:

```bash
npm install -g @anthropic-ai/claude-code
```

If a login expires later, the session view shows a **Sign in** banner that opens
a terminal on the node running `claude auth login`.

### 2. Install the Clusto daemon

On a Linux server, run the install script and then the wizard:

```bash
curl -fsSL https://dl.clusto.app/install.sh | sh
clusto install
```

The script installs the CLI for the detected x64 or ARM64 platform. The wizard
installs the matching daemon, asks for its connection and cluster settings,
writes the configuration, and starts the service. On Windows, the PowerShell
installer does the same and registers the `clustod` service. See
[Downloads and Installation](/downloads) for both.

Install Claude Code first if you can. When the daemon finds the Claude CLI on
first start, it adds a **Claude agent** entry to the node's shell list. If you
install the CLI later, open the node's **Node settings** in the **Cluster** view
and use **Shells > Add Shell** with `claude` as the program.

### 3. Connect the app

Get the node's token:

```bash
clusto daemon get-token
```

Install the Clusto app from [clusto.app/download](https://clusto.app/download),
or open the web app at [clusto.app/app](https://clusto.app/app). Open
**Connection** and add the server's host, port (9178 by default) and token. Run
**Scan Network** in the native app to find daemons on Tailscale, your local
network, or (from saved profiles) over [Clusto Tunnel](/clusto-tunnel#finding-nodes-with-scan-network).

How the app reaches the server depends on your setup:

* Tailscale, or any network where the server's address is reachable. The
  daemon listens on `0.0.0.0:9178` by default.
* [Clusto Tunnel](/clusto-tunnel), a licensed feature that connects native apps
  directly and the web app through a relay, with no port forwarding or VPN.
* The web app is served over HTTPS, so browsers require the node to serve
  `wss://`. See [Web Client (PWA)](/web-client) for TLS options.

The token authenticates every connection. Do not expose port 9178 to the
internet without TLS.

### 4. Start a Claude Code session

In the app choose **New Session**, pick a project, and select the
**Claude agent** preset. You get a real terminal running Claude Code on the
server. Split panes, rename sessions and manage several at once in the
[Terminal Workspace](/terminal-workspace).

If you prefer a conversation view over a terminal, create a [Chat](/chats)
instead and pick Claude as the provider.

### 5. Detach and reattach

Close the app, shut the laptop, or lose the connection. The session keeps
running on the server. Open Clusto on another device, connect to the same node,
and pick the session from the **Terminals** tree. The client resumes from where
it left off without losing output.

Only one client types into a session at a time. Others attach as viewers, and
you take over input explicitly. See [Session Exclusivity](/session-exclusivity).

## Knowing when Claude needs you

Clusto marks a session with a `?` when the agent is waiting for an answer and can
send a notification with the prompt text. The desktop app shows a popup and plays
a sound when a session goes idle. On Android, optional
[background notifications](/background-notifications) check the cluster about
every 15 minutes while the app is closed. See
[Agent Waiting Marker](/agent-attention).

## Codex, Copilot CLI and OpenCode too

The daemon is not tied to one agent. Any CLI you can run in a terminal works as a
session. Chats support Claude, Codex, OpenCode and OpenRouter as providers, and
Clusto detects working and idle state for Claude Code, Codex, OpenCode and
GitHub Copilot CLI. To launch another agent, use the **Custom...** shell preset
or add it to the node's shell list. For setup, see
[Configuration](/configuration).

You can also schedule unattended runs, such as `claude -p "..."`, with
[Tasks](/tasks), and spread work across several machines with
[Clustering](/clustering).

## How this compares with Remote Control

Anthropic's Remote Control lets you continue a Claude Code session that runs on
your own machine from another device, with the connection relayed through
Anthropic's services. It covers Claude Code only. Check Anthropic's
documentation for its current requirements and limits.

Clusto is a different design. The sessions live on daemons you install on your
own machines, and the clients connect to those daemons directly or through the
optional tunnel. One app covers many machines and several agents, not only Claude
Code, and the machines can be always-on servers. Clusto requires a license; the
Personal plan is free. If you only want to continue one laptop session from your
phone, Remote Control may be all you need.

## FAQ

### Do I need Tailscale?

No. Tailscale is a convenient way to make the server reachable and to get a
browser-trusted certificate for the web app. You can also connect directly to the
server's address, or use Clusto Tunnel.

### What happens if the server restarts?

Terminal sessions are ordinary processes on that server, so a machine reboot ends
them. When a node no longer has a session, the pane shows that it was not found
and offers **Reconnect** or **New session**. [Chats](/chats) are different: the
transcript is durable, and a chat resumes its conversation after a daemon or node
restart. If you run several nodes, work on the other nodes is unaffected.

### Does my code leave the server?

Sessions and files stay on your nodes. Claude Code talks to Anthropic as it
always does. If you use a cloud relay, such as the web app through Clusto
Tunnel, traffic passes through Clusto's relay but still requires your node's
token.

### Is it free?

Clusto requires a license. The Personal plan is free for one user on up to three
devices. See [Accounts and Licensing](/accounts-licensing).

## Get started

1. Install the daemon on your server with the commands in
   [Downloads and Installation](/downloads).
2. Download the app from [clusto.app/download](https://clusto.app/download) or
   open [clusto.app/app](https://clusto.app/app).
3. Add the node under **Connection** and start your first Claude Code session.
