Solve the problem of slow ssh (or sftp) connection

Problem 1: ssh connection is very slow

Solution:
This is to turn on the DNS authentication by default for the Linux system, and we can turn it off.

 vim   /etc/ssh/sshd_config
 UseDNS  yes 改为no(122行左右);
 GSSAPIAuthentication  yes改为no(81行左右)

Then restart the sshd service
service restart sshd;

Problem 2: The ssh connection is suddenly broken

Solution:
This is a security problem of Linux. If no data is used within 60s, it will be automatically disconnected.

 vim /etc/ssh/sshd_config
#添加
ServerAliveInterval 50
ServerAliveCountMax 3
vim /etc/ssh/sshd_config
#添加
ClientAliveInterval 50
ClientAliveCountMax 3 

Guess you like

Origin blog.csdn.net/sun172270102/article/details/106496587