> ## Documentation Index
> Fetch the complete documentation index at: https://namespace.so/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# SSH

> Step inside a Devbox to check your agent's work or debug by hand.

SSH gives you an interactive shell. For scripts and automation, use [`devbox exec`](https://namespace.so/docs/devbox/exec), which returns output and an exit code.

> [!TIP]
>
> With the [Devbox skill](https://namespace.so/docs/reference/devbox-cli/agent-skills.md), ask your agent in plain language, for example: *"set up SSH config for my devbox"*

## Open a shell

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox ssh my-devbox
```

```typescript TS SDK theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
const terminal = await devbox.terminal.open();

process.stdin.setRawMode?.(true);
terminal.onData((data) => process.stdout.write(data));
process.stdin.on("data", (data) => terminal.write(data));

await terminal.wait();
process.exit();
```

On Windows, the shell is PowerShell. Connecting to a stopped Devbox starts it first. The CLI tunnels the connection through Namespace over HTTPS, so the Devbox needs no public IP address or open port. The shell ends when you exit or your connection drops, along with anything running in the foreground. For work that should keep running, use a [session](https://namespace.so/docs/devbox/sessions.md).

To open a shell from a browser with nothing to install, select the **Terminal** tab on the Devbox in the [Dashboard](https://cloud.namespace.so/workspace/devboxes).

![The Terminal tab of a Devbox in the Namespace dashboard, showing a shell prompt in the workspace directory](https://mintcdn.com/namespace-labs/-K0c8nJ0VGW2RPWe/images/devboxes/connect/devbox-dashboard-terminal.webp?fit=max\&auto=format\&n=-K0c8nJ0VGW2RPWe\&q=85\&s=3b9689ef82c807f8059bb54e69293842)

### Use your local SSH keys

Forward your SSH agent to use your own keys on the Devbox, for example to push to a Git remote.

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox ssh -A my-devbox
```

See [`devbox ssh`](https://namespace.so/docs/reference/devbox-cli/ssh) for every option.

## Connect SSH tools

`devbox configure-ssh` adds the Devbox to your local SSH configuration and prints the hostname to use:

```bash CLI theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
devbox configure-ssh my-devbox
```

Use that hostname with `ssh` or with an [IDE](https://namespace.so/docs/devbox/ides.md) that connects over SSH.

## SSH or a session

| | `devbox ssh` | [Session](https://namespace.so/docs/devbox/sessions.md) |
| - | - | - |
| Keeps running after you disconnect | No | Yes |
| Reconnect to the same shell later | No | Yes |
| Works with `ssh`, `scp`, `rsync`, and IDEs | Yes, with `devbox configure-ssh` | No |
| Keeps the Devbox [awake](https://namespace.so/docs/devbox/lifecycle.md#idle-timeout) | While the connection is open | For 15 minutes after the session is created |

Use SSH to look around, run a quick command, or connect a tool that needs SSH. Use a session for anything you want to come back to, such as a dev server, a long build, or a coding agent.

## Related

* [Sessions](https://namespace.so/docs/devbox/sessions.md) for a terminal that keeps running after you disconnect.
* [Open IDE](https://namespace.so/docs/devbox/ides.md) to open a Devbox in VS Code, Cursor, JetBrains, or Zed.
* Reference: [`devbox ssh`](https://namespace.so/docs/reference/devbox-cli/ssh), [`devbox configure-ssh`](https://namespace.so/docs/reference/devbox-cli/configure-ssh).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.