ssh/scp是很常用的命令,发现对有些主机, ssh建立连接速度特别慢,连接建立之后执行操作速度却很正常。
用 ssh -v 来查看详细的连接建立过程:
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
debug1: Unspecified GSS failure. Minor code may provide more information
No credentials cache found
debug1: Unspecified GSS failure. Minor code may provide more information
debug1: Next authentication method: publickey
原来是尝试 gssapi-with-mic 认证方式浪费了时间,打开 /etc/ssh/ssh_config 把里面的 GSSAPIAuthentication yes 改成 no 关掉它问题即解决。
如果上面办法解决不了,我们可以接着来排查
下面说下如何解决这样的问题,最为常见的原因是因为server的sshd会去DNS查找访问
client IP的hostname,如果DNS不可用或者没有相关记录,就会耗费大量时间。
1、在server上/etc/hosts文件中把你本机的ip和hostname加入
2、在server上/etc/ssh/sshd_config文件中修改或加入UseDNS=no,另外在authentication gssapi-with-mic也有可能出现问题,在server上/etc/ssh/sshd_config文件中修改GSSAPIAuthentication no.
3、修改server上/etc/nsswitch.conf中hosts为hosts: files
4、reboot server使配置生效
/etc/init.d/sshd restart重启sshd进程使配置生效。
项目组的服务器,通过SSH服务远程访问Linux服务器,总是等待很久才能登陆。
试过下面的方法,再通过SSH服务远程访问Linux服务器,瞬间登陆。。。甚是开心。。。
vi /etc/ssh/sshd_config
关闭 SSH 的 DNS 反解析,添加下面一行:
UseDNS no
※虽然配置文件中[UseDNS yes]被注释点,
但默认开关就是yes...(SSH服务默认启用了DNS反向解析的功能)
热血大作战 安卓最新版v2.1.166
下载凡尔赛法环免广告版 最新版v1.69.1
下载天煞异种 安卓版v1.0.21
下载十三月 (Undecember)最新官方中文版v3.26.0200
下载星露谷物语sve 安卓版v1.5.6.52
星露谷物语sve手机版是游戏的超大拓展Mod内容,全称Sta
动物园大亨 手机版v2.0
动物园大亨是一款模拟动物园经营的休闲放置游戏,采用了卡通画风
蜜蜂园林钞票不减反增版 v0.1.68
蜜蜂园林无限道具版是游戏的破解版本,在该版本中为玩家提供了足
幻想熔炉失落帝国的世界 安卓版v2.16.2
幻想熔炉失落帝国的世界是一款魔法卡通风格的城市模拟经营类游戏
我的女友是声优免广告 安卓版v1
我的女友是声优免广告是一款非常好玩的模拟经营类手游,玩家在游