Skip to main content
By using SSH, you can securely connect to a remote command-line environment, transfer files through protocols such as SCP or SFTP, and work with software that relies on SSH-based connections.

Quickstart

1

Build the SSH template

Define a template that includes an OpenSSH server for SSH access and websocat for forwarding WebSocket-based connections:
// template.ts
import { Template, waitForPort } from 'novita-sandbox/code-interpreter'

export const template = Template()
  .fromUbuntuImage('25.04')
  .aptInstall(['openssh-server'])
  .runCmd([
    'curl -fsSL -o /usr/local/bin/websocat https://github.com/vi/websocat/releases/latest/download/websocat.x86_64-unknown-linux-musl',
    'chmod a+x /usr/local/bin/websocat',
  ], { user: 'root' })
  .setStartCmd('sudo websocat -b --exit-on-eof ws-l:0.0.0.0:8081 tcp:127.0.0.1:22', waitForPort(8081))
Now build it:
// build.ts
import { Template, defaultBuildLogger } from 'novita-sandbox/code-interpreter'
import { template as sshTemplate } from './template'

await Template.build(sshTemplate, 'ssh-ready', {
  cpuCount: 2,
  memoryMB: 2048,
  onBuildLogs: defaultBuildLogger(),
})
2

Launch a sandbox from that template

import { Sandbox } from 'novita-sandbox/code-interpreter'

const sbx = await Sandbox.create('ssh-ready')
console.log(sbx.sandboxId)
3

Connect from your local machine

# Install websocat
brew install websocat

# Connect to your sandbox
ssh -o 'ProxyCommand=websocat --binary -B 65536 - wss://8081-%h.sandbox.novita.ai' user@<sandbox-id>

How it works

Websocat acts as the proxy, and SSH connections are forwarded over WebSocket through the sandbox’s exposed ports.
┌───────────────────────────────────────────────────────────┐
│  Your Machine                                             │
│  ┌──────────┐    ProxyCommand    ┌──────────────────┐     │
│  │   SSH    │ ────────────────── │    websocat      │     │
│  │  Client  │                    │   (WebSocket)    │     │
│  └──────────┘                    └─────────┬────────┘     │
└────────────────────────────────────────────┼──────────────┘

                         wss://8081-<sandbox-id>.sandbox.novita.ai

┌────────────────────────────────────────────┼──────────────┐
│  Novita Sandbox                            ▼              │
│                                  ┌──────────────────┐     │
│                                  │    websocat      │     │
│                                  │  (WS → TCP:22)   │     │
│                                  └─────────┬────────┘     │
│                                            │              │
│                                  ┌─────────▼────────┐     │
│                                  │   SSH Server     │     │
│                                  │   (OpenSSH)      │     │
│                                  └──────────────────┘     │
└───────────────────────────────────────────────────────────┘
Last modified on June 8, 2026