---
name: bast
description: >-
  Use Bast CLI for SSH host and key management on macOS, Linux, and Windows 11. Load when the
  user mentions bast, Bast.sh, SSH host picker, ~/.ssh/bast, ssh config
  management, or wants to automate SSH workflows with JSON output.
---

# Bast

Bast is a terminal UI and CLI for browsing SSH hosts, managing keys, and connecting fast. It reads your existing OpenSSH config. It does not replace `ssh` or use a custom protocol.

Docs: https://bast.sh/llms.txt

## When to use Bast

- User wants to browse, search, or organize SSH hosts from the terminal
- User needs to generate, import, export, or install SSH keys
- User wants quick connect: `bast <label>` or `bast "Production web"`
- User wants to import cloud VMs (`bast sync gcp`, `bast sync aws`, `bast sync azure`, `bast sync boat`, `bast sync upstash`, `bast sync hetzner`, `bast sync bitqate`, `bast sync railway`, `bast sync fly`, `bast sync digitalocean`, or `bast sync boxd`) and connect with local keys, or Vercel Sandboxes (`bast sync vercel`) over a WebSocket PTY
- User already has the Boat CLI installed and logged in (Bast auto-connects Boat)
- User has an Upstash Box API key (Bast stores it locally and uses it for API + SSH)
- User has a Vercel access token, team ID, and project ID (Bast stores the token locally and opens a PTY shell)
- User SSHs from a phone or narrow terminal: the TUI switches to a stacked mobile layout below 60 columns (tap Connect)
- Automation/scripts need host or key management with stable JSON output
- SSH hosts are missing, auth fails, or Bast looks empty: `bast doctor --json`

## When not to use Bast

- PuTTY sessions or `.ppk` keys without OpenSSH conversion
- One-off `ssh user@host` when the host string is already known
- CI provisioning where Terraform/Ansible/IaC owns SSH config
- Non-interactive environments needing TUI (use `bast hosts` / `bast keys` CLI instead)

## Install

Choose one installation method.

Installer:

```sh
curl -fsSL https://bast.sh/install | sh
curl -fsSL https://bast.sh/install | BAST_VERSION=v0.9.1 sh
```

Homebrew:

```sh
brew install ellipse-software/tap/bast
```

Linux packages:

```sh
curl -fsSL https://packages.bast.sh/setup.sh | sudo sh
```

Windows 11 PowerShell:

```powershell
irm https://bast.sh/install.ps1 | iex
```

## Update

`bast update` only updates script installs (https://bast.sh/install, https://bast.sh/install-nightly, and the Windows PowerShell installers). It refuses package-manager copies and prints the command for that install.

| Install | Command |
| --- | --- |
| Script, nightly script, Windows PowerShell | `bast update` |
| Homebrew | `brew upgrade bast` |
| Homebrew nightly | `brew upgrade bast-nightly` |
| apt | `sudo apt upgrade bast` |
| dnf | `sudo dnf upgrade bast` |
| yum | `sudo yum update bast` |
| zypper | `sudo zypper update bast` |
| pacman | `sudo pacman -Syu bast` |
| AUR (`bast-bin`) | `yay -Syu bast-bin`, or `paru -Syu bast-bin`, otherwise `sudo pacman -Syu bast-bin` |
| apk | `sudo apk upgrade bast` |
| WinGet | `winget upgrade --id EllipseSoftware.Bast --exact` |

Stable builds check for a newer stable release. Nightly builds check the nightly channel. The idle status line shows `Update <version> · <command>`. Press `v` for the same suggestion. A source build shows `https://bast.sh`.

## Shell completions

The script installers and Homebrew enable tab completion. Open a new terminal after install. Opt out with `BAST_NO_COMPLETIONS=1`.

```sh
source <(bast completion bash)   # zsh: source <(bast completion zsh)
bast completion fish | source
```

PowerShell, Elvish, and Nushell: https://bast.sh/docs/reference/completions

## Automation rules

Always use `--json` for scripts. It disables prompts. Pair with explicit flags and `--yes` for destructive actions.

```sh
bast hosts list --json
bast hosts add "Prod web" --hostname prod.example.com --user deploy --json
bast keys generate automation --no-passphrase --json
bast keys delete old_key --yes --json
```

Success: `{"ok":true,"data":...}` on stdout. Errors: `{"ok":false,"error":{...}}` on stderr with non-zero exit.

Use `--no-input` to never prompt (all required fields must be passed as flags).

When SSH hosts are missing, auth fails, or Bast looks empty, run `bast doctor --json`. Do not scrape the text output. `ok: true` means the command ran; `data.healthy` and `data.findings[].id` are the diagnosis. `--fix` only prepends the Bast Include and tightens modes OpenSSH will refuse. `--probe` is DNS/TCP only (no SSH handshake).

```sh
bast doctor [--fix] [--probe] [--category name] [--json]
```

## Host commands

```sh
bast hosts list [--search text] [--sort smart|label|recent|group] [--all] [--json]
bast hosts show <host> [--json]
bast hosts add [label] --hostname host [--user u] [--password | --password-only] [--group g] [--tag t] [--icon emoji] [--color name|hex] [--json]
bast hosts edit <host> [patch flags] [--password] [--clear-password] [--json]
bast hosts delete <host> [--yes] [--json]
bast hosts favorite <host> [--json]
bast hosts hide <host> [--json]
bast hosts known-host remove <host> [--yes] [--json]
```

Host edits are **patches**: omitted flags leave values unchanged. Use `--clear-group`, `--clear-icon`, `--clear-color`, `--clear-notes`, `--clear-identity`, etc. to remove values. Colour names are `red`, `green`, `yellow`, `blue`, `magenta`, `cyan`, `white`, and `gray`. Hex is also accepted. `--icon` is one emoji or flag.

Labels with spaces work: `bast "Production web"`. Aliases are normalized (e.g. `Production_web`).

## Remote Desktop and web entries

Entries are not SSH hosts and are not written to `~/.ssh/config`. `a` still adds an SSH host. In the TUI, `A` adds a Remote Desktop entry or a web page. Enter opens it. `Ctrl+O` on an SSH host still opens that host's address when Open RDP is on.

```sh
bast rdp list [--search text] [--all] [--json]
bast rdp add [label] --address host [--port n] [--via alias] [--user name] [--domain name] [--fullscreen] [--admin] [--json]
bast rdp edit <label> [patch flags] [--json]
bast rdp delete <label> [--yes] [--json]
bast rdp open <label>
bast rdp close <label>
bast web list [--search text] [--all] [--json]
bast web add [label] --url https://host/ [--via alias] [--json]
bast web edit <label> [patch flags] [--json]
bast web delete <label> [--yes] [--json]
bast web open <label>
bast web close <label>
```

`--via` is the alias of an existing SSH host. Bast starts `ssh -N -L` for Remote Desktop and `ssh -N -D` for a page. The page opens in a separate Chrome, Edge, Brave, Chromium, or Firefox profile. Bast does not store an RDP password. A URL with a username or password is rejected. `bast <label>` opens an entry only when no SSH host has that name.

## Key commands

```sh
bast keys list [--search text] [--json]
bast keys show <name> [--json]
bast keys generate [name] [--algorithm ed25519|rsa] [--no-passphrase] [--json]
bast keys import [name] --private path|- [--public path|-] [--json]
bast keys install <name> --host <host> [--json]
bast keys export <name> --directory path [--yes] [--json]
bast keys delete <name> [--yes] [--json]
```

Import from stdin without shell history: `bast keys import work --private - < id_ed25519`

## Cloud sync

```sh
bast sync gcp
bast sync aws
bast sync azure
bast sync boat
bast sync upstash
bast sync vercel
bast sync hetzner
bast sync bitqate
bast sync railway
bast sync fly
bast sync digitalocean
bast sync boxd
bast sync status
bast sync disable gcp
bast sync disable boat
bast sync disable upstash
bast sync disable vercel
bast sync disable hetzner
bast sync disable bitqate
bast sync disable railway
bast sync disable fly
bast sync disable digitalocean
bast sync disable boxd
```

GCP, AWS, Azure, and Boat require the matching CLI on `PATH` (`gcloud`, `aws`, `az`, or `boat`) and an authenticated account. Upstash Box uses a stored API key (`bast upstash key` or `UPSTASH_BOX_API_KEY`), not a CLI. Vercel Sandbox uses a stored access token (`bast vercel token` or `VERCEL_TOKEN`) plus team and project IDs. Hetzner Cloud uses stored API tokens (`bast hetzner key` or `HCLOUD_TOKEN`) and does not require the `hcloud` CLI. BitQate uses a stored API token (`bast bitqate key` or `BITQATE_TOKEN`) minted in the BitQate dashboard under Settings → API with the `vms:read` scope (`vms:read` and `vms:power` for start/stop/restart). Railway uses an account or workspace token (`bast railway key` or `RAILWAY_API_TOKEN`); project tokens are rejected. Fly.io uses a logged-in `flyctl` and does not store an API token. DigitalOcean uses `doctl` auth contexts and does not store an API token (`bast do` is an alias). boxd uses a signed-in `boxd` CLI and does not store a token. Synced hosts are read-only; disconnect via Sync to remove them.

If the Boat CLI is already installed and logged in, Bast auto-connects on TUI start and `bast sync status` (unless you previously ran `bast sync disable boat`). The same auto-connect applies to Upstash when a key file is present (unless `bast sync disable upstash`), and to Vercel when a token, team, and project are stored (unless `bast sync disable vercel`).

On GCP connect, Bast prefers a local key already authorized on the VM. If none matches, it ensures `~/.ssh/google_compute_engine`, publishes it when needed, and may wait for the guest agent.

## Boat lifecycle

```sh
bast boat new [--type small|default|large] [--ttl seconds | --no-auto-stop] [--no-env]
bast boat fork <host|id> [--type small|default|large] [--no-env]
bast boat stop <host|id>
bast boat resume <host|id> [--type small|default|large] [--no-env]
```

In the TUI, the Boat group offers `n` to create and `s` to sync. Stopped sandboxes are hidden until `.`. Boat hosts support Enter to connect (resume first if stopped), `r` resume, `o` stop, and `n` fork. SSH user is always `user` with `~/.ssh/ascii_box_ed25519`. Docs: https://bast.sh/docs/features/boat

## Upstash Box lifecycle

```sh
bast upstash key [--key-file path]
bast upstash new [--name name] [--runtime node|python|golang|ruby|rust] [--size small|medium|large] [--keep-alive]
bast upstash fork <host|id>
bast upstash stop <host|id>
bast upstash resume <host|id>
bast upstash delete <host|id> [--yes]
```

SSH user is the box id at `us-east-1.box.upstash.com`. Bast feeds the stored API key as the SSH password. Key file: `~/.config/bast/upstash-box-api-key`. Docs: https://bast.sh/docs/features/upstash

## Vercel Sandbox lifecycle

```sh
bast vercel token [--token-file path] [--team team_id] [--project project_id]
bast vercel new [--name name] [--vcpus 1|2|4] [--timeout 15m|1h|5h] [--ephemeral]
bast vercel fork <host|id> [--name name]
bast vercel stop <host|id>
bast vercel resume <host|id>
bast vercel delete <host|id> [--yes]
bast vercel cleanup [--yes]
```

Connect is a WebSocket PTY, not OpenSSH. SFTP is unavailable. Token file: `~/.config/bast/vercel-token`. Offline sandboxes without a snapshot stay off the host list; `bast vercel cleanup` deletes them after confirmation. Docs: https://bast.sh/docs/features/vercel

## Hetzner Cloud

```sh
bast hetzner key [--name project] [--key-file path]
bast hetzner key --remove project
bast hetzner start <host|id>
bast hetzner stop <host|id> [--force]
bast hetzner restart <host|id> [--force]
```

In the TUI, powered-off Hetzner servers are hidden until `.`. If every server is off, the Hetzner Cloud group is hidden too. Enter starts then connects. `o` ACPI-shuts down (still bills). `R` reboots. `--force` is a hard poweroff/reset. Default SSH user is `root` on port 22; sync reuses user/port/identity from an existing local host with the same IP, and probes 2022/2222 when 22 is closed. Tokens: `~/.config/bast/hetzner/tokens/<name>` (not vaulted). One token per Hetzner Cloud project. Prefer private IP for VPN/Cloud Network SSH. Docs: https://bast.sh/docs/features/hetzner

## BitQate

```sh
bast bitqate key [--token-file path]
bast bitqate key --clear
bast bitqate list
bast bitqate start <host|id>
bast bitqate stop <host|id>
bast bitqate restart <host|id>
```

In the TUI, stopped BitQate VMs are hidden until `.`. Enter starts then connects. `o` powers off (still bills). `R` restarts. Suspended (billing-locked) VMs cannot be started from Bast. Default SSH user is `root` on port 22; sync reuses user/port/identity from an existing local host with the same IP, and matches the instance's authorized SSH key against local keys. Token: `~/.config/bast/bitqate-token` (not vaulted). Docs: https://bast.sh/docs/features/bitqate

## Railway

```sh
bast railway key [--key-file path]
bast railway new --name name (--project id|name | --new-project name) [--image image] [--start-command command] [--environment id]
bast railway stop <host|id>
bast railway resume <host|id>
bast railway delete <host|id> [--yes]
```

SSH is OpenSSH to `ssh.railway.com`. The user is the service instance ID. Key: `~/.ssh/bast/keys/railway`. Token: `~/.config/bast/railway-api-token` or `RAILWAY_API_TOKEN` (not vaulted). Account and workspace tokens work. Project tokens are rejected. Delete removes the service from that environment only. Groups are `Railway/<project>/<environment>`. Docs: https://bast.sh/docs/features/railway

## Fly.io

```sh
bast fly new --app APP --image IMAGE [--org slug] [--region code] [--size size] [--name name]
bast fly fork <host|id> [--region code]
bast fly stop <host|id>
bast fly resume <host|id>
bast fly delete <host|id> [--yes]
```

Requires `flyctl` on `PATH` and `fly auth login`. Bast does not store a Fly token. SSH goes through `bast __fly-proxy` (`fly proxy` over WireGuard) with a short-lived certificate under `~/.ssh/bast/keys`. Create adds a Machine to an existing app. Region defaults to `iad` when omitted by flyctl. Cloning does not copy mounted volumes. Groups are `Fly.io/<org>/<app>`. Docs: https://bast.sh/docs/features/fly

## DigitalOcean

```sh
bast digitalocean new --name name [--region nyc3] [--size s-1vcpu-1gb] [--image ubuntu-24-04-x64] [--context name]
bast digitalocean fork <host|id>
bast digitalocean stop <host|id>
bast digitalocean resume <host|id>
bast digitalocean delete <host|id> [--yes]
```

`bast do` is an alias. Requires `doctl` and an auth context. Bast does not store a DigitalOcean token. Create needs at least one account SSH key. Stop is an ACPI shutdown. The disk keeps billing until delete. Fork snapshots are deleted after the new Droplet exists. Private-only Droplets are skipped. Powered-off Droplets stay in inventory and hide until `.`. Groups are `DigitalOcean/<context>/<region>`. Docs: https://bast.sh/docs/features/digitalocean

## boxd

```sh
bast boxd new [--name name] [--org org] [--region fra] [--vcpu 2] [--snapshot name]
bast boxd fork <host|name> [--name name]
bast boxd stop <host|name>
bast boxd start <host|name>
bast boxd restart <host|name>
bast boxd delete <host|name> [--yes]
```

Requires the `boxd` CLI on `PATH` and `boxd auth login`. Bast does not store a boxd token. SSH uses the port and key from the entries the boxd CLI keeps in `~/.ssh/config`. Sync covers every region of the CLI's active org unless an org filter is set. Standby and hibernated computers wake on connect. Stop keeps the disk. Fork copies the disk, memory, and running processes. Groups are `boxd/<org>/<region>`. Docs: https://bast.sh/docs/features/boxd

## Files (SFTP)

TUI Files tab (`5`) is a dual-pane browser over OpenSSH SFTP. Both panes open on a host picker: Local first, then the same groups as Hosts. A pane shows `local` or the host name only after you choose it. Shift+D returns a pane to the picker from a local directory or a connected host. Enter toggles a group in the picker. Left and Right move to the parent directory and into the selected directory. Prefer the TUI for interactive transfers; use OpenSSH/`scp`/`sftp` directly when scripting file copies.

TUI tabs: `[1] Hosts` `[2] Keys` `[3] Vault` `[4] Sync` `[5] Files`. Vault is encrypted Bast-managed host/key sync. Sync is cloud VM import (GCP/AWS/Azure/Boat/Upstash/Vercel/Hetzner/BitQate/Railway/Fly.io/DigitalOcean/boxd). `BAST_NO_VAULT=1` hides Vault and rejects `bast vault`. `BAST_NO_SYNC=1` hides Sync and rejects `bast sync` plus the provider commands (`bast boat`, `bast upstash`, `bast vercel`, `bast hetzner`, `bast bitqate`, `bast railway`, `bast fly`, `bast digitalocean`, `bast boxd`). Remaining tabs are numbered from 1 with no gaps. Hosts already imported stay usable. Hosted `bast vault login` requires `--accept-terms` under `--json` / `--no-input`. First TUI with no hosts shows the logo, the slogan, and a short welcome. Any key continues to Hosts, on a history suggestion when one is waiting. `Ctrl+C` quits without dismissing it. `BAST_NO_ONBOARDING=1` disables it. About (`v`) then `o` shows it again.

## File layout

| Path | Purpose |
| --- | --- |
| `~/.ssh/bast/config` | Host blocks created through Bast |
| `~/.ssh/bast/sync/<provider>/config` | Cloud-synced host blocks (while sync is enabled) |
| `~/.ssh/bast/keys/` | Generated/imported keys (private keys mode 0600) |
| `~/.ssh/google_compute_engine` | Fallback GCP identity (created on demand) |
| `~/.config/bast/state.json` | Metadata: groups, icons, colors, tags, notes, favorites, usage stats, sync settings |
| `~/.config/bast/upstash-box-api-key` | Upstash Box API key (mode 0600; not vaulted) |
| `~/.config/bast/passwords/<managed-id>` | Optional host SSH password (mode 0600; not vaulted) |
| `~/.config/bast/vercel-token` | Vercel access token (mode 0600; not vaulted) |
| `~/.config/bast/hetzner/tokens/<name>` | Hetzner Cloud API tokens, one file per project (mode 0600; not vaulted) |
| `~/.config/bast/railway-api-token` | Railway account or workspace token (mode 0600; not vaulted) |
| `~/.ssh/bast/keys/railway` | Railway SSH key registered with the account |
| `~/.ssh/config` | Gets `Include ~/.ssh/bast/config` on first run |

Connection settings (hostname, user, port, identity files, password-only flags) live in SSH config. Bast metadata (groups, icons, colours, tags, notes) lives in `state.json`. Host passwords stay in `~/.config/bast/passwords/` and are fed to `ssh` via askpass. They do not sync through Vault.

## Safety

- Never paste private keys into chat, issues, or logs
- Back up `~/.ssh` before testing unreleased builds on a real config
- Bast won't delete externally managed hosts from the main SSH config; it can add metadata edits only
- Commands needing interactive SSH or passphrase entry reject `--json` with `interactive_required`
