To pretty much completely disable SSH timeouts, simply adjust the following directives in /etc/ssh/sshd_config:
TCPKeepAlive yes ClientAliveInterval 30 ClientAliveCountMax 99999
EDIT: Once that's changed, be sure to restart your ssh daemon.
SECURITY WARNING: If you remove users from your system, but they're still connected via ssh, their connection may remain open indefinitely. Be sure to check all active ssh sessions after adjusting a user's access.












Then restart SSHD?
Good point, Kyle. That certainly would be helpful.
Thanks,
This is perfect...just what I needed for the mother of all XSL translations!
It makes me crazy when things like this aren't included in the config files... at least commented out. Thanks for the info.
I think you only want keep-alive set iff you have network address translations that expire in a short time (like an hour), which many firewalls will do.
Otherwise, WITHOUT keepalive, I've gone to work with my laptop, come back to my home network, hit enter and have my ssh connection still be there. With keepalive on, it will die as soon as it tries to send a packet and the network isn't there (like as soon as you bring it out of standby/hibernate and the time expires and the network connection isn't up yet).
If you are ssh-ing through a VPN tunnel you should NOT use this. If the VPN goes down, your ssh connection will die when a keepalive packet is sent. Otherwise, it can be down indefinitely, then brought back and have ssh be okay.
If your firewall expires idle connections, then go ahead and use. Otherwise, it will just ensure that your connection dies sooner.
In either case, be sure to run screen on the remote server--then you can resume your login connection from anywhere and not worry about it.