Skip to content

Instantly share code, notes, and snippets.

@konobi
Created March 11, 2010 20:28
Show Gist options
  • Save konobi/329608 to your computer and use it in GitHub Desktop.
Save konobi/329608 to your computer and use it in GitHub Desktop.
# In .ssh/config:
Host *
ControlMaster no # Connections by default are not a master
ControlPath ~/.ssh/master-%r@%h:%p
ServerAliveInterval 60
ServerAliveCountMax 60
# On normal connections, if there is no master running on the ControlPath it will behave as normal
ssh some.host
# Run autossh (ftp://ftp.sunfreeware.com/pub/freeware/SOURCES/autossh-1.4b.tar.gz)
autossh -f -M 0 -N -o "ControlMaster yes" some.host
# This will setup a daemon that will maintain a "Master" connection to some.host
# Now ssh will use that master channel to connect to some.host
ssh some.host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment