In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-20 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
It is believed that many inexperienced people have no idea about how to solve the problem of disconnection caused by idle time after ssh login for too long. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.
Fixed disconnection caused by too long idle time after ssh login
When we connect to the server through the terminal, when the mouse and keyboard are not operated for a long time, the server will automatically disconnect, we still need to reconnect, feel very troublesome, summarize the way to solve this problem
Method 1.
Modify the / etc/ssh/sshd_config configuration file and find ClientAliveCountMax (in minutes) to modify the value you want
Execute service sshd reload
Method 2.
Find the .ssh directory of the user, such as the root user, which is located at:
/ root/.ssh/
Create a config file in this directory
Vi / root/.ssh/config
Add the following sentence:
ServerAliveInterval 60
Save exit, restart the shell of the root user, and then when you ssh the remote server
It will not be disconnected because of long-term operation. After adding this sentence, the ssh client will every other
Automatically communicate with the ssh server once in a period of time, so long-term operations will not be disconnected.
Method 3.
Modify / etc/profile configuration file
# vi / etc/profile
Added: TMOUT=1800
In this way, it will automatically LOGOUT without operation for 30 minutes.
Method 4.
Use expect to simulate keyboard action, simulate a keyboard response during idle time, save the following code as xxx, and then execute it with expect
#! / usr/bin/expect
Set timeout 60
Spawn ssh user@host
Interact {
Timeout 300 {send "\ x20"}
}
Expect xxx
Then follow the prompt to enter the password, so that every 300 seconds will automatically type a space (\ x20), the specific time interval can be set on a case-by-case basis.
Method 5.
If you connect through a tool under windows, you can set it to
SecureCRT: option-terminal-anti-idle setting how many seconds to send a string, or NO-OP protocol packet
Putty:putty-> Connection-> Seconds between keepalives (0 to turn off), default is 0, changed to 300.
MobaXterm: "Enable SSH keepalive" box under "Settings"-> "Configuration"-> "SSH" tab.
Enabling this option will ensure that the connection is kept "fresh" in the device's connection table.
If you use windows, all ways must be built on your windows does not automatically hibernate, hehe otherwise everything is fake.
After reading the above, do you know how to solve the problem of disconnection caused by too long idle time after ssh login? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.