Skip to navigation

Get SSH access to a sandbox

Returns what an SSH client needs to connect. The sandbox must have been created with ssh: true. Otherwise this returns 404 with code: ssh_not_enabled, which tells it apart from a sandbox that does not exist. The request has no body.

Meadow returns the vendor’s address and does not proxy SSH. Port forwarding (ssh -L) reaches any port in the sandbox.

The response is a credential: anyone holding it can log in until expires_at. Do not log it. Each call returns a new credential.

The vendors differ:

  • Daytona. The credential is the username, which is a token. private_key and host_key are null, so a client cannot pin the server. expires_at is the token’s expiry, about one hour ahead.
  • Modal. username is root, private_key is a new OpenSSH key and host_key is the server’s public key. port is not 22. expires_at is the sandbox’s own expires_at: the key works until the sandbox ends, and there is no revoke call. Meadow starts sshd in the sandbox. An image without sshd needs apt-get and network access to install it. Put openssh-server in the image when an allow list blocks the package mirror. Modal cannot serve SSH with network.block_all, and is skipped at create for that combination.

A client that pins host_key must offer only that key’s algorithm. OpenSSH does this from known_hosts.

Scope: sandboxes.

curl -sS -X POST "$MEADOW_BASE_URL/v1/sandboxes/$SANDBOX_ID/ssh" \
-H "Authorization: Bearer $MEADOW_API_KEY"

Authentication

AuthorizationBearer

A Meadow API key, sent as Authorization: Bearer mdw_.... The header x-api-key: mdw_... is accepted in its place.

Path parameters

sandbox_idstringRequired

The sandbox id returned by POST /v1/sandboxes. It must belong to the key’s project.

Response headers

x-request-idstringOptional

Meadow’s id for this request, req_ and 24 hex characters. Every response carries it, including errors, streams and unknown routes. Every error in the Error schema repeats it as request_id. Quote it when you report a problem.

Response

The address and credential.
hoststring
The SSH host name.
portinteger
The SSH port. Not always 22.
usernamestring
The login name. On Daytona this is a token and is the credential.
private_keystring or nullOptional

OpenSSH private key for this login. Null when the provider puts the credential in username instead.

host_keystring or nullOptional

The server’s public host key, for known_hosts. Null when the provider gives none.

expires_atdatetime or nullOptional
When the credential stops working.

Errors

401
Unauthorized Error
403
Forbidden Error
404
Not Found Error
409
Conflict Error
429
Too Many Requests Error
500
Internal Server Error
502
Bad Gateway Error