scp or sftp.
SSH is terminal-first and works with any OpenSSH-compatible tool. To attach an IDE instead, see Connect with remote tunnels.
Prerequisites
- Training Jobs enabled for your organization. See Request access.
- SSH set up on your machine. See Set up SSH.
- uv on your
PATH. The Baseten CLI runs Truss through uv to push jobs and create workstations.
Enable SSH on a training job
To enable SSH access on a training job, setsession_provider to SSH in your config.py:
config.py
trigger=ON_STARTUP so the session is available as soon as the job starts running. The default is ON_DEMAND, which activates the session on your first SSH connection; see Trigger modes for all options.
Training jobs support H200 and H100 GPUs. For all InteractiveSession fields, see the SDK reference. For supported compute, see Compute resources.
Push an SSH-enabled training job
This walkthrough pushes the MNIST PyTorch example with SSH enabled, then connects to its container from your terminal. To push an SSH-enabled job and connect:-
Clone the cookbook and change into the MNIST training example:
Terminal
-
Edit
config.pyto add aninteractive_sessionwithsession_provider=SSH, as shown in Enable SSH on a training job. -
Push the job:
Copy
<job_id>from the output. The Baseten CLI runs Truss to push the job, so the hints name Truss commands. Use the Baseten CLI commands on this page instead. -
Check that the job is running. Its
Status:line readsrunning: -
Connect to node 0:
You’re connected when you see a shell prompt likeTerminal
root@baseten-training-job-<job_id>-multinode-0:~#. Baseten extracts your source files to/b10/workspace(available as$BT_WORKING_DIR). If you setenable_baseten_workdir=False, Baseten uses your base image’sWORKDIRinstead. -
When you finish, stop the job so it stops billing, and confirm when prompted:
Hostname format
Training hostnames name a job and a node:Hostname
Examples:
Terminal
Multi-node jobs
For multi-node training jobs, specify the node index in the hostname. Node 0 is the leader:Terminal
File transfer
Usescp or sftp with the same hostname to transfer files. Each command returns to your prompt when the transfer finishes:
Terminal
Open the container in VS Code or Cursor
Because setup configures standard OpenSSH, tools that speak SSH can connect with the same hostname:- VS Code: Install the Remote - SSH extension, then connect to
training-job-<job_id>-<node>.ssh.baseten.co. - Cursor: Use the built-in SSH remote feature with
training-job-<job_id>-<node>.ssh.baseten.co.
Session expiry
An SSH session’s expiry doesn’t change after the session starts, and reconnecting doesn’t extend it. See Session expiry to choose the length before you push the job and to see which files survive the session.Troubleshoot connections
”Invalid job id: must be a valid hash id”
Check that the job ID in the hostname is correct. Find your job ID withbaseten train job list or in the Baseten dashboard.
Training job not found or unreachable
SSH requires a running training job. For a stopped or finished job,ssh prints training job "<job_id>" not found and then fails to resolve the hostname. Check that the job’s Status: line reads running:
session_provider=InteractiveSessionProvider.SSH, as shown in Enable SSH on a training job.
Next steps
- Manage sessions: Check session status and change the trigger.
- Clone a private repository: Pull private code into the container with SSH agent forwarding.
- Create a workstation: Start an SSH-ready GPU machine without writing a config.