Anatomy of a complete Host block
Every directive you'll commonly use, in one place. Most blocks need only a subset, but knowing what's available prevents reinventing wheels.
The directives that matter most day-to-day
| Directive | Purpose |
|---|---|
HostName | Actual address (IP or FQDN) |
User | Remote username |
Port | SSH port (default 22) |
IdentityFile | Path to the private key |
IdentitiesOnly | Don't try every key in agent — only IdentityFile |
ForwardAgent | Forward your agent (default: no, keep it that way) |
ProxyJump | Hop through this host first (next lessons) |
Compression | Compress on slow links (off on fast LAN) |
ServerAliveInterval | Keepalive every N seconds |
ServerAliveCountMax | Disconnect after N missed keepalives |
AddKeysToAgent | Auto-add used keys to agent |
UseKeychain | macOS — pull passphrase from Keychain |
ControlMaster / Path / Persist | Multiplex connections (later lesson) |
Indentation is convention, not rule
SSH parses the file fine without indentation, but indented blocks are dramatically more readable when you have 20 hosts. Pick a style and stick with it.