SSH客户端(如PuTTY)ssh远程登录Linux非常慢的解决方法

时间:2023-12-15 16:14:08

转:http://blog.useasp.net/archive/2014/05/19/solved-the-problem-of-ssh-client-such-as-putty-remote-login-linux-very-slowly.aspx

ssh -v ssh_test@192.168.128.137

SSH远程登录的时候显示的信息如下

==================================

OpenSSH_6.0p1 Debian-4, OpenSSL 1.0.1e 11 Feb 2013
...Some sensitive information...
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.0p1 Debian-4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
...Some sensitive information...
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic,password
debug1: Next authentication method: gssapi-keyex
debug1: No valid Key exchange context
debug1: Next authentication method: gssapi-with-mic
debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address
 debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address
 debug1: Unspecified GSS failure.  Minor code may provide more information
 debug1: Unspecified GSS failure.  Minor code may provide more information
Cannot determine realm for numeric host address
 debug1: Next authentication method: publickey
debug1: Trying private key: /home/mitchellchu/.ssh/id_rsa
debug1: Trying private key: /home/mitchellchu/.ssh/id_dsa
debug1: Trying private key: /home/mitchellchu/.ssh/id_ecdsa
debug1: Next authentication method: password
从上面可以看到,在CentOS中,系统使用了publickey,gssapi-keyex,gssapi-with-mic,和password来进行认证
下面先放出处理GSSAPI的方法:
禁用GSSAPI认证有两个方式:客户端和服务端
直接配置你ssh客户端的文件/etc/ssh/ssh_config来达到永久解决这个问题:
客户端禁用GSSAPIAuthentication
vi /etc/ssh/ssh_config
修改为GSSAPIAuthentication no
服务端禁用GSSAPIAuthentication
vi /etc/ssh/sshd_config
修改为GSSAPIAuthentication no
修改为UseDNS no
最后重启SSH服务:service sshd restart