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
本文介绍了如何在Linux中增加SSH连接超时的方法。通过在客户端的~/.ssh/ssh_config文件中添加ServerAliveInterval 20和ServerAliveCountMax 100,或者在命令行中使用相应选项,可以保持SSH连接活跃。此外,服务器端可以通过设置TMOUT变量(例如TMOUT=600,即10分钟)来延长SSH会话的存活时间。如果需要更长的超时,可以调整TMOUT的值。这些步骤有助于避免SSH连接因无活动而断开。
3981

被折叠的 条评论
为什么被折叠?



