一、修改配置文件
cp /etc/ssh/sshd_config{,.bak} #备份
vim /etc/ssh/sshd_config
UseDNS 改为 no
GSSAPIAuthentication 改为 no
systemctl restart sshd
二、重启systemd-logind
systemctl restart systemd-logind
问题1:ssh连接很慢
解决方案:
这是应为linux系统默认开启DNS认证,我们关掉即可。
vim /etc/ssh/sshd_config
UseDNS yes 改为no(122行左右);
GSSAPIAuthentication yes改为no(81行左右)
然后重启sshd服务
service restart sshd;
问题2:ssh连接突然就卡断了
解决方案:
这个是 linux 的安全问题,如果 60s 内没用任何数据,将会自动断开。
vim /etc/ssh/sshd_config
#添加
ServerAliveInterval 50
ServerAliveCountMax 3
vim /etc/ssh/sshd_config
#添加
ClientAliveInterval 50
ClientAliveCountMax 3
未经允许不得转载:OZ分享-吉家大宝官方博客 » ssh(或sftp)连接慢或sftp链接缓慢问题问题解决