3 ms·
I've run into a few local networks that have routers, or other network security appliances, that are configured in such a way where my SSH connection would get
by adanto6840 14y ago
I've run into a few local networks that have routers, or other network security appliances, that are configured in such a way where my SSH connection would get dropped after XX seconds of inactivity.
Placing the following wildcard entry in my SSH config resolved the issue for those times when I had to use one of these networks...
# Set Global KeepAlive to avoid timeouts
Host *
ServerAliveInterval 240
- lostapathy 14y agoCaveat, though, is that this will force connections to break if you have a transient network outage that SSH could otherwise cope with. Which can be annoying if you're somewhere with a flaky connection. Putting it on the specific hosts you need rather than globally keeps it from causing you grief anywhere you don't need it.
- beagle3 14y agoWhile that's true, it tries 3 times (default) before it gives up - so, setting to 240 would require 12 minutes of no connection before disconnecting. In any environment that I've been working in recently, if I lose connection for more than 5 minutes, I've lost it for far longer - I might as well break and reconnect anyway.