Skip to content

Log in to a VM from your laptop with ssh, scp and rsync. Your VM accepts the public keys of your organization, and password login is off.

A key is one public key line from a .pub file, and it belongs to the organization, not a project. Ed25519 and ECDSA keys, their security-key forms, and RSA keys of at least 2048 bits are accepted. The name is optional; without one, the key’s comment is the name, else its type.

  1. Open SSH keys.
  2. Select Add SSH key.
  3. Paste the contents of a .pub file, such as ~/.ssh/id_ed25519.pub, into Public key.
  4. Enter laptop in Name.
  5. Select Add SSH key. The dashboard says SSH key added.

A new VM gets every key of the organization at its first start. The guest writes them once to ~/.ssh/authorized_keys. After that the file is the VM’s; the API and the node do not change it again. A VM that started before you added the key gets nothing, so append the line on that VM:

Terminal window
OLD_VM=7a2b3c4d5e
si exec $OLD_VM -c 'mkdir -p -m 700 ~/.ssh && cat >> ~/.ssh/authorized_keys >/dev/null && echo appended' < ~/.ssh/id_ed25519.pub
Output
appended

List returns every key of the organization, oldest first. Each key has a name, type, fingerprint, who added it and when. The API returns [] when the organization has no keys.

  1. Open SSH keys.
  2. The table lists every key with Name, Fingerprint and Added. The type and who added it appear under the name.

Port 22 is served by the default image; a VM of the postgres image has no SSH server. A stopped VM starts on its first connection.

  1. Open SVMs and select your VM.
  2. Select Overview.
  3. Under SSH, copy the Forward the port command and run it in a terminal on your laptop. Keep that terminal open.
  4. Copy the Connect command and run it in a second terminal.

With devbox, the commands are si port forward devbox 22:2222 and ssh -p 2222 user@127.0.0.1.

An open SSH session keeps the VM awake, so close it when you are done. scp and rsync work with the same host name.

Delete stops new VMs from getting the key. Existing VMs that have it keep it in their own ~/.ssh/authorized_keys, so remove the line there as well. The API names the key by its id; si org ssh-key rm also takes its fingerprint or name. devbox keeps it until you delete the VM.

  1. Open SSH keys.
  2. Select More actions on laptop.
  3. Select Delete. The dashboard removes the key after five seconds; select Undo to keep it.
Terminal window
si rm devbox
Output
deleted 6f1c0f0e8a
Field Type Default Allowed values What it changes
public_key string Required One <type> <base64> [comment] line; Ed25519, ECDSA, their security-key forms, or RSA of at least 2048 bits The key that new VMs accept.
name (--name) string The key comment, else its type 1 to 100 characters, no line break The name that lists show and si org ssh-key rm accepts.
id (path, <KEY> in the CLI) string Required A key id from the list; the CLI also takes its SHA256: fingerprint or name The key that delete removes.

Scroll horizontally to see all columns.

Code When Fix
invalid_ssh_key Add sends text that is not one public key line. Send one line from a .pub file.
private_key Add sends the private half of a key. Send the .pub file, and replace the private key if you shared it.
unsupported_key_type Add sends DSA or another unsupported type. Use Ed25519, ECDSA, a security key, or RSA of at least 2048 bits.
rsa_key_too_short Add sends an RSA key below 2048 bits. Create an Ed25519 key, or an RSA key of at least 2048 bits.
invalid_name Add sends a name with a line break. Send the name on one line.
key_exists Add sends a key the organization already has. Use the existing key, or delete it first.
ssh_key_limit Add would make the 51st key. Delete a key, or ask about your plan.
ssh_key_not_found Delete names no key of the organization. List the keys and use the id.
not_supported_by_image A port 22 request names a VM of an image without SSH, such as postgres. Use a VM of the default image.

Scroll horizontally to see all columns.

Errors that any request can return are in the error catalog.

Operation Who can Key action
Add an SSH key Any member svm:write
List SSH keys Any member svm:read
Delete an SSH key Any member svm:write
Connect to a VM Any member None

Scroll horizontally to see all columns.

  • An organization holds 50 keys. The 51st add answers 409 ssh_key_limit.
  • A key name has 1 to 100 characters and no line break.
  • Ed25519 and ECDSA keys, their security-key forms, and RSA keys of at least 2048 bits are accepted. DSA is not.
  • Port 22 is served by the default image only. A VM of the postgres image has no SSH server.
  • A VM gets the organization’s keys once, at its first start. A key added later adds no line to an existing VM.
  • Deleting a key leaves one line in the authorized_keys of every VM that already has it; remove it there as well.

The full list is in Limits.

  • VMs: create, start and delete the VM you log in to.
  • Private network: reach a VM by name from your other VMs and your tailnet.
  • Sleep and wake: keep a VM reachable with the on policy.