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

# Set up SSH for training jobs

> Configure your machine once so you can connect to training jobs and workstations over SSH with the Baseten CLI or the Truss CLI.

Set up SSH once per machine. Setup generates an SSH keypair and adds a managed block to `~/.ssh/config` that routes `*.ssh.baseten.co` connections through the CLI. After that, you can [connect to a training job](https://docs.baseten.co/training/ssh.md) or a [workstation](https://docs.baseten.co/training/workstations.md) with any OpenSSH tool.

## Prerequisites

* SSH access enabled for your organization. [Contact us](mailto:support@baseten.co) to request it.
* A [Baseten account](https://app.baseten.co/).
* The [Baseten CLI](https://docs.baseten.co/reference/cli/baseten/overview.md#install), logged in with [`baseten auth login`](https://docs.baseten.co/reference/cli/baseten/auth). Commands that run Truss through the Baseten CLI, such as [`baseten train push`](https://docs.baseten.co/reference/cli/baseten/train), use these credentials.
* An OpenSSH client, included with macOS and Linux. On Windows, use the OpenSSH optional feature or the Windows Subsystem for Linux (WSL).
* To use the Truss CLI instead, [uv](https://docs.astral.sh/uv/) on your `PATH`.

## Set up your machine

> [tab] Baseten CLI
>
> **To set up SSH access**:
>
> ```sh Terminal theme={"system"}
> baseten ssh setup
> ```
>
> ```text Output theme={"system"}
> Generated SSH keypair: /Users/<you>/.ssh/baseten/id_ed25519
> SSH config updated.
> Connections use profile "<profile>" by default.
> Connect with:
>    deployment:    ssh model-<model-id>-<deployment-id>.ssh.baseten.co
>    environment:   ssh <environment>.model-<model-id>.ssh.baseten.co
>    training job:  ssh training-job-<job-id>-<node>.ssh.baseten.co
> ```
>
> Connections authenticate with the profile pinned at setup time. To pin a different profile, pass `--profile <name>`. When you authenticate with `BASETEN_API_KEY` instead of a stored profile, setup pins no profile and omits the `Connections use profile` line. Re-running setup prints `Reusing existing SSH keypair` instead of `Generated SSH keypair` and rewrites the managed config block.
>
> If you previously ran [`truss ssh setup`](https://docs.baseten.co/reference/cli/truss/ssh), remove its block (between `# --- baseten-ssh ---` and `# --- end baseten-ssh ---`) from `~/.ssh/config` first; setup refuses to touch a file that already configures `*.ssh.baseten.co` hosts outside its own managed block.

> [tab] Truss CLI
>
> **To set up SSH access**:
>
> ```sh Terminal theme={"system"}
> uvx truss ssh setup
> ```
>
> ```text Output theme={"system"}
> SSH keypair: /Users/<you>/.ssh/baseten/id_ed25519
> Proxy script: /Users/<you>/.ssh/baseten/proxy-command.py
> SSH config updated: ~/.ssh/config
> Default remote: <remote>
>
> SSH access configured. Connect to a running workload with:
>
>   Training job: ssh training-job-<job-id>-<node>.ssh.baseten.co
>   Inference model: ssh model-<model-id>-<deployment-id>.ssh.baseten.co
> ```
>
> Where `<remote>` is your default remote from `~/.trussrc` (typically `baseten`).

## How it works

When you connect to a `training-job-*.ssh.baseten.co` hostname, the managed `~/.ssh/config` block runs the CLI. The CLI calls the [training job SSH signing API](https://docs.baseten.co/reference/training-api/signs-an-ssh-certificate-for-a-training-job.md) to issue a short-lived certificate and relays the connection to the correct job. Certificates refresh automatically on every connection.

## Use multiple profiles

With the Baseten CLI, connections authenticate with the [profile](https://docs.baseten.co/reference/cli/baseten/auth.md) pinned at setup time. To pin a different profile, re-run setup with `--profile <name>`; to override for a single connection, set `BASETEN_PROFILE`:

```sh Terminal theme={"system"}
BASETEN_PROFILE=staging ssh training-job-abc1234-0.ssh.baseten.co
```

With the Truss CLI, include the remote name from `~/.trussrc` in the hostname instead: `training-job-abc1234-0.<remote>.ssh.baseten.co`.

## Troubleshoot setup

### "no SSH keypair found; run `baseten ssh setup` first"

Run [`baseten ssh setup`](https://docs.baseten.co/reference/cli/baseten/ssh) to configure your machine.

### "already configures \*.ssh.baseten.co hosts outside the managed block"

Another tool (typically `truss ssh setup`) has already added Baseten SSH entries to `~/.ssh/config`. Remove them and re-run `baseten ssh setup`. The Truss block sits between `# --- baseten-ssh ---` and `# --- end baseten-ssh ---`.

### `No api_key for remote` with the Truss CLI

The Truss SSH proxy reads an API key from `~/.trussrc` and can't read credentials stored in the OS keyring. To store an API key in `~/.trussrc`, log in again and choose **Paste an API key**:

```sh Terminal theme={"system"}
uvx truss login
```

### TLS errors with the Truss CLI

The Truss proxy script requires Python 3.10 or newer and uses the newest interpreter it finds on your machine. Prefer 3.12 or newer, which still receives security updates. If you see TLS errors, re-run setup with a newer interpreter:

```sh Terminal theme={"system"}
uvx truss ssh setup --python $(which python3.12)
```

### Certificate verification errors

If `ssh` fails with a `CERTIFICATE_VERIFY_FAILED` error, the Python interpreter the proxy
script runs under has no SSL root certificates, so it can't verify TLS connections to
Baseten. To fix it, either install certificates for that Python, or re-run setup pointing
at a Python that already has them:

```sh Terminal theme={"system"}
uvx truss ssh setup --python $(which python3.12)
```

This is most common on macOS with Python installed from [python.org](https://www.python.org),
which ships without certificates until you run its installer:

```sh Terminal theme={"system"}
# Substitute your Python version, e.g. 3.12
open "/Applications/Python 3.12/Install Certificates.command"
```

On other platforms, make sure your Python has a root certificate bundle (for example the
`ca-certificates` package on Debian/Ubuntu).

## Next steps

* [Connect to a training job over SSH](https://docs.baseten.co/training/ssh.md): Enable SSH on a job and open a shell in its container.
* [Create a workstation](https://docs.baseten.co/training/workstations.md): Start an SSH-ready GPU machine without writing a config.
