← Blog

How do you SSH into an AI agent's cloud computer?

Three ways to get a shell on an Orgo computer: Direct SSH with your key, orgo ssh from the CLI, and the bash API, and when to use each.

Updated

Turn on Direct SSH for a Linux computer, paste your public key, and connect with the command the SSH tab shows: ssh -p <port> root@<host>. That is a real SSH server, so OpenSSH, editors and any tool that asks for a host, port, user and key work with it. For a quick terminal with no key, orgo ssh <name> from the Orgo CLI opens a shell over a WebSocket instead. An agent loop that only needs to run a command and read the output can call POST /computers/{id}/bash.

Direct SSHorgo ssh <name>Bash API
What it isAn SSH server over TCPA terminal over a WebSocketOne command per request
CredentialYour public keyYour orgo loginAn API key
Works with OpenSSH and editorsYesNoNo
InteractiveYesYesNo
Suited toEditors, scripts, tools that speak SSHA quick look from your terminalAn agent that runs commands and reads output

Sources: Connect with SSH, CLI, Execute bash.

Direct SSH from the dashboard

  1. Open the computer's ⋯ menu and choose SSH, or open Settings and the SSH tab.
  2. Paste your public key, the contents of a .pub file such as ~/.ssh/id_ed25519.pub. Never paste the private key.
  3. Press Enable SSH.

The tab then shows the command:

bash
ssh -p <port> root@<host>

The host is the server your computer runs on, and the port is your computer's own. Port 22 on that address is the server, not your computer. If the tab says "Key saved. Restart to activate it.", restart the computer once from its ⋯ menu and reopen the tab.

To make a key:

bash
ssh-keygen -t ed25519
cat ~/.ssh/id_ed25519.pub

Direct SSH through the API

Everything in the tab works with an API key that has the Control permission: read to get the settings, write to turn SSH on or off. Three kinds of key are refused:

  • A key for one computer, or the computer's own ORGO_API_KEY: 403 with computer_scope or computer_key.
  • A key scoped to another workspace: 403 with workspace_scope_mismatch.
  • A restricted or expiring key on a computer that holds its own key: 403 with computer_key_held. Use a full access key that never expires, or sign in.

Add your public key. Calling it again replaces all the keys on the computer.

bash
curl -X POST https://www.orgo.ai/api/computers/$COMPUTER_ID/ssh \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"public_key\": \"$(cat ~/.ssh/id_ed25519.pub)\"}"

The answer has enabled, ssh_host_port, pending and requires_restart. On a running computer the key usually goes in at once. If requires_restart is true, restart the computer once (Turn on SSH).

Get the command:

bash
curl https://www.orgo.ai/api/computers/$COMPUTER_ID/ssh \
  -H "Authorization: Bearer $ORGO_API_KEY"
json
{
  "enabled": true,
  "authorized_key_set": true,
  "ipv4_host": "203.0.113.10",
  "ipv4_port": 20314,
  "ipv6_address": null,
  "ssh_user": "root",
  "ssh_command": "ssh -p 20314 root@203.0.113.10"
}

Check enabled before using the rest: after SSH is turned off, the port stays reserved, so the last port and command can still be returned. ipv6_address is always null; there is no IPv6 endpoint yet (Get SSH settings).

Turn it off when the job is done:

bash
curl -X DELETE https://www.orgo.ai/api/computers/$COMPUTER_ID/ssh \
  -H "Authorization: Bearer $ORGO_API_KEY"

This removes the saved keys and, on a running computer, deletes /root/.ssh/authorized_keys at once, including keys added there by hand. revoked_in_guest: false means the computer was not reachable at that moment (Turn off SSH).

Editors and other tools

Tools that ask for an SSH endpoint want the host and port from the tab (or ipv4_host and ipv4_port), the user root, and your private key. For OpenSSH, a ~/.ssh/config entry:

Plain text
Host agent-1
  HostName 203.0.113.10
  Port 20314
  User root
  IdentityFile ~/.ssh/id_ed25519

Then ssh agent-1 connects. In VS Code, install the Remote-SSH extension, add the entry above, and connect to agent-1 in the Remote Explorer.

orgo ssh

Install the CLI, sign in once, and open a shell by computer name (CLI):

bash
curl -fsSL https://orgo.ai/install.sh | bash
orgo login
orgo ssh agent-1

It starts in /root/Desktop; change that with --cwd. To leave, type ~. at the start of a line, press Ctrl+C twice within 800 ms, or use Ctrl+D or exit. A single Ctrl+C goes to the remote process.

The bash API

POST /computers/{id}/bash runs one command and returns combined stdout and stderr plus exit_code (Execute bash):

bash
curl -X POST https://www.orgo.ai/api/computers/$COMPUTER_ID/bash \
  -H "Authorization: Bearer $ORGO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"command": "ls -la /root/Desktop", "timeout": 60}'
  • success: true means only that the command ran. Read exit_code.
  • Without timeout a command gets 200 seconds; a value is clamped to 1 to 300. On Linux, a command killed by the timeout returns exit_code: -1 with truncated output.
  • On Windows the endpoint runs PowerShell. A timeout there returns exit_code: 124 and error: "timeout".

Who and which computers

  • Direct SSH is for Linux computers. Others return 400 SSH_UNSUPPORTED_OS.
  • The workspace owner and Full access members can turn it on, change keys and turn it off. Can chat members get 403 workspace_read_only, and share-link guests are refused too.
  • Accepted keys: ssh-ed25519, ssh-rsa, ecdsa-sha2-*, sk-ssh-ed25519@openssh.com and sk-ecdsa-sha2-*@openssh.com. Put one key per line to allow several, up to 16 KB in total. Saving replaces every key, so to add a teammate's key include yours too, and to remove one, save the others.
  • You log in as root.

Restarts and moves

  • A regular computer keeps its host and port across a restart. Sessions drop during the reboot.
  • A dedicated GPU computer gets a new port on every restart. The restart answers 202 with an operation, whose result has the new host, port and command; GET /computers/{id}/ssh returns it too.
  • After a stop and start, or a move to another server, host and port can both change. Read them again; do not cache them.
  • A suspended computer takes no connections until it wakes. One moved to storage has no address: GET /computers/{id}/ssh returns 409 computer_asleep. You can still save keys or turn SSH off while it sleeps.

Troubleshooting

SymptomLikely causeFix
Permission denied (publickey)The key is not on the computer yet, or you used another private keyPaste the public key again, restart once if asked, and connect with ssh -i ~/.ssh/<key> -p <port> root@<host>
Connection refused or a timeoutWrong port, or the computer is not runningUse the port from the SSH tab, never 22, and start or wake the computer
Connection refused on the right port, computer runningNo SSH server is listening inside itRun pgrep -a sshd through orgo ssh or the bash API. No output means none is running; contact support
It worked yesterdayThe computer moved, so host and port changedRead the SSH settings again

The API's other refusals: 400 with no code for a missing, empty, oversized or invalid public_key; 402 when the computer's access has ended; 403 GUEST_RESTRICTED for a share-link guest; 403 key_permission for a key without Control. When contacting support, the docs ask for the output of ssh -v -p <port> root@<host>.