On the remote host, look for
in ~/.bashrc or other system profile file, or...(.profile, etc.)
Locally, I use
Code:
.ssh/config
Host *
ServerAliveInterval 120
ServerAliveCountMax 30
ConnectTimeout 30
I stay connect for days of 'inactivity'.
Hope that helps.
Another trick is to run something indefinately, like
and the system thinks you are doing stuff, so TMOUT won't kick in.