Recommended Steps to increase SSH connection timeout
We can use the following way to increase the SSH connection timeout in Linux.
- add ServerAliveInterval 20 and ServerAliveCountMax 100 on
client-side in file ~/.ssh/ssh_config or we can add them to
command line like this $ ssh -o ServerAliveInterval=20 -o
ServerAliveCountMax=100 user@example.com - change TMOUT variable on server-side with the following command.
Commands to change TMOUT value on server side
- TMOUT=600 (this is 10 minutes).
- export TMOUT
- echo $TMOUT
This will keep the SSH connection alive for 10 minutes. We can change TMOUT value for a longer SSH connection timeout value if needed.
Related:
Increase Linux SSH Connection Timeout Quick Guide
Recommended Steps to increase SSH connection timeout