preface
As we all know, when we log in to another server remotely via SSH, if we do not do any operation for a long time, the server will automatically log out and tell you timed out waiting for input: auto-logout. If we don't use tmux to maintain the session, then we need to modify the server's logout time to prevent automatic logouts.
Modify the steps
First, let's take a look at what the auto-logout time on the server is:
If nothing is output, then your server will not be automatically logged out
If there is an output in the previous step, such as 600, it means that your server's automatic logout time is 600s, which is 10 minutes. This value is usually defined in the configuration files of the system environment such as /etc/profile, /etc/bashrc, or ~/.bash_profile, ~/.bashrc.
It is worth noting that the values defined in these files in the home directory will override the values defined in the following files in /etc, for example, the TMOUT variable in ~/.bash_profile will override the TMOUT variable in /etc/profile
Let's modify the value of TMOUT as needed:
TMOUT=600 #表示10分钟之后自动登出 TMOUT= #表示关闭自动登出 It is worth noting that there should be no spaces left and right of the equal sign
After the changes are made, for example, if we are modifying the ~/.bash_profile file, if we want the changes to the configuration file to take effect immediately, we need to execute the following code:
Or log out and log in again.
|