Skip to main content
Open a sandbox with stock OpenSSH: ssh, scp, sftp, port forwards and the Remote-SSH extension of VS Code and Cursor. You need a running sandbox (Quickstart) and an OpenSSH public key. You authorize an OpenSSH public key on a running sandbox, then connect to Styne’s SSH front door with the sandbox’s id as the user name. The front door checks the key against that sandbox only and passes the connection on to the sandbox’s own sshd, so terminals, file copy and forwards behave as on any Linux host.

Authorize a key

The answer names where to connect:
201 is a new key, 200 a key the sandbox already had. Adding a key also makes sure the sandbox’s sshd runs; it answers within a few seconds. The sandbox must be running or asleep after idling (it wakes for the setup and for each connection); one you paused answers 409, resume it first.
  • The user name is the sandbox’s id, not the account inside the sandbox. You land as the sandbox’s user account in /home/user.
  • Keys of type ssh-ed25519, ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521 and ssh-rsa with 2048 bits or more are accepted, one line, without authorized_keys options. A sandbox holds at most 16 keys.
  • A key opens only the sandbox it was added to. A key added on one sandbox never opens another, also in your account.
  • A template without an OpenSSH server answers 422. The base template includes one.
DELETE takes the key away from the front door at once, so no new connection opens with it. It answers 204, also for a key that was not there. It also ends the sandbox’s open SSH sessions; the keys that remain connect again at once. An SSH key belongs to the API key that added it. When that API key is revoked, for example because its member was removed from the organisation, the SSH keys it added are removed and the open SSH sessions of those sandboxes end, within 10 seconds. No new connection opens with them in the meantime.

Connect with ssh

The front door listens on port 2222 of ssh.styne.ai (port in the answer). It has one host key that stays the same across restarts, and its fingerprint is hostKeyFingerprint in the answer above. On the first connection compare it with the fingerprint ssh prints before you accept it. If the sandbox is paused or has ended, the front door prints that before it refuses the login. Resume the sandbox and connect again; a connection never resumes a sandbox by itself.

Copy files

For single files the files API needs no key; scp suits whole trees.

Port forwarding

A forward reaches a server inside the sandbox from your machine, or the other way round, over the same SSH connection. -L makes your localhost:8080 answer with the server on port 3000 inside the sandbox. -R makes the sandbox’s 127.0.0.1:9000 answer with the server on your machine’s port 9000, for as long as ssh runs:
A -R listener on the sandbox side binds to loopback unless you name another address and ask for it (-R 0.0.0.0:9000:...); neither makes the port public. To publish a port on an HTTPS address use ports.

VS Code and Cursor

Remote-SSH works against a sandbox. Put a block per sandbox in ~/.ssh/config:
Then run “Remote-SSH: Connect to Host…” and pick styne-sandbox. The editor installs its server in the sandbox, so the sandbox needs outbound network access and curl or wget. When the sandbox ends, the entry stops working: add the key to the next sandbox and change User.

Limits

  • A connection ends when the sandbox pauses or ends. The keys of an ended sandbox are gone.
  • An API restart forgets the keys of every sandbox: add them again. Nothing is opened to anyone in the meantime.
  • There is no password login; the only account is user.
A sandbox of another account is a 404, the same as one that does not exist.

Operations