ssh timeout fix
by z3n on Dec.25, 2009, under Linux Happyness
Problem:
When using regular linux ssh it keeps timeouting or simply freezes when no inputs/outputs happen.
Solution:
Usually ssh has a TCP keep alive switch which you can enable to avoid this, although depending on your router and other network odds this might not help, also you may need to send keep alives in a shorter time than what’s the default of ssh. So, in order to have this working you need to edit /etc/ssh/ssh_config adding this to Host *, assuming you want to have this settings globally for every host.
ServerAliveInterval 60
ServerAliveCountMax 99999999999999
Why so many 9’s? There’s no way to do a endless keep alive, if you put 0 it will just drop the connection after the first keep alive, -1 is invalid, so we go high…….