TutorialNov 21, 20267 min read

How to Run Claude Code on a VPS (24/7, Over SSH)

Run Claude Code on a Linux VPS so it keeps working when your laptop is closed: which plan meets the 4 GB RAM requirement, install, login without a browser, tmux, scheduled jobs and security.

Short answer: Claude Code runs on any Linux VPS with at least 4 GB of RAM (Anthropic's requirement), so on Rdp.Vision the smallest plan that fits is 4 vCPU, 6 GB RAM and 40 GB NVMe for $13 a month. Install it with one command, log in by opening the printed URL on your own computer, and start it inside tmux so it keeps working after you close SSH. For jobs on a timer, use claude -p with a token from claude setup-token.

Why a server at all? A coding agent that works for an hour shouldn't stop because your laptop went to sleep, and an agent with shell access is better off on a machine that holds only the project, not your personal files. A VPS gives it both, and you can check on it from any device with SSH, including your phone.

01What Do You Need to Run Claude Code on a VPS?

Anthropic's requirementOn our plans
Memory4 GB RAM or more4 vCPU, 6 GB, 40 GB NVMe for $13; 6 vCPU, 10 GB for $26
SystemUbuntu 20.04+, Debian 10+, Windows Server 2019+Ubuntu 24.04, Debian 12, Windows Server 2019, 2022 and 2025
AccountClaude Pro, Max, Ultra, Team or Enterprise, or a Console account with API billing. The free plan has no Claude CodeYou bring your own account
CountryAnthropic's supported countriesNetherlands, Germany, Poland, Romania and the USA are on the list. Hong Kong is not
GPUNot needed: the model runs at AnthropicNo plan has a GPU, none is needed

Requirements from Anthropic's setup page, checked on 21 November 2026.

02Which Plan Should You Pick?

4 vCPU, 6 GB, 40 GB NVMe ($13)

One Claude Code session on a normal repository, with git, Node or Python and the project's tests.

6 vCPU, 10 GB, 40 or 80 GB NVMe ($26 or $39)

Several sessions side by side, Docker builds, large test suites, or an agent that drives a headless browser.

The 1 and 2 GB plans are below Anthropic's minimum, so they're not a good fit. Disk fills up faster than people expect with node_modules, Docker images and build output: if it does, see Linux VPS Disk Full?.

Top up $50 or more and get up to 15% extra on your balance.

Nano1 vCPU · 1 GB · 10 GB NVMe$3.90/mobilled monthlyBuy
Most popularSpark1 vCPU · 2 GB · 20 GB NVMe$6.50/mobilled monthlyBuy
Pulse2 vCPU · 2 GB · 20 GB NVMe$6.50/mobilled monthlyBuy
Surge4 vCPU · 6 GB · 40 GB NVMe$13.00/mobilled monthlyBuy
Storm6 vCPU · 10 GB · 40 GB NVMe$26.00/mobilled monthlyBuy
Apex6 vCPU · 10 GB · 80 GB NVMe$39.00/mobilled monthlyBuy

Full root SSH access · NVMe storage · DDoS protection · No setup fee

03Step 1: Order the Server and Connect

  1. 1Order a Linux VPS with Ubuntu 24.04, in Amsterdam, Frankfurt, Warsaw, Romania or New York. It's online a few minutes after the payment confirms.
  2. 2Copy the IP and root password from the server page.
  3. 3Connect with SSH from your computer: ssh root@YOUR_SERVER_IP.

04Step 2: Create a Normal User for the Agent

Claude Code runs shell commands for you. Give it its own user instead of root, so a wrong command can't touch the whole system:

bash
adduser claude                      # pick a password when asked
usermod -aG sudo claude             # optional: lets you use sudo as this user
rsync --archive --chown=claude:claude ~/.ssh /home/claude   # only if you log in with an SSH key
apt update && apt install -y git tmux curl
su - claude

From now on, work as claude. Next time you can connect directly with ssh claude@YOUR_SERVER_IP.

05Step 3: Install Claude Code

Anthropic's native installer needs no Node.js and updates itself in the background:

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

It puts the claude command in ~/.local/bin. If the shell says claude: command not found, add that folder to your PATH and check the install:

bash
echo 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
claude --version
claude doctor

claude doctor prints what's installed and any warnings, without starting a session.

06Step 4: How Do You Log In Without a Browser?

The server has no browser, so the login happens on your own computer:

  1. 1Start it in your project folder. Run claude. On a server it can't open a browser window.
  2. 2Copy the login URL. Press c to copy it, or select it in your SSH window, and open it in the browser on your computer.
  3. 3Sign in and paste the code. After you sign in, the browser shows a code. Paste it in the terminal at "Paste code here if prompted" and press Enter.

Your login is stored in ~/.claude/.credentials.json, readable only by your user. If you pay per token through the Claude Console instead of a subscription, set ANTHROPIC_API_KEY in the environment and Claude Code asks once whether to use it.

07Step 5: Keep It Running After You Disconnect

A program started in a plain SSH session stops when the connection drops. Start Claude Code inside tmux instead:

bash
tmux new -s claude        # opens a session called "claude"
cd ~/myproject
claude

Leave it working with Ctrl+B, then D: tmux detaches, Claude Code keeps going and you can close SSH. Later, from any device:

bash
ssh claude@YOUR_SERVER_IP
tmux attach -t claude

tmux sessions end when the server restarts. Your conversation isn't lost: in the project folder, claude --continue picks up the most recent one.

08Step 6: Run Claude Code on a Schedule

For a job that runs on its own, such as a nightly report, a dependency check or a log summary, use non-interactive mode, claude -p. It needs a login that works without a browser:

bash
claude setup-token

This opens the same browser sign-in as before and prints a token that lasts one year (it needs a Pro, Max, Ultra, Team or Enterprise plan). Save it in a file only your user can read:

bash
echo 'CLAUDE_CODE_OAUTH_TOKEN=paste-your-token-here' > ~/.claude-env
chmod 600 ~/.claude-env

Then a small script, ~/nightly.sh:

bash
#!/bin/bash
set -a; . "$HOME/.claude-env"; set +a
cd "$HOME/myproject"
"$HOME/.local/bin/claude" -p "Run the tests. If any fail, write the cause and a suggested fix to reports/tests.md" \
  --allowedTools "Bash(npm test *),Read,Write" >> "$HOME/nightly.log" 2>&1

Make it executable with chmod +x ~/nightly.sh and add it to cron with crontab -e:

text
0 3 * * * /home/claude/nightly.sh

--allowedTools lists what Claude may do without asking. In -p mode anything else that needs approval is refused, so the job can't wander off. Keep the list as short as the job allows. The full flag reference is in Anthropic's docs on running Claude Code programmatically.

09How Do You Keep the Server Safe?

An agent with shell access is only as safe as the machine you give it.

SSH keys, not passwords

Log in with a key and keep the root password from the server page somewhere safe.

Close what you don't use

Dev servers the agent starts (ports 3000, 5173, 8000) don't need to face the internet. Reach them through a tunnel: ssh -L 3000:localhost:3000 claude@YOUR_SERVER_IP, then open http://localhost:3000 on your computer.

Limit SSH to your IP

with a rule in the firewall card on the server page, if your IP doesn't change often. See How do I open or block a port with the firewall?.

Commit before big tasks

With git you can undo whatever the agent changed: git diff to review, git restore . to throw it away.

Only the secrets the job needs

Don't put production keys in the project folder of an agent that can read every file there.

Back up the server

The Extras card on the server page has one free backup slot, daily or weekly at 03:00 UTC.

10Can You Use It from Windows RDP Instead?

Yes. Claude Code supports Windows Server 2019 and newer, and our Windows RDP plans run Windows Server 2019, 2022 or 2025. In PowerShell:

powershell
irm https://claude.ai/install.ps1 | iex

Anthropic recommends Git for Windows so Claude Code can use Bash; without it, it uses PowerShell. Windows makes sense when the project itself is a Windows program. For everything else, Linux is the simpler choice: SSH, tmux and cron work exactly as shown above.

More on running agents on a server: VPS for AI agents. Want a model that runs on the server itself instead? See Run a Local LLM on a VPS Without a GPU.

Yes. Claude Code runs on Ubuntu 20.04+, Debian 10+ and Windows Server 2019+ with at least 4 GB of RAM. You log in over SSH and keep it running in tmux.

  • claude code vps
  • run claude code on server
  • claude code ssh
  • claude code 24/7
  • claude code headless
  • ai coding agent vps

Keep reading

All articles