Solve the problem of automatic disconnection of Alibaba Cloud server's short-term connection

When logging in to the Alibaba Cloud server using SSH remote commands or remote tools, ssh [email protected].* , it is often found that the client is dropped by the server after the SSH connection. Generally, it is because the SSH connection is not set to keep alive

There are two solutions: 1. Set SSH client keep-alive, 2. Or set SSH server keep-alive

1. Set the SSH server keep alive, the specific method is as follows:

1. Modify the configuration file

vim /etc/ssh/sshd_config

ClientAliveInterval  60      // 每隔60S向客户端发送请求消息,并等待客户端响应
ClientAliveCountMax  10   // 客户端超过十次没响应,自动断开(即10分钟)

2. Restart the SSH service

systemctl restart sshd

2. Set client keep-alive (secureCRT)

After using SecureCRT to connect remotely, select (O)->Session Options(S)->Terminal->Send Protocol NO-OP(P)->Set Time (seconds)->OK

Guess you like

Origin blog.csdn.net/l_liangkk/article/details/105314036