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反向解析的功能)
茶杯头甜蜜终章dlc 官方手机版v1.0.0.3
下载火柴人传说暗影格斗内置菜单 最新版v3.0.1
下载荒野乱斗测试服 安卓版v61.10.3
下载荒野乱斗彩虹服 安卓版v61.10.3
下载寒霜启示录 安卓版v1.25.10
寒霜启示录是一款生存模拟游戏,不少玩家可能对于末日都有着自己
末日城堡免广告版 安卓最新版v0.7.1
末日城堡免广告版是一款非常好玩的模拟经营类游戏,内部可以不看
甜蜜人生模拟器 最新版v1.4.5
甜蜜人生模拟器是一款非常好玩的模拟恋爱手游,玩家在这里能够对
武器锻造师内置功能菜单 v10.4
武器锻造师内置菜单版是游戏的破解版本,在该版本中为玩家提供了
开放空间overfield 安卓版v1.0.5
开放空间Overfield是一款箱庭养成经营手游,让你在广阔