Way to prevent SSH sessions from timing out?
Thanks.
2 Replies
There's 2 suggestions, and two ways to adjust timeout. My first suggestion is to not use SSH in the first place but a tool called MoSH
Now if you don't want to install anything else, you can adjust timeouts both server side and client side. Server side, in /etc/ssh/sshd_config you should make sure the following is set:
TCPKeepAlive yes
ClientAliveCountMax 99999
ClientAliveInterval 30
Client side, you should have the following set in ~/.ssh/config:
ServerAliveInterval 100
For both ServerAliveInterval or ClientAliveInterval, this is telling SSH how often is should poll the connection, preventing the connection from timing out. ClientAliveCountMax is how many times to poll before considering the client dead.
I hope that helps.