Connect Claude Desktop to a sandbox
Claude Desktop can run Claude Code on a remote machine over SSH. Point it at a sandbox so the agent works inside the isolated environment instead of on your host.
NoteThis page covers Claude Desktop connecting to a sandbox over SSH. To run the Claude Code CLI inside a sandbox directly, see Claude Code.
Prerequisites
- SSH access set up. See Editor and app integrations.
- Claude Desktop installed.
Use a sandbox created with the Claude agent type. The Claude sandbox template configures Anthropic credentials and network access for the remote Claude Code session.
Connect
WarningConnecting Claude Desktop to a sandbox over SSH transmits Anthropic credentials into the Claude Code process within the sandbox, reducing isolation guarantees.
Create a named Claude sandbox for the current directory if you don't already have one:
$ sbx create --name demo claude .
Confirm that you can connect to the sandbox from a terminal:
$ ssh demo.sbx
In Claude Desktop, open the environment drop-down before starting a session and
select + Add SSH connection. Enter a name for the connection and enter the
sandbox hostname, such as demo.sbx, in SSH Host. Leave SSH Port and
Identity File empty because the managed SSH config supplies them.
Select the connection from the environment drop-down, then use the remote
folder picker to
select the mounted workspace. The
picker might initially open at /home/agent.
For more connection options, see the Claude Desktop instructions for SSH sessions.
Troubleshoot a broken SSH connection after token refresh
The SSH connection drops when the Anthropic token expires and needs to be refreshed. To work around this, run the sandbox manually from your host:
$ sbx run --name <sandbox-name>
Troubleshoot SSH connection timeouts on Windows
Claude Desktop requires Git on Windows. If an SSH connection times out and the
Claude Desktop logs include ProxyCommand error: spawn sh ENOENT, install
Git for Windows.
If Git is already installed, verify that sh.exe is available on your PATH:
PS> where.exe shIf the command doesn't find sh.exe, add the Git bin directory to your user
Path. The default directory is C:\Program Files\Git\bin. Quit and restart
Claude Desktop after updating Path.
Related
- Editor and app integrations — how SSH access works and how to set it up
- Claude Code — run the Claude Code CLI inside a sandbox