Solve the Problem of automatic SSH disconnection

Source: Internet
Author: User

Solve the Problem of automatic SSH disconnection

When you connect to the remote SSH service, frequent disconnection occurs after a long time, or no response (no keyboard input is allowed ).
In general, there are two methods:

1. periodically send heartbeat requests depending on the ssh client.
Putty, SecureCRT, and XShell all have this function, but they are not safe.

In addition, in Linux:

# Open
Sudo vim/etc/ssh/ssh_config
# Add
ServerAliveInterval 20
ServerAliveCountMax 999

That is, a heartbeat is sent to the server every 20 seconds. If more than 999 requests are not sent successfully, the connection to the server is automatically disconnected.

2. the more permanent way is to change the server end, that is, on the remote end of ssh.

# Open
Sudo vim/etc/ssh/sshd_config
# Add
ClientAliveInterval 30
ClientAliveCountMax 6

ClientAliveInterval indicates the number of seconds each other. The server sends a heartbeat message to the client.

The following ClientAliveInterval indicates the number of Heartbeat requests that have no response, and the Client is considered disconnected.

Therefore, the total time allowed for no response is 60*3 = 180 seconds.


Effective Test

SSH service remote access to Linux Server login is slow

How to Improve the SSH login authentication speed of Ubuntu

Enable the SSH service to allow Android phones to remotely access Ubuntu 14.04

How to add dual authentication for SSH in Linux

Configure the SFTP environment for non-SSH users in Linux

Configure and manage the SSH service on Linux

Basic SSH tutorial

SSH password-free logon details

This article permanently updates the link address:

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.