SSH-CONFIG(7)Miscellaneous Information ManualSSH-CONFIG(7)

ssh-config — short names for your VMs, scp, rsync and forwarding

Everything goes through ssh(1), so ssh_config(5) is the place to pin the key and give VMs short names:

Host chroot.dev chroot.run
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_ed25519

Host web
    HostName chroot.run
    User vm+web
    IdentitiesOnly yes
    IdentityFile ~/.ssh/id_ed25519

Every ssh chroot.dev command opens a new connection: about 11 round trips to the host before the command runs, 1.7 s from 150 ms away. With ControlMaster, ssh(1) keeps the first connection open and runs the next commands over it, in about 2 round trips each:

Match host chroot.dev,chroot.run
    ControlMaster auto
    ControlPath ~/.ssh/cm-%C
    ControlPersist 10m

Match host checks the name after HostName, so it covers Host web above as well. chroot.dev and each VM keep a connection of their own, open for 10 minutes after the last command; close one sooner with ssh -O exit chroot.dev.

The usual tools then work with the short name:

$ ssh web
$ scp site.tgz web:
$ rsync -a --rsync-path='doas openrsync' \
    public/ web:/var/www/htdocs/
$ ssh -L 5432:127.0.0.1:5432 web

ssh(1), ssh_config(5), account(7), website(7)

chroot.devOctober 10, 2026SSH-CONFIG(7)