unix / ssh

I reach my VMs and Git hosts over SSH. ~/.ssh/config shortens the commands.

Keys

I use one Ed25519 key pair:

ssh-keygen -t ed25519 -C "[email protected]"

The public half, ~/.ssh/id_ed25519.pub, goes on the server in ~/.ssh/authorized_keys or the provider's UI. The private half stays on my laptop.

Host aliases

Without config, each command repeats the IP, user, and key:

ssh -i ~/.ssh/id_ed25519 croaky@203.0.113.10

A Host block in ~/.ssh/config shortens that to ssh cibot-farmer:

Host cibot-farmer
  HostName 203.0.113.10
  User croaky
  IdentityFile ~/.ssh/id_ed25519

scp and rsync accept the alias:

scp ./cibot cibot-farmer:/tmp/cibot

Splitting config

My dotfiles are public, so ~/.ssh/config holds only safe defaults. Machine-specific hosts live in files it includes:

# ~/.ssh/config
Include ~/.ssh/config.private*

I keep the VM aliases in ~/.ssh/config.private_cibot, outside the repo. SSH ignores a config file that is group- or world-readable, so I chmod 600 it.

I automate the rest of my machine setup in cmd / laptop.

← All articles