In this tutorial, we will learn how to increase SSH Connection Timeout value in Linux.
Here are the steps to increase SSH connection timeout.
Create a user ssh configuration file if it doesn't exist on the client
Add two lines to file ~/.ssh/config on the client
Change the user timeout value through the TMOUT variable on the server
Check TMOUT value on the server
These are the commands we can run on the client-side.
touch ~/.ssh/config
cat << EOF >> ~/.ssh/config
host *
ServerAliveInterval 20
EOF
The following are the commands we need run on the server-side.
TMOUT=600
export TMOUT
echo $TMOUT
Now the current ssh connection timeout is 10 minutes (600 seconds). We can increase this value if needed.
We can check the detailed info about how to increase SSH timeout value in Linux here.