SSH (OpenSSH) 10 cheatsheet

SSH (OpenSSH) 10: ~/.ssh/config

5 common SSH (OpenSSH) 10 tasks.

Define a host alias

Connect with ssh web instead of the long form.

Host web
    HostName example.com
    User deploy
    Port 2222
    IdentityFile ~/.ssh/id_ed25519
    IdentitiesOnly yes

Configure a jump host

Always reach a private server through the bastion.

Host internal
    HostName 10.0.0.5
    User deploy
    ProxyJump bastion

Host bastion
    HostName bastion.example.com
    User deploy

Keep idle connections alive

Send a keepalive every minute so idle sessions don't drop.

Host *
    ServerAliveInterval 60
    ServerAliveCountMax 3

Reuse connections for speed

Share one connection between sessions, which makes repeated ssh and scp commands fast.

Host *
    ControlMaster auto
    ControlPath ~/.ssh/cm-%r@%h:%p
    ControlPersist 10m

Use a specific key for GitHub

Use a dedicated key for one service.

Host github.com
    User git
    IdentityFile ~/.ssh/github_ed25519
    IdentitiesOnly yes

Was this page helpful?