Skip to main content

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

SettingDescription
ControlMaster autoReuse an existing session for multiple SSH connections to the same host
ControlPathSocket file path used for session sharing
ProxyCommandTunnel configuration through a jump host
StrictHostKeyChecking noSkip the known_hosts check on the first connection (convenience)
UseKeychain yesStore the passphrase in the macOS Keychain