Cloud.Ssh
SSH exec/scp against a Cloud.Server. Uses the server’s Alchemy-managed
deploy key (installed when the server was created) and root, unless
privateKey / user are passed.
Host keys
Section titled “Host keys”Every connection checks the server’s host key against a known_hosts
written for that session only, never ~/.ssh/known_hosts and never
StrictHostKeyChecking=no:
- pinned — the server’s
hostPublicKey(Alchemy generated the pair and installed it at first boot, or recorded it at the first login):StrictHostKeyChecking=yes; any other key is refused withSshErrorreason: "host-key-mismatch"before a command or a file is sent; - none known (
bootstrap: false, looked-up servers, servers created before pinning) — trust on first use for that session (accept-new), logged as a warning; passhostKeyto pin one.
Connections drop after a minute without an answer (ServerAliveInterval).
Remote access
Section titled “Remote access”Exec a command
const ssh = yield* BetterStack.Cloud.Ssh(server);const { stdout } = yield* ssh.exec("uname -a");Copy a file
const ssh = yield* BetterStack.Cloud.Ssh(server);yield* ssh.scp("/tmp/app.zip", "/opt/app/bundle.zip");