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

# SSH and connect

> Open a shell on a rig over SSH, or open it in your editor.

Once a rig is running, you have a few ways to get inside it:

* **`rig ssh`**: interactive shells, one-off commands, and port forwarding.
* **`rig connect`** (CLI-only): a plain interactive shell over the same
  transport.
* **`scp`** (CLI-only): copy files to and from a rig.
* **`rig open`** (CLI-only): opens the rig in an editor or app, such as
  Cursor, VS Code, or Codex, over SSH.

## Prerequisites

> [!NOTE]
>
> * A rig in the `active` / `running` / `started` state. See
>   [Create a rig](https://docs.amika.dev/guides/create-a-rig.md).
> * An SSH key. Create one with `amika secret ssh-keygen`, or upload an existing
>   public key with `amika secret ssh-keygen --import ~/.ssh/id_ed25519.pub`.

## Open an interactive SSH session

```bash theme={null}
amika rig ssh dev-box
```

The TypeScript SDK has no SSH methods. Use the CLI to open a shell.

## Run a one-off command

`amika rig ssh` works like `ssh`: options go before the rig name, and the
command goes after it. Use `-t` to allocate a TTY when the remote command
needs one.

```bash theme={null}
# Non-interactive command
amika rig ssh dev-box ls -la

# Interactive program (force TTY)
amika rig ssh -t dev-box top
```

## Forward a port

Every `ssh` option works, including port forwarding. Forward a local port to a
port in the rig with `-L`, and add `-N` to skip the remote shell:

```bash theme={null}
# Reach the rig's port 3000 at http://localhost:3000
amika rig ssh -N -L 3000:localhost:3000 dev-box

# SOCKS proxy on local port 1080
amika rig ssh -N -D 1080 dev-box
```

Local (`-L`) and dynamic (`-D`) forwarding are supported. Remote (`-R`) and
X11 forwarding are not. Agent forwarding is on by default and uses a dedicated
agent that holds only your Amika SSH key, so your other keys never reach the
rig.

## Copy files

Use `amika scp` to copy files between your machine and a rig. It uses the same
SSH identity as `amika rig ssh` and accepts standard `scp` options such as
`-r`, `-p`, and `-C`.

```bash theme={null}
# Upload a file into the rig user's home directory
amika scp ./local.txt dev-box:local.txt

# Download a directory
amika scp -r dev-box:/srv/output ./output
```

A relative rig path starts under `/home/amika`. Use an absolute path when the
file lives elsewhere in the rig. To see the `scp` command Amika would run
without running it, add `--print`:

```bash theme={null}
amika scp --print ./local.txt dev-box:local.txt
```

See [`amika scp`](https://docs.amika.dev/reference/cli#amika-scp) for copying between rigs and other
SSH hosts.

## Open a plain shell (CLI only)

`amika rig connect` opens an interactive shell in the rig over the same
transport as `rig ssh`. Use it when you don't need SSH options or a remote
command.

```bash theme={null}
amika rig connect dev-box
```

## Open in an editor (CLI only)

`amika rig open` opens the rig in Cursor, VS Code, Claude Desktop, Codex,
Paseo, or Herdr over SSH. See [Open a rig in your editor](https://docs.amika.dev/guides/open-in-editor.md)
for the full command and instructions for other Remote-SSH editors.

```bash theme={null}
amika rig open dev-box
amika rig open dev-box --app vscode
```

On CLI v0.23.0 and earlier, the command is `amika rig code` and the flag is
`--editor`.

## Next steps

> [card] [Programmatic walkthrough](https://docs.amika.dev/guides/programmatic-usage.md)

> [card] [Rig lifecycle](https://docs.amika.dev/guides/rig-lifecycle.md)

> [card] [CLI reference](https://docs.amika.dev/reference/cli.md)


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