Solve ssh automatic disconnection Problems

Source: Internet
Author: User

By default, ssh will be automatically dropped when it is not operated for a period of time. After checking the information, you will find that the following parameters can be modified to solve the disconnection problem.

# Vi/etc/ssh/sshd_config # TCPKEEP = YES # ClientAliveInterval 15 # ClientAliveCountMax 45

Restart sshd service

#/Etc/init. d/sshd restart

ClientAliveInterval sets the length of time in seconds. If no data is received from the client after such a long time,
Sshd sends an "alive" message to the client through the Secure Channel and waits for a response.
The default value 0 indicates that the "alive" message is not sent. This option is only valid for the SSH-2.

The maximum number of "alive" messages that ClientAliveCountMaxsshd can send before receiving any client response. The default value is 3.
When this limit is reached, sshd will force disconnect and close the session.

Note that the "alive" message is very different from the TCPKeepAlive message.

"Alive" messages are sent through encrypted connections, so they are not spoofed. However, TCPKeepAlive messages can be spoofed.

If the ClientAliveInterval is set to 15 and the ClientAliveCountMax is kept as the default value, the client that does not respond will be forcibly disconnected after 45 seconds. This directive can only be used for SSH-2 protocols.

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.