首页
解决方案
技术服务
专业数据库维保服务 大数据维保服务
一体机
Oracle数据库一体机 PolarDB数据库一体机 瀚高数据库一体机 崖山数据库一体机 海扬数据库一体机 高斯数据库一体机 金仓数据库一体机
产品
CLup乘数云统一平台 CData高性能数据库云一体机 CPDA高性能双子星数据库机 CBackup数据库备份恢复云平台 CMiner: PostgreSQL中的CDC CSYun超融合虚拟机产品 ZQPool数据库连接池 ConshGuard数据保护产品 APCC: Greenplum管理平台
文档
文章
客户及伙伴
中启开源
关于我们
登录
×
修改密码

1. 背景说明

ssh一台rockylinux9.6机器,发现很慢,我们已经知道ssh登录一台Linux机器慢,通常是DNS解析的问题,这是可以修改/etc/ssh/sshd_config中:

  1. UseDNS no

但是本次的问题不是这个原因,因为做了上面的修改后,发现仍然很慢。

2. 问题定位

  1. $ ssh -vvv root@10.198.170.12
  2. OpenSSH_9.2p1 Debian-2+deb12u7, OpenSSL 3.0.17 1 Jul 2025
  3. ...
  4. ...
  5. ...
  6. debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
  7. debug3: start over, passed a different list publickey,gssapi-keyex,gssapi-with-mic,password
  8. debug3: preferred gssapi-with-mic,publickey,keyboard-interactive,password
  9. debug3: authmethod_lookup gssapi-with-mic
  10. debug3: remaining preferred: publickey,keyboard-interactive,password
  11. debug3: authmethod_is_enabled gssapi-with-mic
  12. debug1: Next authentication method: gssapi-with-mic
  13. ^C
  14. u01@mx:~

发现卡在Next authentication method: gssapi-with-mic,原因很明白了与GSSAPI有关。

用下面的命令发现很快:

  1. ssh -o GSSAPIAuthentication=no root@10.198.170.12

说明确实是GSSAPI的问题。

问题解决

检查我们的/etc/ssh/sshd_config文件中的配置:

  1. # GSSAPI options
  2. GSSAPIAuthentication no
  3. #GSSAPICleanupCredentials yes
  4. GSSAPICleanupCredentials no
  5. #GSSAPIStrictAcceptorCheck yes
  6. GSSAPIStrictAcceptorCheck no
  7. GSSAPIKeyExchange no
  8. GSSAPIEnablek5users no

上面已经把GSSAPIAuthentication认证方法设置为关闭的状态。这是咋回事呢?

这时我们用下面的命令检查时:

  1. [root@clup2 ~]# sudo sshd -T | grep gssapi
  2. gssapienablek5users no
  3. gssapiauthentication yes
  4. gssapicleanupcredentials no
  5. gssapikeyexchange no
  6. gssapistrictacceptorcheck no
  7. gssapistorecredentialsonrekey no
  8. gssapikexalgorithms gss-curve25519-sha256-,gss-nistp256-sha256-,gss-group14-sha256-,gss-group16-sha512-

发现GSSAPIAuthentication居然是打开的。说明/etc/ssh/sshd_config的配置不起作用。

  1. [root@clup2 ~]# sudo grep -Ri GSSAPIAuthentication /etc/ssh/
  2. /etc/ssh/ssh_config.d/50-redhat.conf: GSSAPIAuthentication yes
  3. /etc/ssh/ssh_config:# GSSAPIAuthentication no
  4. /etc/ssh/sshd_config.d/50-redhat.conf:GSSAPIAuthentication yes
  5. /etc/ssh/sshd_config:GSSAPIAuthentication no
  6. /etc/ssh/sshd_config:gssapiauthentication no

最后发现是在/etc/ssh/sshd_config.d/50-redhat.conf中把GSSAPIAuthentication yes,修改此文件把此值改成 no,然后用命令systemctl restart sshd重启sshd服务之后问题解决。