docs/sandboxes/ssh/overview.mdx
SSH gives a sandbox a familiar interface without putting an SSH daemon inside the guest. microsandbox speaks SSH on the host side, then forwards shells, remote commands, and SFTP file operations through the sandbox's command and filesystem channels.
Use it when you want existing SSH tools to work with a sandbox, or when you want SDK code to use SSH semantics while still going through microsandbox.
The main workflow is to serve a sandbox locally, then connect with standard OpenSSH tools.
msb ssh authorize --file ~/.ssh/id_ed25519.pub
msb ssh serve devbox
ssh -p 2222 [email protected]
sftp -P 2222 [email protected]
This is useful for terminal sessions, SFTP transfers, editor integrations, and any tool that already knows how to speak SSH. msb ssh serve binds to 127.0.0.1:2222 by default and requires keys to be authorized explicitly.
For clients that prefer a transport bridge instead of a TCP listener, serve over stdio:
Host devbox.msb
User root
ProxyCommand msb ssh serve devbox --stdio
For quick interactive access, use the built-in microsandbox SSH client. This does not require the host ssh binary, a TCP listener, or an authorized public key.
msb ssh devbox
msb ssh connect devbox
msb ssh devbox -- uname -a
Use this when you just want a shell or one remote command from the msb CLI.
The SDKs expose the same SSH capability from a running sandbox. You can run SSH-style commands, attach interactively, and open SFTP from code.
<CodeGroup> ```rust Rust let ssh = sandbox.ssh().connect().await?;let output = ssh.exec("uname -a").await?; let sftp = ssh.sftp().await?;
```typescript TypeScript
const ssh = await sandbox.ssh().connect();
const output = await ssh.exec("uname -a");
const sftp = await ssh.sftp();
ssh = await sandbox.ssh().connect()
output = await ssh.exec("uname -a")
sftp = await ssh.sftp()
ssh, err := sandbox.SSH().Connect(ctx)
if err != nil {
return err
}
output, err := ssh.Exec(ctx, "uname -a")
sftp, err := ssh.SFTP(ctx)
ProxyCommand.msb ssh, msb ssh connect, and SDK client sessions.