运行ssh user@hostname
需要大约 30 秒。这是场景:
[更新]
使用ssh -vvv user@hostname
,这是它等待最多的地方:
debug3: authmethod_lookup gssapi-with-mic
debug3: remaining preferred: publickey,keyboard-interactive,password
debug3: authmethod_is_enabled gssapi-with-mic
debug1: Next authentication method: gssapi-with-mic
Run Code Online (Sandbox Code Playgroud)
然后在这里等一下:
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_1000' not found
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_1000' …
Run Code Online (Sandbox Code Playgroud) 每次我ssh登录服务器时,总是很慢。正如对我之前帖子的回复所说,“搜索一个 200 行的文件应该需要几毫秒左右的时间,所以我怀疑是不是这样。”
我试过ssh -vvv time@server
了,输出已经上传到这里。我发现在处理输出中的这三行中的每一行时,它都特别慢:
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_1000' not found
debug1: Unspecified GSS failure. Minor code may provide more information
Credentials cache file '/tmp/krb5cc_1000' not found
Run Code Online (Sandbox Code Playgroud)
我想知道为什么以及我能做些什么来改变它?感谢致敬!
更新:
Ignacio 的回复建议我“禁用配置中的所有 GSS/Kerberos 身份验证方法”。
因此,在 中/etc/ssh/ssh_config
,我是否必须确保“否”位于以“GSS”开头的所有选项的后面:GSSAPIAuthentication、GSSAPIDelegateCredentials、GSSAPIKeyExchange、GSSAPITrustDNS、GSSAPIAuthentication 和 GSSAPIDelegateCredentials?
那么我需要将“否”放在后面的“Kerberos”身份验证方法的选项是什么?
PS:以下是我本地的内容,/etc/ssh/ssh_config
注释选项没有复制到这里:
Host *
SendEnv LANG LC_*
HashKnownHosts yes
GSSAPIAuthentication yes
GSSAPIDelegateCredentials no
Run Code Online (Sandbox Code Playgroud) 我遇到了从机器到远程机器的 ssh 登录缓慢。ssh 的详细信息显示在下面的两个断块中。ssh 在下面显示的块中冻结了 15 秒。
[root@zabbix ~]# ssh -vvv zabbix@172.18.xxx.xx
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 172.18.xxx.xx [172.18.xxx.xx] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version Sun_SSH_1.1.4
debug1: no match: Sun_SSH_1.1.4
debug1: Enabling compatibility mode …
Run Code Online (Sandbox Code Playgroud)