SSH 变慢的各种情况 及 解决方案

 可使用ssh -v yourip 查看什么地方慢的。

0000000000000000000000000000000

最近发现ssh连接的时候却很慢,ping的速度非常好,让人误以为是ssh连接不上。

分析结果,主要原因为:DNS的解析IP导致,可分别使用以下几种分析处理方式

1、在server上/etc/hosts文件中把你本机的ip和hostname加入 

2、在server上/etc/ssh/sshd_config文件中修改或加入UseDNS=no 

3、注释掉server上/etc/resolv.conf中不使用的IP所有行 

4、修改server上/etc/nsswitch.conf中hosts为hosts:files

5、authentication gssapi-with-mic也有可能出现问题,在server上/etc/ssh/sshd_config文件中修改 GSSAPIAuthentication no。/etc/init.d/sshd restart重启sshd进程使配置生效。

如之前为服务器配置了双网卡,使的在/etc/resolv.conf文件中多了一行目前不使用的IP地址。注释或者删除该行即可。大多数情况修改1和5两项即可解决问题

1111111111111111111111111111111

Warning: No xauth data; using fake authentication data for X11 forwarding.

Warning: untrusted X11 forwarding setup failed: xauth key data not generated

的解决办法:

Warning: No xauth data; using fake authentication data for X11 forwarding

Issues:
hosta you ~: ssh hostb
 Warning: No xauth data; using fake authentication data for X11 forwarding

Simple Solutions:
solution a) adding the following line into you@hosta:~.ssh/config
ForwardX11Trusted yes

solution b) adding the following line into you@hosta:~.ssh/config
ForwardX11 no

solution c) invoking ssh as "ssh -Y"

Explanation:
Solution a means that you trust the machine you are ssh-ing to ( hostb )
Solution b/c means that you disable X11 forwarding

Advanced solutions:
check "xauth list"

 http://ping80life.blogspot.com/2011/12/warning-no-xauth-data-using-fake.html

 222222222222222222222222222222222222222

 记得最后重启SSH,使用以下3命令之一即可:

service sshd restart

/etc/ini.d/sshd reload

/etc/ini.d/sshd restart

转载于:https://my.oschina.net/emptytimespace/blog/79171

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值