Blog / Remote
Claude Code on a Server: RAM, CPU and 5 Security Settings
We measured live Claude Code sessions: 0.5 to 0.85 GB of RAM and about 1% of a CPU core each. Server sizes by session count, list prices, and 5 safety settings.

One active Claude Code session used 0.5 to 0.85 GB of RAM and about 1% of one CPU core in our measurements. Budget 0.85 GB per session plus 1 GB for the system and whatever your builds need: 4 GB fits 1 or 2 sessions, 8 GB fits 3 to 5, and 16 GB fits 6 to 10.
The verdict
Size the server by memory first. CPU matters less. We measured nine Claude Code sessions that were working on 2026-11-26. Each claude process held between 503 MB and 846 MB of private memory (median 549 MB). Averaged over each session's life, the process used 0.8% to 8% of one CPU core, with a median of 1.3%. The model runs on Anthropic's side, so the CPU on your server goes to the commands a session starts: builds, test runs, package installs, dev servers.
| Parallel sessions | Memory budget (0.85 GB each + 1 GB system) | Server class | Example price (Akamai/Linode Shared CPU) |
|---|---|---|---|
| 1 to 2 | 1.9 to 2.7 GB | 4 GB, 2 vCPU | $24 per month |
| 3 to 5 | 3.6 to 5.3 GB | 8 GB, 4 vCPU | $48 per month |
| 6 to 10 | 6.1 to 9.5 GB | 16 GB, 6 vCPU | $96 per month |
| 11 to 20 | 10.4 to 18 GB | 32 GB, 8 vCPU | $192 per month |
Prices are the list prices on Akamai's cloud CPU pricing page, checked 2026-11-26. The memory budget leaves the rest of each plan for builds and tests, which on a JavaScript or Rust project often use more than the sessions themselves.
The five security settings that matter most on a server where sessions run while nobody watches:
Readdeny rules for.env,~/.sshand~/.aws. Deny is checked before ask and allow, so it wins.- The sandbox on (
"sandbox": {"enabled": true}), with an allowed-domains list that starts at zero entries. "disableBypassPermissionsMode": "disable", so no one can start a session that skips every prompt.- A full
/loginsign-in, not asetup-tokentoken, if you want Remote Control. Check its end date withclaude auth status --text. - No open inbound ports: key-only SSH over a private network, and Remote Control, which uses outbound HTTPS on port 443 only.
Each one is explained below with the settings to paste.
Table of contents
- The verdict
- What we measured, and on which machines
- How to size the server
- What a server fixes, and what it doesn't
- Setup in seven steps
- The 5 security settings that matter
- A 12-point server checklist
- Mistakes that cost people hours
- Frequently asked questions
- The bottom line
What we measured, and on which machines
We took two read-only snapshots on 2026-11-26. Nothing was started or changed for the measurement.
The server is a 6 vCPU, 16 GB virtual machine on Ubuntu 24.04 (AMD EPYC, KVM), with a 320 GB disk and 4.5 GB of swap. It runs Code Tycoon plus a database and a few web apps. At 07:54 UTC:
| Server reading | Value |
|---|---|
| Claude Code sessions running | 0 (the last session transcripts were written about 1 hour 40 minutes earlier; 6 were written in the previous 24 hours) |
| Memory used / available | 10.4 GB used, 5.4 GB available, 1.5 GB of swap in use |
| Load average (1, 5, 15 min) | 12.2, 12.1, 12.9 on 6 vCPU |
| CPU | 97% user time, all of it from the database and app workloads |
| Claude Code binary on disk | about 365 MB and 380 MB (two installed versions kept side by side) |
| Disk | 47% of 315 GB used |
So the server told us how much room was left, but not what a session costs, because no session was running at that moment. With 5.4 GB available, the per-session budget below says that box can take about 6 more sessions before it leans on swap, even with its other services busy.
For per-session numbers we read the processes on a workstation that had sessions running: Windows 11, 16 logical processors, 16 GB of RAM. Nine claude processes were active sessions, between 27 and 135 minutes old.
| Per-session reading (9 sessions) | Low | Median | High |
|---|---|---|---|
Private memory of the claude process |
503 MB | 549 MB | 846 MB |
| Resident (working set) memory | 112 MB | 189 MB | 393 MB |
| CPU, average over the session's life | 0.8% of a core | 1.3% | 8.0% |
| CPU, 20-second sample | 0.2% of a core | 0.8% | 15.8% |
Private memory is the number to plan with: it is what the process has committed, and Windows trims the resident part aggressively. Together the nine sessions held 5.2 GB. The figures cover the claude process only. A test runner, a dev server or a language server that a session starts is its own process with its own memory.
This is one day on two machines. Treat it as a sample. Your numbers will move with project size, context length and the tools your sessions call. Measure your own with ps -eo rss,pcpu,etimes,comm | grep claude on Linux before you resize.
How to size the server
Three inputs decide the size.
Memory. Multiply your peak number of parallel sessions by 0.85 GB, add 1 GB for the system, then add the largest build or test run you expect at the same moment. Our sessions ranged from 0.5 to 0.85 GB, so 0.85 GB is the highest we saw. Anthropic's documented floor is "4 GB+ RAM, x64 or ARM64 processor" (setup docs, checked 2026-11-26).
CPU. The claude process itself barely registers: a median of 1.3% of one core. Count vCPUs by how many builds and test suites run at once. In our server snapshot, a database job alone held the 6 vCPU at a load of 12. Neighbors like that slow sessions down far more than the sessions slow each other.
Disk. Each installed Claude Code version was about 365 to 380 MB on our server, and the installer keeps more than one. Repositories, node_modules and Docker images take the rest. 80 GB is comfortable for a handful of projects.
Swap is cheap insurance. Our server had 1.5 GB of swap in use under load and kept running. Without swap, the kernel kills a process when memory runs out, and it may pick a session.
For a full monthly budget, server plus Claude plan, see what it costs to run Claude Code on a VPS around the clock. If you would rather rent a managed box, hosted Claude Code servers and their prices compares the options.
What a server fixes, and what it doesn't
Anthropic's Remote Control docs state the basic limit of any local setup: "your computer has to stay on and the claude process has to keep running" (Remote Control docs, checked 2026-11-26). A laptop sleeps, changes networks and runs out of battery. A server does none of those.
A server does not change what Claude Code costs. Model usage still draws on your plan or API key, and sessions that run while you sleep use your limits sooner. Read how the 5-hour windows and weekly caps work before you run ten sessions overnight, and when API billing beats a subscription if you are choosing how to pay.
Anthropic also runs sessions in its own cloud. That removes the server chore but adds other limits, compared in Claude Code on the web vs a VPS vs Codespaces.
Setup in seven steps
Step 1: rent the server
Pick the row from the sizing table. Ubuntu 20.04+, Debian 10+ and Alpine 3.19+ are the supported Linux systems in the setup docs.
Step 2: make a normal user and lock down SSH
The machine will hold your Claude login, git credentials and source code. Run sessions as a normal user without sudo.
sudo adduser agent
sudo mkdir -p /home/agent/.ssh
sudo cp ~/.ssh/authorized_keys /home/agent/.ssh/
sudo chown -R agent:agent /home/agent/.ssh
sudo chmod 700 /home/agent/.ssh && sudo chmod 600 /home/agent/.ssh/authorized_keys
In /etc/ssh/sshd_config set PasswordAuthentication no and PermitRootLogin no, then sudo systemctl restart ssh. Test a second login in a new terminal before you close the first. Then close everything you don't use:
sudo ufw default deny incoming
sudo ufw allow OpenSSH
sudo ufw enable
Step 3: install Claude Code
curl -fsSL https://claude.ai/install.sh | bash
claude --version
claude doctor
The setup docs say native installs "automatically update in the background", while apt, dnf and apk installs "do not auto-update through Claude Code". On a machine you rarely log into, that difference matters. claude doctor prints read-only diagnostics without starting a session.
Step 4: sign in the right way
Run claude and follow the login prompt. With no browser on the server, press c to copy the login URL, open it on your own computer, and paste the code back.
The trap is the long-lived token. The authentication docs (checked 2026-11-26) say claude setup-token generates "a one-year OAuth token" that "can only make model requests, so it can't establish Remote Control sessions". API keys don't work for Remote Control either: "API keys are not supported." For plain SSH use, either works. For Remote Control, sign in with /login.
Step 5: keep sessions alive with tmux
A session started in a plain SSH shell dies when the connection drops. Start each one inside a named tmux session:
tmux new -s api
cd ~/projects/api && claude
# detach: Ctrl-b then d. Later:
tmux attach -t api
One tmux session per project keeps a stuck one easy to find with tmux ls. If you run several sessions in one repository, give each its own worktree; the full method is in how to run 5 Claude Code sessions in parallel, and how often parallel sessions collide shows what happens when you don't.
Step 6: choose how you reach it
| Route | What you use on the phone | Inbound port needed | Source |
|---|---|---|---|
| SSH over a private network | An SSH app | None on the public internet | Tailscale SSH docs |
| Remote Control | claude.ai/code or the Claude app | None | Remote Control docs |
| A web UI on the server | A browser | Depends on the tool | Tool's own docs |
Tailscale SSH lets Tailscale "manage the authentication and authorization of SSH connections in your tailnet", turned on with tailscale set --ssh. Port 22 then never faces the internet.
For Remote Control, run claude remote-control in the project folder inside tmux. The docs say it "makes outbound HTTPS requests only and never opens inbound ports", needs the Anthropic API on port 443, and runs on "Pro, Max, Ultra, Team, and Enterprise plans". Two defaults matter on a server: --capacity allows 32 concurrent sessions, and --spawn defaults to same-dir, where sessions "can conflict if editing the same files". Use --spawn worktree instead. If the network drops for long, server mode "gives up after roughly 10 minutes" and the process exits; restart it with claude remote-control --continue.
Remote Control, Happy and other phone clients are compared in Remote Control vs Happy vs Code Tycoon and in six Remote Control alternatives.
Step 7: bring your setup along
A fresh server has none of your skills, CLAUDE.md files, hooks or MCP servers. Clone projects from git. Copy user-level files with rsync, for example rsync -av ~/.claude/skills/ agent@server:~/.claude/skills/. If you work across several machines for good, compare ways to keep Claude Code skills in sync between computers instead of copying by hand each time. Re-create MCP servers on the server with their own credentials. Don't rsync tokens you wouldn't paste into a ticket.
The 5 security settings that matter
On a laptop you watch, a leaked key is an accident you can see. On a server, sessions run for hours alone, and the machine holds your Claude login, a git credential, API keys in .env files and maybe cloud tokens. An instruction in CLAUDE.md such as "never read .env" is only guidance for the model. These five settings are boundaries. All quotes are from Anthropic's docs, checked 2026-11-26.
1. Deny reads of secret files
The permissions docs set the order: "Rules are evaluated in order: deny, then ask, then allow. The first match in that order determines the outcome". A deny rule beats any allow rule. To block the file tools, "add a Read deny rule for its path, such as Read(./.env) or Read(./secrets/**)". In ~/.claude/settings.json on the server:
{
"permissions": {
"deny": [
"Read(//**/.env)",
"Read(//**/.env.*)",
"Read(./secrets/**)",
"Read(~/.ssh/**)",
"Read(~/.aws/**)"
]
}
}
Anchoring decides what a rule covers. Read(.env) blocks "any .env at or under the current directory" but not one "in a parent directory or another project". Read(//**/.env) blocks "any .env anywhere on the filesystem". In user settings, Read(/secrets/**) means ~/.claude/secrets/**, not a folder in your project. Claude applies Read denies to Grep and Glob as "a best-effort attempt", so pair them with the sandbox.
Bash rules are weaker. The docs say a Bash rule "doesn't match the same program invoked in a different form". Denying cat .env stops that exact form and nothing more.
2. Turn on the sandbox
The sandbox docs describe "a boundary that the operating system enforces around the shell commands Claude runs on your machine". It is "off by default". Turn it on with /sandbox or in settings:
{
"sandbox": {
"enabled": true,
"filesystem": {
"denyRead": ["~/"],
"allowRead": ["."]
},
"network": {
"allowedDomains": ["github.com", "*.npmjs.org"]
}
}
}
Three facts decide how far it protects you. Writes are limited to "the working directory, a per-user temp directory, and directories you've added". Network traffic goes through a proxy that checks each host against "your allowed domains, which start empty". Reads are wide by default: "This default still allows reading credential files", which is why the example above denies the home folder and allows the project back.
Its limits: "The sandbox covers shell commands only. Claude's file tools, MCP servers, and hooks run outside it." It runs on macOS, Linux and WSL2, and "docker is incompatible with the sandbox", so exclude Docker commands with "excludedCommands": ["docker compose *"]. Deny rules cover the file tools; the sandbox covers commands. You need both.
3. Disable bypass mode
bypassPermissions mode skips permission prompts. On a shared server, one tired late-night start with --dangerously-skip-permissions undoes everything above. The settings reference gives the switch:
{
"permissions": {
"disableBypassPermissionsMode": "disable"
}
}
With it set, "Claude Code then rejects the --dangerously-skip-permissions flag". Put it in managed settings if several people use the box.
4. Pick the right credential and watch its end date
On Linux, Claude Code stores your login "in ~/.claude/.credentials.json with file mode 0600" (authentication docs). Mode 0600 means only that user can read it, which is one more reason to run sessions as their own user.
A setup-token token lasts one year and does model requests only. That makes it a good fit for scripts and a poor fit for Remote Control. A /login sign-in can expire: run claude auth status --text and look for the Sign-in ends line. The docs warn that "a Remote Control session that outlives the login disconnects until you sign in again", so renew before the earlier of the two dates it prints. For your other keys, use the smallest scope that works: a deploy key or fine-grained token for one repository, a cloud role with narrow permissions, a development API key with a spending cap.
5. No open inbound ports
Key-only SSH, PermitRootLogin no and a default-deny firewall (Step 2) close the most common way in. Reach the box over a private network such as Tailscale, so port 22 never faces the internet. Remote Control needs no inbound port at all, only outbound HTTPS on 443. A non-standard SSH port is not a substitute for any of this.
A 12-point server checklist
Run it once per server, then again whenever the server takes on new work.
- Sessions run as a non-root user with no sudo.
- SSH is key-only, root login is off, and the firewall denies incoming traffic by default.
- You reach the server over a private network or Remote Control, with no open port.
- Every credential on the box has an owner, a scope and a rotation date.
- Git uses a key or token limited to the repositories the sessions work on.
- Cloud and API keys are scoped, with spending limits where the provider offers them.
- Secrets live in
chmod 600files outside repositories, and.envis in every.gitignore. Readdeny rules cover.env,secrets/,~/.sshand~/.aws.- The sandbox is on, with an allowed-domains list that started empty.
- Bypass mode is disabled, and MCP servers are reviewed so tokens sit only where needed.
- Session transcripts are treated as sensitive files; a secret that shows up in one gets rotated.
- You can revoke each credential in under ten minutes.
Mistakes that cost people hours
- Sizing by the 4 GB floor for five sessions. Five sessions at up to 0.85 GB each is 4.25 GB before the system or a single build. Take 8 GB.
- Using
setup-tokenand expecting Remote Control. It can't establish those sessions. Use/login. - Running
claude remote-controlin a plain SSH shell. When SSH drops, the process ends. Start it inside tmux. - Letting parallel sessions share one directory. Use
--spawn worktreeor separate clones. - Trusting a line in
CLAUDE.mdto protect.env. Only deny rules and the sandbox enforce anything. - Running sessions as root. Then every secret on the machine is readable by every session.
- Forgetting the login end date. Check
claude auth status --textweekly.
If you'd rather not do steps 1 to 7 yourself, Code Tycoon sets up the server and copies your skills, CLAUDE.md files and MCP servers onto it, then lets you start, follow and answer sessions from a browser. See how your setup moves to a server. It isn't worth it if you run one session at your desk; Remote Control on your laptop covers that for free.
Frequently asked questions
How much RAM does one Claude Code session use?
In our measurement of nine working sessions on 2026-11-26, each claude process held 503 MB to 846 MB of private memory, with a median of 549 MB. Builds, tests and language servers that a session starts use memory on top of that.
What size server do I need for 5 parallel Claude Code sessions?
An 8 GB, 4 vCPU server. Five sessions at up to 0.85 GB each plus 1 GB for the system comes to about 5.3 GB, which leaves room for a build. On Akamai's Linode Shared CPU plans that class listed at $48 per month on 2026-11-26.
Does Claude Code need a lot of CPU on a server?
No. The claude process averaged a median of 1.3% of one core over each session's life in our measurement, because the model runs on Anthropic's servers. CPU goes to the builds and tests the sessions run.
Can I use an API key or setup-token on the server?
Yes for plain terminal use over SSH. Not for Remote Control: the docs say API keys are not supported and setup-token tokens can only make model requests, so neither can establish Remote Control sessions.
Does the Claude Code sandbox hide my credentials?
Not by default. The sandbox docs say default reads cover most of the machine and still allow reading credential files. Add denyRead in the sandbox settings and Read deny rules in permissions for the paths you care about.
Do I need to open any ports for Remote Control?
No. Remote Control makes outbound HTTPS requests on port 443 only and never opens inbound ports, according to Anthropic's docs. Keep SSH on a private network and the server needs no public inbound port.
Does a server make Claude Code cheaper?
No. The server runs the process; model usage still counts against your subscription or API key. A server lets work continue while your own computer is off, which uses your limits sooner.
The bottom line
Pick the server by memory: 0.85 GB per parallel session, 1 GB for the system, plus your biggest build. That puts 1 or 2 sessions on 4 GB, 3 to 5 on 8 GB and 6 to 10 on 16 GB, at $24, $48 and $96 a month on the plan list we checked. Then spend ten minutes on the five settings: deny rules, the sandbox, bypass mode off, the right login, and no open ports. Those do more for a server you don't watch than any amount of extra CPU.
Want the server without the setup? Get your server with your setup on it, or self-host the free version on a box you already run.
Related articles
- The cost of running Claude Code on a VPS 24/7: server plus plan, per month.
- How to run 5 Claude Code sessions in parallel: worktrees, merges and usage.
- Claude Code Remote Control vs Happy vs Code Tycoon: three ways to drive server sessions from a phone.
- Hosted Claude Code servers: what each option costs: when renting beats running your own.
About this research
Anton Goldshtein is a two-time founder who previously bootstrapped a company to $100M in revenue. His team runs its own products on Code Tycoon every day.
The measurements are read-only process and system snapshots taken on 2026-11-26 from two machines: our own 6 vCPU, 16 GB Ubuntu server, which had no session running at that moment, and a Windows 11 workstation with nine active Claude Code sessions. Nothing was started or changed to measure them. Commands, defaults and quotes come from Anthropic's Claude Code documentation on setup, authentication, Remote Control, permissions, the sandbox and settings, and prices from Akamai's pricing page, all read on 2026-11-26. We did not penetration-test any setup. Code Tycoon is independent of Anthropic.
Content reviewed and updated: 2026-11-26
Keep reading
Codex Cloud vs Jules vs Copilot Coding Agent (2026)
Codex cloud vs Jules vs GitHub Copilot's cloud agent: where tasks run, daily and plan limits, repo access, December 2026 prices, and when your own server wins.
Hosted Claude Code Servers: What Each Option Costs
What it costs per month to run Claude Code on a server you do not babysit: Claude Code on the web, a VPS, Codespaces and Code Tycoon, plus the model bill.
Code Tycoon Self-Hosted vs Hosted: What Each Plan Includes
Self-hosted Code Tycoon is free and has every view, alerts and the task manager. Solo, Team and Max add a dedicated server from $39 a month. Which to pick.