# Claude Code on a VPS

> Set up Claude Code on a remote Linux server: sign in without a browser on the machine, keep the session alive after you disconnect, and run it without prompts. Or use an EnvHaven workspace, a server with all of that done.

_Updated November 23, 2026 · Checked against Claude Code 2.1.308 in EnvHaven v1.9.0_

Two things trip people up when Claude Code moves to a remote server: signing in on a machine with no browser, and keeping the session alive after the SSH connection drops. An EnvHaven workspace is a remote server with both handled. That route comes first; the same setup on a VPS you run yourself follows.

## The ready-made server: an EnvHaven workspace

1. Create a workspace in any of 11 regions and open it in a browser. It is a Linux server of its own.
2. Tap **Launch**, choose Claude Code and tap **Sign in**: it opens claude.ai so you can approve the workspace, then takes the short code the page shows, so a Claude plan works with no API key. For an API key, choose **Set key** instead and paste `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN`; the workspace keeps it write-only.
3. Start it with one tap: signed in, Claude Code gets a green dot in the Launch menu and an icon in the workspace's top bar. Support is built in (2.1.308), so there is nothing to install or update.
4. Give it a task. The image writes `defaultMode: "bypassPermissions"` into the workspace user's own settings, so `claude` starts without prompts, as an unprivileged user.
5. Disconnect whenever you like. The terminal session stays on the server, and you can come back to it from the browser, from any SSH client, or from your own editor through Haven CLI.

Plans start at $15 a month, billed annually, with an HTTPS preview URL for what Claude Code builds, Docker on Plus and Pro, and no idle shutdown.

## On a VPS you set up yourself

**Create the server.** Any Linux VPS works (Ubuntu or Debian is the common choice). Log in over SSH and add a regular user with sudo, then run the agent as that user: full-access modes are meant for an unprivileged account, and some refuse root.

**Install Claude Code.**

```bash
curl -fsSL https://claude.ai/install.sh | bash
```

**Sign in without a browser on the server.**

- Run `claude` and sign in in the browser (or later with `/login`); on a remote machine, press `c` to copy the URL and paste back the code it shows.
- Or set `ANTHROPIC_API_KEY` for a Console API key, or `CLAUDE_CODE_OAUTH_TOKEN` with a one-year token from `claude setup-token` for CI and headless machines.

**Keep it running after you disconnect.** Start it inside tmux:

```bash
tmux new -s claude-code
claude --dangerously-skip-permissions
# detach: Ctrl+B, then D. Come back with: tmux attach -t claude-code
```

**Leave it on.** Make sure the server has no idle shutdown, and keep Claude Code updated yourself.

For work at set times rather than continuously, cron on that server can call it headless:

```bash
crontab -e
# every day at 07:00
0 7 * * * cd ~/my-project && claude -p "Summarize yesterday's commits into CHANGELOG.md"
```

What a self-managed server leaves to you is the rest: HTTPS and a public address for what Claude Code builds, updates for every tool, and the machine itself. The [cost comparison](https://envhaven.com/cost) puts the options side by side.

## Keep reading

- [Claude Code](https://envhaven.com/agents/claude-code)
- [Claude Code in the browser](https://envhaven.com/agents/claude-code/browser)
- [Claude Code on iPhone](https://envhaven.com/agents/claude-code/iphone)
- [Claude Code on iPad](https://envhaven.com/agents/claude-code/ipad)
- [Claude Code on Android](https://envhaven.com/agents/claude-code/android)
- [Claude Code on a Chromebook](https://envhaven.com/agents/claude-code/chromebook)
- [Claude Code on Windows](https://envhaven.com/agents/claude-code/windows)

Source: https://envhaven.com/agents/claude-code/vps
