SSH Timeout Auto Disconnect problem Resolution

Source: Internet
Author: User
Tags ssh secure shell

Resolve the problem of automatic disconnection by modifying the configuration in/etc/ssh/sshd_config. The following are the meanings of the two configuration items that you want to modify:

"Clientaliveinterval specifies a server-side time interval for requesting messages from the client, which defaults to 0 and does not send. and Clientaliveinterval 60 is sent every minute, then the client responds, so the long connection is maintained. Here's the weird part: Not the client initiates the request to maintain the connection (such as Fterm, cterm, etc.), but requires the server to take the initiative first.

In addition, as for Clientalivecountmax, the default value of 3 can be used. Clientalivecountmax indicates that the number of times the client does not respond after a request has reached a certain value and is automatically disconnected. Under normal circumstances, the client will not be unresponsive. “

1 View current configuration

grep "Clientalive" Sshd_config

#ClientAliveInterval0

#ClientAliveCountMax3

2 Backing up the original file

CP Sshd_configsshd_config.bak

3 Modifying the configuration file

Sed-i "s/#ClientAliveInterval 0/clientaliveinterval 60/g" Sshd_config

Sed-i "s/#ClientAliveCountMax3/clientalivecountmax 3/g" Sshd_config

4 Verifying the modification results

grep "Clientalive" Sshd_config

Diff Sshd_configsshd_config.bak


5 Restart Service

Service Sshdrestart

The SSH client is not automatically disconnected for as long as it is idle.

reference materials

How to avoid SSH Secure Shell client link Linux timeout, automatic disconnect.

http://hbwanghai.blog.163.com/blog/static/1992971472012224105110918/

SSH timeout (SSH timeout) solution

http://www.yaozer.cn/ssh-%E8%B6%85%E6%97%B6ssh-timeout-%E8%A7%A3%E5%86%B3%E5%8A%9E%E6%B3%95/

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.