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

# ppio sandbox connect

> Attach an interactive remote shell to a running sandbox over a PTY, stream commands and their output, and exit without stopping the sandbox.

The `connect` command attaches an interactive terminal, a remote shell, to a running sandbox. It opens a real shell inside the sandbox over a PTY and streams keystrokes in and the shell output back. Run commands, inspect state and debug as if sitting at the sandbox's own terminal.

> [!NOTE]
>
> The sandbox must already be running. `connect` attaches to an existing sandbox by its ID and does not create one. Disconnecting leaves the sandbox and other sessions untouched.

> [!NOTE]
>
> Install the CLI and set the `PPIO_API_KEY` and `PPIO_DOMAIN` environment variables before running these commands. See [Install and authenticate](https://docs.ppio.ai/sandbox/cli/install.md).

## Usage

```bash theme={null}
ppio sandbox connect <sandbox-id>
```

The command also has short aliases, `sbx` for `sandbox` and `cn` for `connect`, so `ppio sbx cn <sandbox-id>` connects as well.

## Arguments

**\<sandbox-id>** `string` *required*

ID of the running sandbox to connect to.

## Options

**--secure** `boolean`

Secures sandbox controller traffic. `--no-secure` disables it.

**--public-traffic** `boolean`

Allows sandbox URLs without a traffic access token. Alias: `--allow-public-traffic`.

**--no-public-traffic** `boolean`

Requires a traffic access token for sandbox URLs and prints the token. Alias: `--no-allow-public-traffic`.

**-o, --output** `string`

Output format: `pretty`, `json` or `yaml`. Legacy aliases: `-f, --format` and `--json`.

**--timeout** `string`

Sandbox lifecycle timeout after connect.

**-d, --detach** `boolean`

Returns connection details without opening a terminal.

## Connect to a sandbox

On connect, the CLI prints the sandbox's dashboard inspect URL and a confirmation line, then hands the terminal over to the sandbox shell:

```text Output theme={null}
Terminal connecting to sandbox <sandbox-id>
user@sandbox:~$
```

## End the session

Exit the shell as usual, with `exit` or Ctrl+C. The CLI cleans up the terminal, closes the connection and prints:

```text Output theme={null}
Closing terminal connection to sandbox <sandbox-id>
```

> [!NOTE]
>
> Disconnecting only ends the terminal session. It does not stop or kill the sandbox, and it does not disconnect other users connected to the same sandbox.


## Related topics

- [Connect to a running sandbox](https://docs.ppio.ai/sandbox/connect.md)
- [Connect a sandbox to a VPN with OpenVPN](https://docs.ppio.ai/sandbox/openvpn.md)
- [List and filter sandboxes](https://docs.ppio.ai/sandbox/list.md)


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