Skip to content

Instantly share code, notes, and snippets.

@lukechampine
Created November 21, 2018 22:29
Show Gist options
  • Save lukechampine/fc9abbce332a79935ad391d1c35334b4 to your computer and use it in GitHub Desktop.
Save lukechampine/fc9abbce332a79935ad391d1c35334b4 to your computer and use it in GitHub Desktop.
# ssh config to connect to a host via local network if available.
#
# For example, if the host is 192.168.1.10 on your local network,
# first run ssh-keyscan 192.168.1.10 to see what keys are available,
# then substitute that key for your_host_key (-t selects the key type).
Match exec "ssh-keyscan -T 1 -t ed25519 local.ip.for.host 2>/dev/null | grep -F your_host_key" host yourhostname
Hostname local.ip.for.host
Port 22
Host yourhostname
Hostname external.ip.for.host
Port 1234
# Additional shared config options here...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment