Keep a Claude Code session running on a remote box and steer it from your phone
Run Claude Code inside tmux on a server, use mosh for flaky links, connect Remote Control so you can steer and approve from your phone, and keep your SSH keys out of the agent's reach.

Tools used
- Claude CodeRuns on the server; Remote Control lets you steer it from elsewhere
- tmuxKeeps the session alive when SSH disconnects
- moshKeeps the terminal connection alive on bad networks
- Claude appSteer the session and answer approvals from your phone
Step navigator
A Claude Code session on a server that survives dropped connections, which you can steer and approve from your phone.
Developers with a Pro, Max, Team or Enterprise Claude plan and a server or always-on machine they can SSH into.
Before you start
Developers on Hacker News (October 2026) described how they keep coding agents working after the laptop lid closes. Claude Code's own docs fill in the Remote Control details. Some details nobody shared, such as one developer's systemd unit, are flagged as gaps rather than invented.
Step-by-step instructions
Start Claude Code inside a named tmux session on the server
Claude Code's docs say: "If you run claude from a terminal on a remote machine, start it inside tmux or screen to keep the session running after you disconnect from SSH." One command attaches or creates the session, so you can rerun it after every drop: ssh devbox -t tmux new-session -A -s agents.
ssh devbox -t tmux new-session -A -s agents

Why this works
The tmux server owns the terminal, so the agent keeps working when your connection or laptop goes away.
Use mosh if your connection keeps dropping
One developer's daily setup: "ghosty + ssh + mosh + tmux + claude code (sometimes codex)." He is honest about what still hurts: copy-paste works about 95% of the time, and pasting or dragging images and videos into the remote session does not work well. The tmux guide's advice: pair tmux with mosh "if your link is bad enough that SSH itself keeps dying."
Turn on Remote Control for the session
In the project directory on the server, run claude remote-control (server mode, which shows a URL and, on spacebar, a QR code). Or inside a running session, type /remote-control to carry the current conversation over. Then open the session at claude.ai/code or in the Claude app under Code. Requirements from the docs: a Pro, Max, Team or Enterprise plan with claude.ai sign-in; "API keys are not supported"; it does not work through Bedrock, Agent Platform, Foundry or a non-Anthropic ANTHROPIC_BASE_URL. On Team and Enterprise an Owner must enable it first.
claude remote-control --name "My Project"
Why this works
Execution and files stay on the server; only the conversation is relayed to your phone.
Set it up once per project on the server
A developer who drives Claude Code on servers from Desktop, mobile and web: "The massive upside is that the actual work happens on the server so you can close your laptop and it will continue." The cost: "every new project requires a setup step on the server (to add the systemd service) where you will develop it since Claude can only handle one server per directory." He did not share the unit file, so this guide does not either.
Get pinged on your phone, and isolate parallel sessions
With Remote Control active, run /config and enable "Push when actions required" for permission prompts and questions, "Push when Claude decides" for finished tasks, or both. If you will open several sessions from your phone, start the server with --spawn worktree so "each on-demand session gets its own git worktree." If you stop the server, claude remote-control --continue brings the session back for about four hours.
claude remote-control --spawn worktree
Keep your SSH keys out of the agent's reach
One developer hands tmux sessions to Claude but keeps logins in his own hands: "Paranoid me uses the macbooks secure enclave with fingerprint for the ssh key so claude can't ssh into my remote boxes by himself. I then open named tmux sessions, perform the ssh login via fingerprint, and then tell claude that he is free to take over that session with a given name."
Why this works
The agent can work in a session you opened without being able to open new ones on its own.
End of guide · Reviewed Oct 27, 2026
Pro tips2
- Name tmux sessions after the project so tmux ls reads like an inventory.
- Remote Control needs claude.ai sign-in; it does not work with API keys, Bedrock, or a custom ANTHROPIC_BASE_URL.
Common mistakes2
- Starting claude directly in an SSH shell; when SSH drops, the session goes offline.
- Expecting a Remote Control session to survive a reboot or a stopped claude process; the docs say the process must keep running.


