Proxy (Jump Host) & Resolving SSH Known Host Errors
A well-configured ~/.ssh/config file can cleanly resolve most SSH connection problems.
Configuration example
# opc_mx → server accessed through the bastion
Host opc_mx
HostName server_~~~
User opc
# ============================
# Proxy server & defaults
# ============================
# BASTION: jump host (external access gateway)
Host BASTION
HostName IP_ADDRESS
User opc
Port 9129391239
IdentityFile ~/.ssh/id_ed25519
# Hosts matching proxy_* and opc_*: connect through the bastion
Host proxy_* opc_*
# Improve connection speed through session sharing when matching multiple hosts
ControlMaster auto
ControlPath ~/.ssh/%r@%h:%p
IdentityFile ~/.ssh/id_ed25519
# Use the bastion as a jump host
ProxyCommand ssh -W %h:%p BASTION
# Defaults (applied to all hosts)
Host *
UseKeychain yes
# Disable StrictHostKeyChecking: ignore known host warnings
StrictHostKeyChecking no
AddKeysToAgent yes
IdentityFile ~/.ssh/id_ed25519
Key configuration settings
| Setting | Description |
|---|---|
ControlMaster auto | Reuse an existing session for multiple SSH connections to the same host |
ControlPath | Socket file path used for session sharing |
ProxyCommand | Tunnel configuration through a jump host |
StrictHostKeyChecking no | Skip the known_hosts check on the first connection (convenience) |
UseKeychain yes | Store the passphrase in the macOS Keychain |