wormhole ssh: have send-key write the client's ~/.ssh/config entry (after exchange of host/user info)

Author: bphdCreated Aug 27, 2026Updated Aug 27, 2026

Problem

wormhole ssh send-key / accept-key automates only half of the key setup: the public key lands in the server's authorized_keys, but the client side is left unfinished:

  1. If the key uses a non-default filename (e.g. id_ed25519_foo), ssh never offers it automatically — it only auto-tries id_rsa, id_ecdsa, id_ed25519, and the _sk variants.
  2. The user must manually discover this and hand-write a ~/.ssh/config block (Host, HostName, User, IdentityFile, IdentitiesOnly) before the passwordless login actually works.

So after running the "friction removal" step, the user still types passwords and gets no indication of what remains to be done.

Proposal

The wormhole channel is bidirectional, so accept-key could send back the information send-key needs — the login username and a suggested hostname/address — and send-key could then offer to append a config stub:

Host <suggested-alias>
    HostName <host>
    User <user>
    IdentityFile ~/.ssh/<key-name>
    IdentitiesOnly yes

Notes on safety:

  • Append-only; never rewrite existing Host blocks. If a Host stanza for that alias/hostname already exists, skip or print the suggested block for manual review instead.
  • Prompt before writing, with a --no-config opt-out flag (and/or a --config-alias <name> flag to choose the alias).
  • A ~/.ssh/config.d/ drop-in file could be an alternative to editing the main config, for users whose main config has Include config.d/*.

Even a minimal version — printing the suggested block with a "paste this into ~/.ssh/config" hint, when the key has a non-default name — would remove most of the confusion.

Current workaround

Manually adding to ~/.ssh/config:

Host mybox
    HostName myip
    User myuser
    IdentityFile ~/.ssh/id_ed25519_foo
    IdentitiesOnly yes

Source: magic-wormhole/magic-wormhole