This article is a mirror article of machine translation, please click here to jump to the original article.

View: 19708|Reply: 2

[linux] Modify the time when SSH automatically logs out when it times out

[Copy link]
Posted on 9/9/2016 4:20:20 PM | | | |
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.




Previous:c#/.net Alibaba Cloud ID card identification source code
Next:Using the netsh Command to Manage IP Security Policies (1)
Posted on 9/9/2016 7:48:43 PM |
Is he the senior of the Planning Association? Can I leave a QQ?
 Landlord| Posted on 9/9/2016 10:45:50 PM |
testonce posted on 2016-9-9 19:48
Is he the senior of the Planning Association? Can I leave a QQ?

What are you talking about?
Disclaimer:
All software, programming materials or articles published by Code Farmer Network are only for learning and research purposes; The above content shall not be used for commercial or illegal purposes, otherwise, users shall bear all consequences. The information on this site comes from the Internet, and copyright disputes have nothing to do with this site. You must completely delete the above content from your computer within 24 hours of downloading. If you like the program, please support genuine software, purchase registration, and get better genuine services. If there is any infringement, please contact us by email.

Mail To:help@itsvse.com