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反向解析的功能)
原神祈愿模拟器最新版
原神祈愿模拟器手机版是一款完整汉化的趣味原神抽卡模拟小游戏,
宝宝森林美食完整版
宝宝森林美食游戏最新版是一款十分有趣的休闲益智游戏,帮助宝宝
g沙盒仇恨官方英文版(gorebox)
G沙盒仇恨英文原版是一款最近非常火热的沙盒模拟类游戏,在这里
迷你世界测试服最新版2024
迷你世界测试服2021最新版,即迷你世界的先遣服版本,用户能
闪耀暖暖最新版2024
闪耀暖暖手游这是非常好玩的换装手游,游戏内容丰富有趣,游戏环