Skip to content

Instantly share code, notes, and snippets.

@felixhummel
Last active November 2, 2017 11:37
Show Gist options
  • Save felixhummel/5e899c1e9bf9837d8639 to your computer and use it in GitHub Desktop.
Save felixhummel/5e899c1e9bf9837d8639 to your computer and use it in GitHub Desktop.
Useful defaults and example for ~/.ssh/config
# keep connections alive
ServerAliveInterval 60
# re-use connections to the same host
ControlMaster auto
# leave connection open in background
ControlPersist 4h
ControlPath /tmp/%r@%h:%p
# use `ssh -o ControlPath=none` to disable this temporarily
# and to close this: `ssh -O exit`
# example entry
Host enterprise
Hostname 10.1.1.1
User picard
Port 1701
IdentityFile ~/.ssh/picards_id
# use `enterprise` as proxy and the local IdentityFile (shuttle.lan is reachable from enterprise)
# Warning: Use with care (see ForwardAgent in `man ssh_config`)
Host shuttle
Hostname shuttle.lan
ForwardAgent yes
ProxyCommand ssh -qW %h:%p enterprise
# forward something reachable via enterprise (e.g. curl 10.2.2.2:8080)
# Use `ssh -N enterprise-warpdrive`
Host enterprise-warpdrive
Hostname 10.1.1.1
LocalForward 127.0.0.1:9090 10.2.2.2:8080
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment