Servers
Add your servers, choose how komando logs in to them, and keep the list tidy.
Add a server
Give each server a short name, then its user and address:
komando host add web1 ubuntu@203.0.113.10
komando test web1 # can komando log in?
added web1
address: 203.0.113.10
user: ubuntu
Next: komando test web1
NAME KIND RESULT LATENCY USER SUDO NOTE
web1 host ok 48ms ubuntu yes -
Typed alone at your terminal, komando host add asks for each part, one line at a time: a name, the address, the user, the port, how komando logs in, and whether it is production. Any command typed with an argument missing asks for it the same way (see Running commands); scripts and AI agents get a usage error with an example.
More ways to write it:
komando host add web2 ubuntu@203.0.113.11 --group web --tag prod
komando host add web2 ubuntu@203.0.113.11:2222 # another SSH port
komando host add db1 admin@10.0.0.5 --via bastion # reached through bastion
komando host add web2 --address 203.0.113.11 --user deploy --key deploy
The flags you will use most:
| Flag | What it does |
|---|---|
-g, --group / -t, --tag / --label KEY=VALUE | Sort servers so one target can pick many. |
--key NAME / --identity PATH | Log in with a key from komando's key list (komando key), or with a key file. |
--password-ref / --sudo-ref | Where the login or sudo password is kept (see Use a password). |
--login ask|password|key|agent | How komando logs in, in the same words host show prints: ask (you type the password at every connect, never stored: see Type the password each time), password (a stored one, with --ask-password or --password-ref), key (with --key or --identity), agent (ssh-agent and ~/.ssh only). |
--via bastion | Reach the server through other servers or a VPN first (tunnels). |
--protected | Mark a production server (see Protect a production server). |
-e, --env KEY=VALUE | Export a variable before every command on this server. A value from the vault (KEY=secret:NAME) is left out of an AI agent's commands: the agent could read it back unmasked (printenv KEY | rev). It goes to an agent's exec or job start only when the agent adds --yes and you allow it in komando's window. |
--notes TEXT | Free notes; agents see them in host show. |
--port N | The SSH port (default 22); same as :N after the address. |
--overwrite | Replace a server that already has this name. |
komando checks what you save: the port (1-65535), the user name, that the address does not start with - (ssh would read it as an option), that every --via step exists and does not loop back, and that an --identity file is there. A path that names a step twice (--via a,b,a) stops with VIA_CYCLE. A server at the same address and port as a protected one (in another case, with a trailing ., or a name that resolves to the same IP) is protected too, with a warning. komando doctor checks the whole list the same way.
komando test tells you, per server, the login user and whether sudo works without a password (SUDO). komando facts reports the same sudo check, plus much more (Health).
Servers behind the same --via hosts share one connection to them within a command: komando exec @db -P 10 logs in to the bastion once and reaches the ten servers through it, like OpenSSH's ControlMaster. The bastion's connection limits (MaxStartups) and its login log see one client.
Already have servers in ~/.ssh/config, or on another computer? Import them instead (Moving in):
komando import ssh-config
A Windows server
Add --os windows for a server with OpenSSH, or give a winrm:// address for one with WinRM. komando then runs PowerShell there. See Windows servers for setup and what works.
komando host add win1 Administrator@10.0.0.9 --os windows --ask-password
komando host add win2 winrm://Administrator@10.0.0.9 --ask-password
A new server that is still starting
Right after you create or rebuild a cloud server, SSH may not answer yet. --wait tests again every few seconds until every server passes:
komando test @new --wait 5m # until SSH answers and the login works
komando exec @new --read-only -- cloud-init status --wait # then: until its own start-up is done
It does not wait out a changed host key (HOSTKEY_MISMATCH) or a refused login (AUTH_FAILED: retrying could get your address banned): those fail at once. data.waited_ms (in -o json) says how long it waited.
Add many servers from a spreadsheet
Setting up ten or twenty servers? Write them in a spreadsheet, save it as CSV, and import it in one go. The first row names the columns:
name,address,user,port,groups,tags,sudo-ref,via,protected,notes
bastion,203.0.113.10,ubuntu,,edge,prod,secret:ubuntu-sudo,,no,
web1,10.0.0.11,ubuntu,2222,"web,ubuntu",prod,secret:ubuntu-sudo,bastion,yes,front end
web2,10.0.0.12,ubuntu,,"web,ubuntu",prod,secret:ubuntu-sudo,bastion,yes,
komando import csv servers.csv --dry-run # check every row, change nothing
komando import csv servers.csv --group fleet # add them all (and to the group fleet)
Only name and address are needed. The columns are name, address (or ip), user, port, key, identity, password-ref, sudo-ref, via, groups (or role), tags, protected (yes or no) and notes; a cell with several groups or tags separates them with commas, ; or spaces. Each row is checked like host add, and rows may use each other in via. komando checks every row before it writes anything: one bad row (an unknown column, a bad port, a via to a server that does not exist) stops the whole import and lists every problem. Servers that already exist are skipped; --overwrite replaces them (a protected one asks first). Lines starting with # are comments.
Passwords never go into the file: point password-ref and sudo-ref at the vault (komando secret set ubuntu-sudo first).
Change a server
host edit changes only the options you pass:
komando host edit web1 --add-tag canary --port 2222
komando host edit web1 --rm-group old --label dc=jkt # an empty value removes a label
komando host edit web1 --unset via,sudo-ref # clear settings (see `--help` for the list)
changed: web1
To change many servers at once, give several names or a target. Every server gets the same change, and the command changes all of them or none:
komando host edit @web --sudo-ref secret:ubuntu-sudo --dry-run # which servers would change
komando host edit @web --sudo-ref secret:ubuntu-sudo
komando host edit web1 web2 db1 --add-tag canary
One yes covers the whole command. When an AI agent asks, komando's window lists every server the command changes and which of them are protected, so the person says yes once, knowing all of them. --address works on one server only (two servers never share one).
Protect a production server
komando host edit web1 --protected
On a protected server, every change on the server needs a yes. For the entry itself, so do: changing how komando logs in (address, port, user, key, password, --via), replacing a secret it uses, turning protection off, renaming it and removing it. Tags, groups, labels and notes change without one.
At your terminal komando asks you first (web1 (protected): this command changes it. Continue? [y/N]); an AI agent or a script adds --yes after a person agrees, and an agent's --yes opens komando's approval window. See Safety for the details.
Rename a server
host rename gives a server a new name and keeps everything else:
komando host rename web1 web-01 --dry-run # what would change
komando host rename web1 web-01
The address, login, references, protected mark, groups, tags and labels stay. Servers, conns and tunnels that go through it (--via), and its jobs and tunnels, follow the new name in the same step. Pinned host keys belong to the address, so host trust is not needed again. Renaming a protected server asks first. conn rename and vpn rename do the same for conns and VPNs, key rename for a key, and group rename for a group.
komando rename OLD NEW finds the kind for you: it renames the one server, conn, VPN, secret, key or group named OLD with that kind's own rename. When two kinds share the name, it names the two commands to pick from.
key rename OLD NEW renames one key: the servers that use it follow. A key komando made lives in the sealed store, so no file moves; a key you added with key add stays where it is. Public keys already installed on servers keep their comment; they still work, since the key itself does not change.
group rename OLD NEW renames a group on every member (it asks first when a protected server or conn is in it). To merge two groups, use group add NEW @OLD and then group rm OLD.
Rename a whole project at once
When a project or a customer gets a new name, rename --starts-with renames every server, conn, VPN, secret, key and group whose name starts with the old prefix, in one step:
komando rename --starts-with shop- acme-shop- --dry-run # the old -> new list per kind, and every reference
komando rename --starts-with shop- acme-shop-
komando rename --starts-with shop- acme-shop- --in-notes --in-labels --dry-run # notes and labels too: what changes, what is kept
- It renames every name that starts with
shop-. When the old prefix ends in-, the name without it is renamed too: groupshopbecomesacme-shop.--kind host,connrenames only some kinds. - Every reference follows:
--viapaths (also a server in the middle of one, as inshop-vpn,shop-bastion), password, sudo, key, preshared key and passphrase references,secret:NAMEoptions in conn URLs, the key a server uses, group membership, jobs and tunnels. A key komando made (key gen) lives in the sealed store, so no file moves; a key file you added stays where it is. - The protected mark, labels, notes and creation time stay. Names inside URLs belong to the resource, not to komando, so in
s3://shop-admin@shop-prodthe user and the bucket stay. --in-notesalso replaces old names in notes, and--in-labelsin label values (label names stay). Only what clearly means an entry follows: server, conn, VPN and secret names as whole words, a group written@shop, and a pattern such asshop-db-*when it matches the same servers, conns and VPNs after the rename. These stay, because they often mean something else: the old prefix without its-(db shopis usually a database, not the group), group names without@, key names (bucket shop-dev), and a name that is also the user, host, bucket or database in a conn URL. The result lists each one underkept, with the reason, so you can fix it by hand.- Without
--in-labels, every label value that names an old entry stays and is listed underkeptwith what it would become. A conn'shost=label matters:komando doctorreads it to warn when a conn of a protected server is not protected itself. Without--in-notes, one warning counts the notes that still name old entries. - It renames all or nothing. Your list and the vault are each written once. When a new name is taken, or two old names would get one new name, nothing changes (
NAME_TAKEN, with every clash listed). A connected VPN must go down first (VPN_IN_USE). - Protected servers and conns among them need one yes for the whole command. An AI agent's
--yesopens one window for a person, which says how many protected entries it covers. Pointing a reference at the new name of the same secret, key or VPN needs no yes: the same value goes to the same place. - It is safe to repeat. When the new prefix starts with the old one (
team-toteam-ops-), names that have the new prefix already are left alone, so a second run changes nothing.
Remove a server
host rm removes servers from komando's list. It does not touch the server itself. It takes names or a target:
komando host rm @old --dry-run # list what would be removed
komando host rm web2
komando host rm 'tmp-*'
A protected server asks first. A server that another server still reaches through --via is kept (HOST_IN_USE, which lists every one of them). conn rm works the same way for databases, caches and storage.
host rm does not forget a server's pinned host key (see Server keys).
Log in with a key
If ssh already works on this computer, komando usually works too: it uses the same keys (files like ~/.ssh/id_ed25519, and the ssh-agent that holds unlocked keys).
A key with a passphrase works while ssh-agent holds it (after ssh-add, or from the macOS Keychain), also when it is the server's --key or --identity (which import ssh-config sets from IdentityFile): komando finds the agent's copy by its public key, as ssh does. When the agent does not hold it, the server fails with KEY_PASSPHRASE_REQUIRED, and the hint says how to load it or keep its passphrase in the vault.
To use a new key, create it and install it on your servers. komando logs in with the servers' current login (for example a password) to install it:
komando key gen deploy # ed25519; --type rsa|ecdsa, -b BITS, -C COMMENT
komando key deploy deploy @web --set-default # install it, then log in with it
komando key deploy ~/.ssh/id_ed25519.pub web1 # a .pub file works too
komando key list # NAME TYPE FINGERPRINT USED BY
komando key show deploy # the public part
komando key show deploy --reveal # a person: the private key of a key komando made
Keys made with key gen are sealed in komando's store (store.db); they are never written to a file. host ssh-command hands one to the running ssh-agent when another program needs it. RSA keys need at least 3072 bits.
To use a key file you already have, add it to komando's key list. The file stays where it is. If it has a passphrase, store the passphrase in the vault first:
komando secret set work-pass
komando key add work ~/.ssh/id_work --passphrase-ref secret:work-pass
komando key edit work --passphrase-ref secret:new-pass # change it later (--unset passphrase-ref clears it)
komando key rm NAME takes a key out of komando's key list; it refuses while servers still use it (KEY_IN_USE). --delete-file also deletes the key itself, but only for keys komando made (it removes the sealed record; a key added with key add stays on disk). Such a key has no copy, so at your terminal you type the key's name; an AI agent or a script adds --allow-dangerous after a person agrees.
To replace a key everywhere, in order, see Rotate keys and passwords.
Keys with a certificate
Where servers trust a certificate authority (SSH CA, TrustedUserCAKeys) instead of each key, komando logs in with the key's OpenSSH user certificate, as ssh does: KEY-cert.pub next to a key file (key add, --identity, ~/.ssh/id_*) is offered first, then the key alone. For a certificate kept elsewhere, or for a key komando made, name it:
komando key add corp ~/.ssh/id_corp --cert ~/certs/id_corp-cert.pub
komando key edit deploy --cert ~/Downloads/deploy-cert.pub # --unset cert goes back to KEY-cert.pub
komando reads the certificate at each login, so a renewed file is used at once. A certificate for another key is refused (KEY_INVALID); one that is not valid now is left out (key add warns), and the key alone is offered. An ssh-agent that holds a certificate offers it too.
Servers with a host certificate
Where servers have host keys signed by a certificate authority (an @cert-authority line in known_hosts), trust the CA once instead of pinning each server:
komando host ca add corp --key ~/corp-host-ca.pub --hosts '*.corp.example' --dry-run # the servers it matches now
komando host ca add corp --key ~/corp-host-ca.pub --hosts '*.corp.example'
komando host ca add corp --from ~/.ssh/known_hosts # its @cert-authority and @revoked lines
komando host ca list
komando host ca rm corp
komando host ca revoke --key old-host-ca.pub # never trust this key again (an @revoked line)
A server whose name a CA's patterns match is asked for its host certificate first. A pin always wins: a pinned server's key, plain or inside a certificate, must match its pin, or the connection stops with HOSTKEY_MISMATCH. For a server with no pin, the certificate is trusted, with no pin, when the CA signed it, the name komando dials is among its names, it is valid now, and neither its key nor the CA is revoked. Any other certificate falls back to its plain key and the pins. With host_key_policy strict a trusted certificate counts as known. A --login ask server is never trusted through a CA: a typed password goes only where a person met the key.
A pattern names at least the domain: *.corp.example, web*.corp.example, 10.1.2.*. *, *.*, *.com and any other public suffix, such as *.co.uk or *.github.io, are refused (CA_HOSTS_INVALID). A certificate that names no server is refused. Names match whatever their case and one trailing dot. Adding a CA trusts every server it ever signs, so only a person at a terminal can add one (NEEDS_PERSON); an AI agent may preview it with --dry-run, remove a CA and revoke a key, which only narrow trust.
Lend a jump host your ssh-agent
Some work needs your keys on the server itself, for example a git pull there over SSH, or a hop that komando does not make. --forward-agent lends the server the keys in your ssh-agent while komando is connected, as ssh -A does:
komando host edit bastion --forward-agent # asks first
komando host edit bastion --unset forward-agent # stop lending it
Anyone who is root on that server can use your keys while komando is connected to it, so it is off by default, set per server, and turning it on asks you first (SAFETY_SETTING; an AI agent needs your yes in the window). host ssh-command adds -o ForwardAgent=yes for such a server. Your agent holds only the keys you added to it (ssh-add); keys komando keeps sealed are never in it unless host ssh-command put them there.
Security keys (FIDO2)
A key on a security key (YubiKey, SoloKey, made with ssh-keygen -t ed25519-sk or -t ecdsa-sk) is signed by the device, so komando uses it through ssh-agent, as ssh does:
ssh-add ~/.ssh/id_ed25519_sk # touch the key when it blinks
komando key add yubikey ~/.ssh/id_ed25519_sk # reads the public key from id_ed25519_sk.pub
komando host edit web1 --key yubikey
At each login the key asks for a touch. Without ssh-agent holding it, the server fails with KEY_PASSPHRASE_REQUIRED and the hint says to ssh-add it. Keep id_ed25519_sk.pub next to the key file: komando finds the key in the agent by it.
Remove a key from servers
When someone leaves, or a key is replaced, remove it everywhere at once. key revoke takes a key from komando's key list, a .pub file, or the key line itself:
komando key revoke ~/keys/alice.pub @web --dry-run # how many lines per server
komando key revoke ~/keys/alice.pub @web
komando key revoke old-deploy @web --user deploy # another user's file (uses sudo)
komando key revoke ~/keys/alice.pub @web --all-users --dry-run # every user's file: who has it
--all-users (with sudo) looks in the authorized_keys of every user on the server: someone who left may have put the key into another account too. The result lists each user whose file held it (users). The authorized_keys file keeps its owner and mode, and is read and written as its own user. Revoking the key komando itself logs in with needs --allow-dangerous, because you would lock yourself out.
Use a password
At your terminal, komando asks for the password when the server wants one, as ssh does (web1: Password:, hidden as you type). Store it once to skip the question, and so that AI agents and scripts can log in: they have no one to ask. You type it, nothing is shown, and it is saved encrypted in komando's vault (see Secrets). In one step, while adding the server or later:
komando host add web2 root@203.0.113.20 --ask-password # stored as secret:web2-pass
komando host edit web1 --ask-password # a new password (stored as secret:web1-pass)
--ask-password is for a person at a terminal (an AI agent asks you to run it). It never replaces a secret that another server or conn uses. The same in two steps, with a name you choose:
komando secret set web1-pass
komando host edit web1 --password-ref secret:web1-pass
A --password-ref secret:NAME whose secret is not in the vault yet gets a warning right away, with the secret set command that stores it.
The password goes to the server's address on every login. So when an AI agent gives a server or conn a password reference, or moves one that has one to another address, port or --via path, a person allows it in komando's window (SECRET_DESTINATION); see Safety.
komando sends the stored password at most once per login, and only when the server asks for a password (hidden as you type); a refused one is not sent again, so a wrong password in the vault cannot lock the account.
Type the password each time (--login ask)
Some passwords should never be kept on a laptop. With --login ask, komando stores nothing: a person types the password whenever komando connects, and it is used for that one command only.
komando host add web2 root@203.0.113.21 --login ask # never stored
komando host edit web1 --login ask # stop using the stored password
komando host edit web1 --login agent # back to ssh-agent and ~/.ssh
komando host edit web1 --login password --ask-password # back to a stored password
--login takes the words host show and host list print in their login field, and each reads back as written:
--login | How komando logs in | Needs |
|---|---|---|
ask | a person types the password at every connect; never stored | no --password-ref or --ask-password |
password | a stored password, no key | --ask-password or --password-ref (or one stored already) |
key | a key komando names, then a stored password if there is one | --key NAME or --identity PATH (or one set already) |
agent | ssh-agent and the keys in ~/.ssh | no key, identity or stored password |
The settings say it on their own too: --key gives key, --password-ref gives password. --login clears what contradicts it (password drops the key, agent drops the key and the stored password). A WinRM server logs in with a password: password or ask.
Who types it, and where:
- You, at a terminal: komando asks
web1: Password:(hidden) when the server wants it, after any key, assshdoes. - An AI agent's command: komando opens its own window on your screen. It names the agent, the server as
user@address:port, the way komando dials there (a VPN, each jump host with its address, a proxy command) and the command (or says the command is hidden), and you type the password there. The agent never sees it. Every command that connects asks, even one that only looks (komando test,fs ls). If you press Cancel the command stops withDECLINED, and the window stays shut for that server for a minute (a rename does not reopen it) (later commands getDECLINEDat once), so an agent cannot ask again and again. With no screen (an SSH session,KOMANDO_NO_DIALOG=1,ssh-gate) it stops withNEEDS_PERSON. - A script (no terminal):
NEEDS_PERSON. Nobody can type it. - An app that runs komando gets the same question in its own window.
The password goes to whatever answers at the end of the way there. If an AI agent could choose that way, it could send you to a server it controls and catch what you type, while the window still names the right server. So komando keeps the way in your hands:
- Only you set where it goes. An AI agent that adds a
--login askserver, turns one to--login ask, changes its address, port, user,--viapath, proxy command, WinRM transport or itstls=,ca=orauth=, changesdefault_userwhile the server has no user, or changes a server or VPN on its way (a jump host's address, a VPN's server; also throughvpn add --overwrite, an import, or replacing the secret that holds an OpenVPN profile), or gives one another way at run time (cert check --via hop,web1) stops withNEEDS_PERSON. A server with no user logs in as the account komando runs as, taken from the system, never from$USER, which an agent can set. No flag lifts it: run that command in your own terminal if you want it. A dry run is never blocked and names the stop inmeta.would_be_blocked. Other edits (tags, notes, groups) go on. - A key you have not logged in with needs you. The first connection to a
--login askserver, whose host key komando has not seen yet, needs a person at a terminal: an AI agent's command stops withNEEDS_PERSON, opens no window and pins nothing. Runkomando login web1(or any command) at your terminal once: komando prints the new key to compare, then asks the password. A pinned key is not enough on its own: komando pins keys by address, and an agent can pin whatever answers at an address through any server it adds there. So the typed password goes only to a key you have logged in to this server with; a key pinned some other way counts as a first connection (nobody has logged in to web1 ... with a typed password yet). A rename keeps what you met;host trust --resetforgets it. An app's window warns on a first connection or login. The same holds whilehost_key_policyisoff, and for a WinRM server withtls=offortls=skip-verify: nothing checks who answers there. - The login's background process is yours. An AI agent cannot run
komando login, nor start its background process itself (bothNEEDS_PERSON), whose questions it would answer as if it were you.
One command asks once per server: komando exec @web -P 10 asks each login-ask server once, and a jump host once for every server behind it. A password the server refuses is not sent again: the command forgets it, and the next connection (in the same command or the next one) asks again. The typed password is hidden in all output ([hidden]), never written to disk, the audit log or a program's environment. komando zeroes its own copy when the command ends; copies the SSH library made cannot be zeroed and go when the command's process ends.
To type it once for a while instead, log in with komando login web1 (below): every command, an AI agent's too, uses that login until it ends, and nobody is asked. A server that prints the password back cannot be masked then: the command that uses the login never had it. A tunnel runs in the background, so komando tunnel start asks now and hands the password to the tunnel's process on its input; that process keeps it in memory for the tunnel's whole life (its reconnects), until the tunnel stops. tunnel start asks only for servers you have logged in to with the key pinned for them: the background process could show a new key to nobody.
Switching a server to --login ask or --login agent unlinks its stored password. komando never deletes the secret itself: when no other server or conn uses it, the result names it in secrets_unused with the komando secret rm that removes it. Setting a stored password later (--password-ref, --ask-password) ends --login ask. Changing the login of a protected server needs the same yes as any change to it.
Two-factor logins
When a server also asks for a one-time code (or any other question), komando shows you the server's question with its name (web1: Verification code:) and sends what you type, hidden unless the server lets it show. Servers that log in at once (komando exec @web) ask one at a time. Ctrl-C stops the login (CANCELLED). Only a person at a terminal is asked: for an AI agent or a script the login stops with AUTH_FAILED, the message quotes the server's question, and no wrong code counts against the account. The agent asks you to log in once for it:
komando login web1 # type the password and the code once
komando logout web1 # end it sooner
komando login asks what the server asks and then keeps that login open in the background for 8 hours (the login_for setting). Every command to web1 uses it, your AI agent's too, so nobody types a code again until it ends; komando's rules, approvals and audit still apply to each command. A login to a jump host is used for every server behind it. komando status lists the kept logins, and a login ends early when the server closes it or its address changes.
Only a person at a terminal can run komando login; an AI agent's komando login web1 --dry-run shows the plan (would_log_in: false, and meta.would_be_blocked names NEEDS_PERSON).
Sudo passwords and the vault
If sudo asks for a password on the server, store that too:
komando secret set web1-sudo
komando host edit web1 --sudo-ref secret:web1-sudo
Everything else about the vault (listing, checking, renaming and removing secrets, and where its key is kept) is on one page: Secrets.
Passwords from your password manager
Every --password-ref and --sudo-ref (for servers, conns and VPNs) can also point at an environment variable, a file, or the password manager your team already uses:
| Reference | Reads it from | Login it uses |
|---|---|---|
secret:NAME | komando's vault (komando secret set NAME) | none needed |
env:VAR | an environment variable | none needed |
file:PATH | a file | none needed |
vault:secret/shop#db_password | HashiCorp Vault or OpenBao, KV v1 or v2 | VAULT_ADDR and VAULT_TOKEN (or ~/.vault-token; OpenBao's BAO_ADDR, BAO_TOKEN, ~/.bao-token work too), VAULT_NAMESPACE, VAULT_CACERT |
aws-sm:shop/db#password | AWS Secrets Manager; #key picks a JSON field | your AWS login (AWS_PROFILE, ~/.aws, SSO via komando login aws) |
gcp-sm:db-pass@my-project | Google Secret Manager, latest version | Google application-default credentials (GOOGLE_APPLICATION_CREDENTIALS, or on Google Cloud) |
azure-kv:shop-vault/db-password#password | Azure Key Vault, current version (/VERSION after the name picks another); #key picks a JSON field | a service principal (AZURE_TENANT_ID, AZURE_CLIENT_ID, AZURE_CLIENT_SECRET), a workload identity on AKS (AZURE_FEDERATED_TOKEN_FILE), the Azure CLI's saved token, or the managed identity on Azure |
bw://shop-db/password | Bitwarden or Vaultwarden; the field is password, username, notes, uri, totp or a custom field | KOMANDO_BW_EMAIL, KOMANDO_BW_PASSWORD (decrypts the vault here), KOMANDO_BW_SERVER for Vaultwarden or bitwarden.eu, optional API key KOMANDO_BW_CLIENT_ID/KOMANDO_BW_CLIENT_SECRET |
kdbx:~/team.kdbx#Servers/web1 | a KeePass or KeePassXC file (KDBX 3.1 and 4); #UserName or another field after the entry | KOMANDO_KDBX_PASSWORD and/or KOMANDO_KDBX_KEYFILE |
op://Vault/Item/field | 1Password, through a 1Password Connect server | OP_CONNECT_HOST, OP_CONNECT_TOKEN |
komando conn add prod-db postgres://app@10.0.0.5/shop --password-ref vault:secret/shop#db_password
komando talks to Vault, AWS, Google, Azure, Bitwarden, KeePass files and 1Password Connect itself: you do not need the vault, aws, gcloud, az, bw or op programs. It reads the value only when it needs it and never stores it. The login (and any MFA) stays with you.
Azure Key Vault. Write azure-kv:VAULT/NAME, where VAULT is the vault's name (shop-vault for shop-vault.vault.azure.net) or, in another Azure cloud, its whole host name (shop-vault.vault.azure.cn). komando tries these logins in order:
- a service principal:
AZURE_TENANT_ID,AZURE_CLIENT_IDandAZURE_CLIENT_SECRET; - a workload identity on AKS:
AZURE_TENANT_ID,AZURE_CLIENT_IDandAZURE_FEDERATED_TOKEN_FILE; - a token the Azure CLI saved on this computer (Linux and macOS), while it lasts: after
az login, runaz account get-access-token --resource https://vault.azure.netand komando can use that token for about an hour. komando does not runazand cannot renew the token; - the managed identity of the Azure machine komando runs on (
AZURE_CLIENT_IDpicks a user-assigned one).
AZURE_AUTHORITY_HOST picks another Azure cloud's sign-in host (https://login.microsoftonline.us, https://login.chinacloudapi.cn); any other host is refused, because the login goes there.
The login needs the "Key Vault Secrets User" role on the vault, or an access policy that allows Get on secrets.
Servers with no open SSH port (AWS SSM, GCP IAP, Cloudflare)
Some servers are reached through a cloud tool instead of a plain SSH port. Give komando that tool's command, as in OpenSSH's ProxyCommand (%h is the address, %p the port, %r the user):
komando host add web1 ec2-user@i-0abc123 --ssm # AWS Systems Manager: the address is the instance ID
komando host add web2 me@web2 --proxy-command 'gcloud compute start-iap-tunnel %h %p --listen-on-stdin --zone europe-west1-b'
komando host add db1 me@ssh.example.com --proxy-command 'cloudflared access ssh --hostname %h'
komando conn add prod-db postgres://app@mydb.xyz.rds.amazonaws.com/app --via web1 # a database behind it
A --proxy-command tool must be installed and logged in on this computer. On Windows the command runs in cmd.exe, so write it for cmd.exe. A proxy command runs on this computer, so an AI agent needs a person's yes to add or import one.
For --ssm, komando speaks AWS Session Manager itself when the aws CLI or its session-manager-plugin is not installed. It uses your usual AWS login (komando login aws for SSO). Set KOMANDO_EXPERIMENTAL=ssm to use the built-in client even when they are installed. Sessions that your account encrypts with KMS work too: komando asks KMS for the session key with your login, so that login needs kms:GenerateDataKey on the key, as the plugin does.
Server keys (host keys)
The first time komando connects to a server, it remembers the server's key (its fingerprint) in its own known_hosts. If the key changes later, komando refuses to connect (HOSTKEY_MISMATCH), because someone may be pretending to be your server.
That first time, nothing proves the key is really your server's. komando says on stderr which key it trusted:
komando: first connection to web1 (203.0.113.10:22): trusted its ssh-ed25519 host key SHA256:pVt2...
The audit log keeps it too (host.key-pinned in komando audit), and the JSON answer lists it in meta.host_keys_pinned, so an AI agent can show it to you. Compare that fingerprint with the server's own: run ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the server's console, or look in your cloud console (many show the host key fingerprints in the first boot log). If they differ, stop using the server and ask whoever runs it: someone may be in between.
Replace a key after a rebuild
After a real rebuild, check the new fingerprint another way (your cloud console or the server's own console), then replace the old key:
komando host trust web1 --reset --dry-run # how many pinned keys would go
komando host trust web1 --reset # shows the old and new key, asks once
Only a person at a terminal replaces a pinned key: komando shows the old and the new fingerprint and asks once. An AI agent or a script gets NEEDS_PERSON (exit 6) whatever flags it adds, because an agent that re-pins the key could be talking to an impostor; its hint names the command for you to run. Without --reset, host trust never adds a second key: a different key stops with HOSTKEY_MISMATCH, and a server that cannot be reached keeps its old key.
After you rebuild a whole group (same addresses, new keys), give host trust the group instead of one name. It takes every kind of target, like exec: @group, tag:, 'web*' or a,b.
komando host trust @web # new servers get pinned; changed keys are refused
komando host trust @web --reset # after the rebuild: one yes for all of them
data.results (in -o json) lists every server with its new fingerprint and, when the key changed, its old_fingerprints. With --reset you answer once: the question names every server whose key changes, with the start of its new fingerprint. Compare them with your cloud console first.
komando host rm does not forget a server's key. If you remove a server and add it again at the same address, it must still show the same key, so rm plus add is no way around HOSTKEY_MISMATCH. host rm says which keys it kept (host_keys_kept); after a rebuild, replace them with host trust --reset.
Pin a key before the first connection
komando host trust web1 (without --reset) pins a key before the first connection; the same key again changes nothing. The key is fetched the way komando reaches the server: directly, or through its --via path, VPN or proxy command.
To check every new server before komando uses it, refuse unknown keys and pin them one by one, comparing the fingerprint in each answer with the server's own first:
komando config set host_key_policy strict # unknown keys stop with HOSTKEY_UNKNOWN
komando host trust web1 # data.results[0] has key_type and fingerprint
When you already have the fingerprint (from the server's console or your cloud provider), let komando compare it for you: --fingerprint pins the key only when the server shows that one.
komando host trust web1 --fingerprint SHA256:pVt2... # pinned only if it matches
Any other key stops with HOSTKEY_MISMATCH (exit 4) and nothing is pinned; the message shows both fingerprints. Give the fingerprint of the key type the server offers (key_type in the answer; ssh-keygen -lf /etc/ssh/ssh_host_ed25519_key.pub on the server prints it). It takes one server, and its answer has expected_fingerprint next to fingerprint. The other rules stay: with strict, an AI agent's first pin still needs your yes, and replacing a pinned key still needs --reset at your terminal.
HOSTKEY_UNKNOWN says which fingerprint the server shows. With strict, an AI agent cannot pin a first key by itself: host trust needs your yes in komando's window, which shows the fingerprint to compare (with the default accept-new the first login pins it anyway).
Use OpenSSH with the same settings
host ssh-command prints the ssh command that reaches a server with the same address, user, key, known_hosts file and --via path komando uses:
komando host ssh-command web1
$(komando host ssh-command web1 -o text) # open a shell with OpenSSH
Servers behind --via get one ProxyCommand per hop, so each hop uses its own key. A SOCKS VPN becomes nc -X 5. VPNs that run inside komando cannot be used by OpenSSH; use komando shell SERVER for those.
A key made with komando key gen is sealed in komando's store and is never written to a file. For OpenSSH, host ssh-command gives it to the ssh-agent your shell already runs (SSH_AUTH_SOCK), which keeps it for one hour, and the printed line picks it with its public key. With no ssh-agent it stops with SSH_AGENT_NEEDED: start one with eval "$(ssh-agent)", or use komando shell SERVER.
Only a person at a terminal can run host ssh-command: it writes a copy of the pinned host keys for OpenSSH, in a private temporary folder (komando-ssh-*). A line printed more than a day ago may stop working: the next host ssh-command removes copies that old. An AI agent gets NEEDS_PERSON and is told to use komando exec or komando shell.
Limits
- A server name uses letters, digits,
.,_and-(see Targets). A server cannot be namedaws,gcporazure:komando login awsis the AWS login. --addressinhost editworks on one server only.- A key file added with
key addis never moved or deleted by komando. --ask-password,komando login,host ssh-commandand replacing a pinned host key (host trust --reset) need a person at a terminal.- A
--login askserver's password is typed by a person: a script, cron or CI job reaches it only through akomando logina person started, and its first connection needs a person at a terminal. A WinRM server has nokomando login. Only a person changes where it goes, or a server or VPN on its way, ordefault_userwhile a login-ask server has no user of its own. - What
--login askcannot stop. komando knows an AI agent only by its environment (CLAUDECODE,KOMANDO_AGENTand the like); a program that hides them is treated as a person. Any program of your user can draw a window that looks like komando's, replace the komando binary, or read the memory of a running komando. Type the password only into a window that a command you expected opened, and keep agents away from your account's files if that matters. On Windows, komando's password window is its approval window, so its buttons read Deny and "Allow once", and spaces around the password are dropped. op://reads 1Password only through a 1Password Connect server: the 1Password CLI is closed source, and komando uses only open-source parts.- The Azure CLI's saved token works for about an hour; komando does not run
azand cannot renew it. - A server that another server reaches through
--viacannot be removed until those servers change.
Troubleshooting
| Error code | What it means | What to do |
|---|---|---|
AUTH_FAILED | the server refused the login, or asked a question (a two-factor code) with no person at a terminal | check the user and password; for a code, run komando login SERVER once |
KEY_PASSPHRASE_REQUIRED | the key is encrypted and no ssh-agent holds it | ssh-add PATH, or store its passphrase and use --passphrase-ref |
HOSTKEY_MISMATCH | the server shows another host key than the pinned one: rebuilt, or someone is in between | check the fingerprint another way; after a real rebuild, komando host trust SERVER --reset in your own terminal |
HOSTKEY_UNKNOWN | host_key_policy is strict and this key is not pinned yet | compare the fingerprint, then komando host trust SERVER |
HOST_IN_USE | another server reaches this one through --via | change their --via first, or remove them in the same command |
VIA_CYCLE | the --via path leads back to itself, or names a step twice | name each server or VPN once, and not the server itself |
NAME_TAKEN | a rename would give two entries one name | pick other names, or rename or remove what is in the way |
VPN_IN_USE | a rename needs a connected VPN to go down | komando vpn down NAME first |
KEY_IN_USE | key rm on a key a server still uses | give the server another key: komando host edit SERVER --key OTHER |
KEY_EXISTS | key gen, key add or key rename to a name that is taken | choose another name, or komando key rm NAME first |
SECRET_DESTINATION | an AI agent asked to send a password to a server | a person allows it in komando's window |
SECRET_UNRESOLVED | komando could not read a reference (no login for the password manager, or no such secret) | follow the hint: it names the logins that work |
SSH_AGENT_NEEDED | host ssh-command for a key komando made, with no ssh-agent running | eval "$(ssh-agent)", or use komando shell SERVER |
NEEDS_PERSON | only a person at a terminal can do this (host trust --reset, host ssh-command), or a --login ask server's password and nobody can type it, or its first connection (a host key nobody has logged in with), or an AI agent changed where its password goes (its address, port, user, --via, proxy command, a server or VPN on its way) | run the command in your own terminal, or komando login SERVER once |
DECLINED | the person cancelled the password window of a --login ask server (or did so less than a minute ago) | a person runs komando login SERVER |
NEEDS_PERSON | komando login without a person at a terminal (an AI agent or a script) | a person runs komando login SERVER |
IMPORT_INCOMPLETE | some servers were not imported (listed under skipped) | fix them in the source and import again |
Source: docs/features/servers.md in sgnd/komando at commit b622784.