⑴可以看到如下的错误信息:
⑵debug: Next authentication method: gssapi-with-mic
⑶debug: An invalid name was supplied
⑷Cannot determine realm for numeric host address
⑸事实上,正是从gssapi-with-mic这一行开始,开始耗时间。
⑹有人说是在目标机器中修改/etc/ssh/sshd_conf文件
⑺将UseDNS 的缺省值由yes修改为no,并重启sshd。我试了,对这种情况不管用。但不排除对别的延迟情况管用。
⑻====================
⑼有效的解决办法:
⑽、修改本地机器的hosts文件,将目标机器的IP和域名加上去。或者让本机的DNS 服务器能解析目标地址。
⑾vi /etc/hosts
⑿... ourdev
⒀其格式是“目标机器IP 目标机器名称”这种方法促效。没有延迟就连上了。不过如果给每台都加一个域名解析,挺辛苦的。但在windows下用putty或secure-crt时可以采用这种方法。
⒁、修改本机的客户端配置文件ssh_conf,注意,不是sshd_conf
⒂vi /etc/ssh/ssh_conf
⒃GSSAPIAuthentication yes
⒄GSSAPIAuthentication no
⒅再连目标机器,速度就飞快了。
⒆GSSAPI ( Generic Security Services Application Programming Interface 是一套类似Kerberos 的通用网络安全系统接口。该接口是对各种不同的客户端服务器安全机制的封装,以消除安全接口的不同,降低编程难度。但该接口在目标机器无域名解析时会有问题。我看到有人给Ubuntu提交了相关bug, 说要将GSSAPIAuthentication的缺省值设为no,不知为何,ubuntu.的缺省值还是yes。
⒇修改完毕,此时的连接调试数据变为了:
⒈view plaincopy to clipboardprint?
⒉ssh -v ...
⒊OpenSSH_.p Debian-ubuntu, OpenSSL ..g Oct
⒋debug: Reading configuration data /etc/ssh/ssh_config
⒌debug: Applying options for *
⒍debug: Connecting to ... [...] port .
⒎debug: Connection established.
⒏debug: identity file /home/zhouhh/.ssh/identity type -
⒐debug: identity file /home/zhouhh/.ssh/id_rsa type -
⒑debug: identity file /home/zhouhh/.ssh/id_dsa type -
⒒debug: Remote protocol version ., remote software version OpenSSH_.
⒓debug: match: OpenSSH_. pat OpenSSH_*
⒔debug: Enabling patibility mode for protocol .
⒕debug: Local version string SSH-.-OpenSSH_.p Debian-ubuntu
⒖debug: SSH_MSG_KEXINIT sent
⒗debug: SSH_MSG_KEXINIT received
⒘debug: kex: server-》client aes-cbc hmac-md none
⒙debug: kex: client-》server aes-cbc hmac-md none
⒚debug: SSH_MSG_KEX_DH_GEX_REQUEST(《《 sent
⒛debug: expecting SSH_MSG_KEX_DH_GEX_GROUP
①debug: SSH_MSG_KEX_DH_GEX_INIT sent
②debug: expecting SSH_MSG_KEX_DH_GEX_REPLY
③debug: Host ‘...’ is known and matches the RSA host key.
④debug: Found key in /home/zhouhh/.ssh/known_hosts:
⑤debug: ssh_rsa_verify: signature correct
⑥debug: SSH_MSG_NEWKEYS sent
⑦debug: expecting SSH_MSG_NEWKEYS
⑧debug: SSH_MSG_NEWKEYS received
⑨debug: SSH_MSG_SERVICE_REQUEST sent
⑩debug: SSH_MSG_SERVICE_AEPT received
Ⅰdebug: Authentications that can continue: publickey,gssapi-with-mic,password
Ⅱdebug: Next authentication method: publickey
Ⅲdebug: Trying private key: /home/zhouhh/.ssh/identity
Ⅳdebug: Trying private key: /home/zhouhh/.ssh/id_rsa
Ⅴdebug: Trying private key: /home/zhouhh/.ssh/id_dsa
Ⅵdebug: Next authentication method: password
Ⅶpassword:
Ⅷ上面就是ssh连接Linux过慢的解决方法介绍了,通过本文的方法解决后,连接速度明显快了不少,大大节约了时间。