CLI reference

Every hostssh command, its flags, and what it does — the complete reference for the agent CLI on a Node.

CLI reference

The hostssh binary is the Agent and the CLI in one. On a Node you use it to deploy apps, manage databases and the proxy, run backups, and open shells. Most day-to-day work happens in the dashboard, but every action is available on the box.

hostssh <command> [flags]

Add --json to read commands for machine-readable output.


Licensing: what's gated and what isn't

A Node does not function without a valid license (past a generous offline grace window): the two commands that make a box actually serve — the agent daemon and the proxy — are gated, along with deploy, db, mcp, mta, clone, migrate, transfer, provision, and ssh. Using a gated command without a license exits with code 12.

Recovery is never gated. capture, restore, pack, recovery-pg, recovery-order, license, status, doctor, firewall, and version always work, so a box can never be bricked or held hostage, and you can always get your data out. update is also ungated, so a node can install a signed fix without a license. This is a deliberate design choice.


Command index

CommandWhat it does
statusShow agent + license status.
doctorCheck local prerequisites and env wiring.
license activateActivate a license key against the control plane.
deployBuild → run → route an app.
db createProvision a managed database.
proxyManage the edge proxy (Traefik + TLS).
firewallOne-click host firewall / hardening.
logsStream a container's logs.
captureCapture this server to an encrypted .hsi image.
restoreRestore this server from a .hsi image.
recovery-pgPreflight, dump, and restore one Postgres database.
recovery-orderCheck that a capture was stable, and walk a restore in phases.
packWrite or verify an integrity catalog for the files in a capture.
verifyConfirm a container is running the image you expect.
drillRun a restore-drill (verify recoverability).
retentionShow/preview/apply image-retention policy.
pruneReclaim disk — image + build-cache GC.
auditShow/verify the tamper-evident action log.
fleetList the license's fleet (servers, backup health).
clone / migrateClone or relocate this server to another machine.
transferGenerate a one-time peer transfer key.
provisionNot on the node. Exits 3. Use the dashboard.
capacitySee whether a Slot size fits on this machine.
updateInstall a newer signed binary, or only check.
mtaRun the outbound mail sidecar.
ssh / accessOpen a Web-SSH / gateway session.
mcpRun the MCP server (stdio) for AI agents.
agentRun the daemon (used by the systemd service).
versionPrint version.

status

$ hostssh status

Prints the Agent version, license state (active / grace / expired), fingerprint, and whether the daemon and proxy are running.

doctor

$ hostssh doctor [--json]

A non-mutating preflight. Checks config, control-plane TLS pins, license public key, mTLS client identity, Docker/HostPack/BuildKit availability, reachability (public vs private/CGNAT), cloudflared (named tunnel + service, for inbound expose), engine scripts, and cleanup-policy env. Missing cloudflared is a warn, never a fail — a Node that only heartbeats does not need it. Home/office join: tunnel-first.

license

$ hostssh license activate --key HSSH-XXXX-XXXX-XXXX [--api https://app.hostssh.com] [--config /etc/hostssh/agent.toml]

Activates a license against the control plane, receiving a signed token (and, when enrolled, an mTLS client certificate) the Agent uses for all later calls. See Licensing.

deploy

$ hostssh deploy --name <app> [--source ./path|git-url] [--ref branch] \
    [--builder hostpack|dockerfile|image] [--image-limit-mb 4096] \
    [--domain x.com --port 3000 --readiness-path /healthz] \
    [--command 'pnpm worker'] [--slot rack1/3 --slot-size m] \
    [--env K=V] [--env-file f] [--volume name:/container/path]

Builds an app (HostPack/Docker), runs it as a capped container, and routes a domain to it. Full walkthrough in Deploying apps.

FlagMeaning
--nameApp name (required).
--sourceLocal path or Git URL (default .).
--refBranch, tag, or commit SHA.
--builderhostpack | dockerfile | image.
--image-limit-mbFail if the built image exceeds this (default 4096).
--domain --portPublic host + container listen port.
--readiness-pathHTTP path probed before success — and the path the proxy healthchecks from then on. Give it something cheap (/api/version), not your homepage. Defaults to /.
--commandOverride start command → marks a worker (no proxy/port).
--slot --slot-sizePlace in a Slot with s/m/l/xl caps.
--env --env-fileBuild + runtime env (--env overrides the file). The file must be valid KEY=VALUE lines — a line that isn't fails the deploy, and the loaded count is printed so you can check nothing went missing.
--volumeNamed volume that survives redeploys (repeatable).

db

$ hostssh db create --engine <postgres|mariadb|redis> --name <db> [--network hostssh] [--version v]

Provisions a managed database container on this Node, on the private Mesh network so apps reach it without public exposure.

proxy

$ hostssh proxy up            # ensure the managed proxy is running (idempotent)
$ hostssh proxy up --force    # recreate it — clears a stuck ACME backoff
$ hostssh proxy down          # stop it
$ hostssh proxy status        # is it running?

Manages the Traefik edge proxy that terminates HTTPS and issues Let's Encrypt certs. See Domains & TLS.

firewall

$ hostssh firewall up [--tcp 80,443] [--udp 51820] [--reset]
$ hostssh firewall status

One-click host firewall: default-deny inbound, SSH-safe, allowing the ports you list (80/443 by default; add 51820 for WireGuard). Uses nftables or ufw, whichever is present. Never gated — you can always harden a box. See Hardening.

logs

$ hostssh logs <app> [--follow] [--tail N]

Streams a running container's logs. --follow tails live; --tail N shows the last N lines.

capture

$ hostssh capture [--tag clone-name] [--note NOTE] [box-name [note]]

Captures the whole box — platform state, every database, named-volume data, and config — into one encrypted .hsi image in your object storage. Never gated. See Backups & recovery.

restore

$ hostssh restore --snapshot <id|latest> --tag <clone-name> [--new-ip <ip>]

Restores the box from a .hsi image. With --new-ip it rewrites the public IP for a relocate. Never gated.

drill

$ hostssh drill

Runs a restore-drill — actually verifies that images are recoverable, not just that a job completed. This is the "a backup you haven't restored isn't a backup" check.

retention

$ hostssh retention <get|set|preview|apply> [--tag T] [--keep-last N] [--keep-daily N] [--keep-all]

Views or changes how many images are kept. Default is keep-all — HostSSH never silently deletes your history.

prune

$ hostssh prune [--dry-run] [--keep-last N] [--builder-gb N] [--builder-until-hours N]

Reclaims disk safely: keeps the newest N image versions per app, removes dangling images, and bounds the build cache. --dry-run previews without deleting. It never touches volumes, running containers, rollback tags, .hsi images, or user data.

audit

$ hostssh audit

Shows and verifies the tamper-evident local action log (hash-chained).

fleet

$ hostssh fleet servers [--json]
$ hostssh fleet backups [--server host] [--json]

Lists the fleet as the control plane sees it — every Node, status, and backup health.

recovery-pg

Logical Postgres only. A successful restore prints applicationHealth: unverified. You still request the app yourself. Full sequence: Recovery commands.

$ hostssh recovery-pg describe
$ hostssh recovery-pg check --container <name> --database app
$ hostssh recovery-pg capture --container <name> --database app --file /var/backups/app.dump
$ hostssh recovery-pg restore --container <name> --database app --file /var/backups/app.dump

--user defaults to app. Add --clean on restore only when you intend to replace objects already in that database.

recovery-order

$ hostssh recovery-order describe
$ hostssh recovery-order compare --before before.json --after after.json --max-age 1800

describe reports cutover: never-automatic. A compare that prints INVENTORY_CHANGED exits 1. Do not publish that capture.

pack

$ hostssh pack write --out /var/backups/integrity.json --format 2 --root /staged/tree=/tree
$ hostssh pack verify --catalog /var/backups/integrity.json --base /var/restore

--format 2 is the durable catalog. The default is 1. --root-live is for a real mounted volume, where sockets and symlinks are skipped. A curated --root still refuses a planted symlink.

verify

$ hostssh verify <app> --image <image-ref>

Exit 0 means the container was confirmed. Exit 1 means it was not. This does not HTTP-probe the app.

capacity

$ hostssh capacity
$ hostssh capacity --fit 3xm --json

Sizes are s, m, l, xl. Exit 1 means that workload does not fit. Exit 0 with no --fit means the report printed.

update

$ hostssh update --check
$ hostssh update --channel stable

--check exits 10 when a newer signed build is available and 0 when you are current. The install verifies the binary before it replaces the file. An unverified binary is not installed.

mta

$ hostssh mta status
$ hostssh mta serve --listen 10.10.0.2:2525 --helo mail.example.com

Set HOSTSSH_MTA_USER and HOSTSSH_MTA_PASS in the environment. They are not flags, so they do not show up in ps. Bind loopback or the WireGuard address. Do not bind 0.0.0.0. This command is license-gated.

clone / migrate

Run these on the destination. Both are license-gated. Neither one cuts DNS for you.

$ hostssh clone --from <box> [--snapshot latest] [--old-ip <source> --new-ip <this-box>]
$ hostssh migrate <container> --source-ssh user@source --app <name> [--volumes] [--dry-run]

clone restores that box's captured image onto this machine. The default is non-destructive: files land under /var/restore. --rewrite-control-plane is the destructive opt-in. Do not pass it unless you mean to replace this node's control-plane brain.

migrate reads one live container over SSH and redeploys it through the local pipeline. --source-ssh and --app are required. --dry-run prints the plan and moves nothing. --containers redis,api,web moves a set together, dependencies first. There is no --new-ip flag on migrate. IP rewrite belongs to clone.

transfer

$ hostssh transfer --new-key
$ hostssh transfer --serve --resumable [--stage-dir /var/lib/hostssh/transfer-stage]

Generates a one-time peer transfer key (or serves a resumable transfer) for streaming one box directly to another without an intermediate download.

provision

$ hostssh provision

This binary does not provision a VPS. The command is license-gated, then it prints that it is not in this build and exits 3. Create the server from the dashboard. The control-plane worker talks to the provider.

ssh / access

$ hostssh ssh <node-fingerprint> [--config <path>] [--relay <wss://…>]
$ hostssh access connect --relay wss://relay.host --sid <session-id> --token <token> [--shell /bin/bash]

Opens a browser/gateway root shell to a Node through the relay, presenting the Agent's mTLS client certificate. See Web-SSH.

mcp

$ hostssh mcp

Runs the Model Context Protocol server over stdio, exposing platform tools so an AI agent (Claude, etc.) can drive HostSSH. See Add-ons.

agent

$ hostssh agent

Runs the long-lived daemon: heartbeat, job drain, security reconcile, Web-SSH poll, and the daily reaper. This is what the hostssh-agent systemd service runs — you don't normally call it directly.

version

$ hostssh version

Prints the Agent version (e.g. 0.4.20).


Exit codes

CodeMeaning
0Success.
12A gated command was run without an active license (past grace).
non-zeroCommand-specific failure — read the message.