Running Claude Code on a remote server over SSH: setup and trade-offs
A server is bigger than a laptop and does not sleep. Those are good reasons to run Claude Code there. This is the setup that works, and the trade-offs that come with it.
The RoamAI teamPublished September 9, 2026
Install and sign in
Claude Code needs Node.js 18 or newer. Install it globally as a normal user, not as root:
npm install -g @anthropic-ai/claude-codeThen sign in. On a headless server there is no browser, so start claude, run /login, and it prints a URL. Open that URL on your laptop, authorize with the account that has your Claude subscription, and paste the code it gives you back into the terminal. The login is stored per Unix user, so sign in as the user that will run the sessions.
Create a dedicated user for it. Claude Code refuses to start with permission checks disabled when it runs as root (it exits with status 1), and running it as root is a bad idea anyway.
Keep it alive
Start it inside tmux so that it survives your ssh session ending:
tmux new -s claude
cd ~/code/storefront
claudeDetach with Ctrl-b then d, and reattach later with tmux attach -t claude. From a laptop or phone, mosh instead of ssh keeps the connection through IP changes and short outages. Keeping Claude Code running after you close the laptop has the details.
Where the files live
Everything Claude reads and writes is on the server. That is the point of running it there, and it is also the cost: your editor, your git client, and the tools you review diffs with are on your laptop. You end up choosing one of three arrangements:
- Work on the server too. VS Code Remote-SSH, or a terminal editor, so that the server holds the only copy. Simplest, as long as the server is always reachable.
- Sync. git push from the server and pull on the laptop, or rsync in both directions. Two copies, and you keep track of which one is current.
- Mount. sshfs or similar, so the server's directory appears locally. Works until the connection drops. Then reads and writes hang or fail with I/O errors, and Claude's tool calls fail with them.
None of these is wrong. The thing to decide up front is which copy is the real one.
Permission prompts on a server
Claude Code still stops to ask before risky actions, and on a server there is nobody in front of the terminal to answer. The two blunt options are to auto-approve everything with --dangerously-skip-permissions (fine inside a throwaway container, dangerous on a machine with anything you care about), or to allow specific commands in settings so that only unusual ones ask. Permission prompts explained.
How big a server
One resident Claude Code process uses roughly 300 to 400 MB of RSS. A second one on the same machine adds about 120 MB, because the binary's pages are shared. A 1 GB VPS runs one session comfortably and two with swap. The measurements.
Where RoamAI fits
RoamAI keeps the session on a server, either a hosted one or one you connect with a single command, while the files stay on the computer running the app. You get a list of sessions sorted by which one is waiting for you, and a push notification when one stops. Connecting your own server.
Sessions that stay up, without the server work
RoamAI runs Claude Code on a hosted machine or on a server you connect, and tells you when a session needs you. Signing up is free. Workspaces are $9 / month.
Get started