`

SSH连接慢的问题

 
阅读更多

维护linux经常需要使用ssh进行连接,但是有时会很郁闷的发现ssh连接部分机器的时候特别的慢。之前写过一篇文章<sshl连接慢(DNS惹的祸)>今天就跟大家说一下GSS导致的慢的问题。

首先普及一下linux服务器上在/etc/ssh目录下存在两个配置文件一个是ssh_config,一个是sshd_config。区别就在于d上,带d的是ssh服务使用的配置文件,不带的是ssh客户端程序使用的。

当大家发现ssh慢的时候可以使用ssh -vv 192.168.0.30的方式测试一下慢出现在什么地方。(是两个v奥)

显示的调试信息如下:

 

OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 192.168.0.30 [192.168.0.30] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug2: key_type_from_name: unknown key type ‘—–BEGIN’
debug2: key_type_from_name: unknown key type ‘—–END’
debug1: identity file /root/.ssh/id_rsa type 1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 3 keys
debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3
debug1: match: OpenSSH_4.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_4.3
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit: none,zlib@openssh.com,zlib
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: kex_parse_kexinit: diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit:
debug2: kex_parse_kexinit: first_kex_follows 0
debug2: kex_parse_kexinit: reserved 0
debug2: mac_init: found hmac-md5
debug1: kex: server->client aes128-cbc hmac-md5 none
debug2: mac_init: found hmac-md5
debug1: kex: client->server aes128-cbc hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug2: dh_gen_key: priv key bits set: 122/256
debug2: bits set: 530/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host ’192.168.0.30′ is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:8
debug2: bits set: 535/1024
debug1: ssh_rsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /root/.ssh/identity ((nil))
debug2: key: /root/.ssh/id_rsa (0x90f7ef8)
debug2: key: /root/.ssh/id_dsa ((nil))
debug1: Authentications that can continue: publickey,gssapi-with-mic,password
debug1: Next authentication method: gssapi-with-mic
Address 192.168.0.30 maps to localhost, but this does not map back to the address – POSSIBLE BREAK-IN ATTEMPT!

 

 

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
No credentials cache found

debug2: we did not send a packet, disable method
debug1: Next authentication method: publickey
debug1: Trying private key: /root/.ssh/identity
debug1: Offering public key: /root/.ssh/id_rsa
debug2: we sent a publickey packet, wait for reply
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug2: input_userauth_pk_ok: SHA1 fp 0e:7e:08:29:03:3f:92:4e:80:90:0e:fd:ab:9b:d9:f7:3d:f9:59:04
debug1: read PEM private key done: type RSA
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug2: channel 0: send open
debug1: Entering interactive session.
debug2: callback start
debug2: client_session2_setup: id 0
debug2: channel 0: request pty-req confirm 0
debug1: Sending environment.
debug1: Sending env LANG = zh_CN.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 0
debug2: fd 3 setting TCP_NODELAY
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug2: channel 0: rcvd adjust 2097152

 

Last login: Wed Aug 27 22:50:26 2014 from 192.168.0.10

 

当机器出现GSS导致慢的问题的时候会看到

从以上的输出可以看到耗时最长的就是Unspecified GSS failure的地方,这是因为验证的时候启用的GSSAPIAuthentication验证方式导致的。

那我们只要关闭就可以了,这个时候有两个地方是需要设置的,sshd_config里面设置的是服务端,ssh_config里面设置的是客户端的。两台相互连接的机器只要把一方设置为no即可。但是服务端一定要设置sshd_config,客户端设置ssh_config。

感谢您对【51运维网 http://www.51ou.com/】的支持,我们为您免费提供《SSH连接慢》技术文章,《SSH连接慢》详细使用和说明,有时《SSH连接慢》可能不完善、敬请谅解!如果《SSH连接慢》有错误请给我们留言,我们将尽快修复文章错误,如果您觉得本站不错,请分享给周围的朋友!谢谢!

分享到:
评论

相关推荐

    解决ssh信任连接问题

    可以使用一些工具来辅助诊断SSH连接问题,例如`ssh -v`(详细模式)可显示连接过程中的详细信息,帮助找出问题所在。 5. **源码调试**: 对于更深入的问题,你可能需要查看SSH的源码进行调试,理解其工作原理。...

    通过USB用SSH连接iphone

    这个工具能够使你的电脑识别iOS设备,就像它是网络设备一样,从而实现SSH连接。 要实现USB通过SSH连接到iPhone,你需要遵循以下步骤: 1. **安装USBmuxd**:在你的电脑上(通常是Mac或Linux系统,因为Windows支持...

    Ubuntu SSH连接其他机器很慢的解决办法.pdf

    Ubuntu SSH 连接其他机器很慢的解决办法 SSH(Secure Shell)是用于远程登录和管理 Linux 服务器...本文提供了解决 Ubuntu SSH 连接其他机器很慢的问题的方法,并介绍了其他优化方法以提高 SSH 连接速度和计算机性能。

    ubuntu ssh服务器安装,ssh连接错误

    如果你按照以上步骤操作后仍然遇到SSH连接错误,建议查看服务器和客户端的SSH日志文件(通常位于`/var/log/auth.log`),以获取更具体的错误信息,以便进一步诊断和解决问题。 总之,安装和配置SSH服务器是Ubuntu...

    Linux-ssh连接问题

    Linux-ssh连接问题,日常工作中在连接ssh时候遇到的几个问题。

    ssh数据库连接池proxool

    4. **监控与统计**:Proxool提供了一套完善的监控和统计机制,可以实时查看连接池的状态,如当前连接数、等待队列长度、使用率等,有助于优化配置和排查问题。 配置Proxool通常涉及以下几个步骤: 1. **添加依赖**...

    SSH连接工具

    SSH连接工具是实现SSH协议的软件应用,主要用于在不同的计算机之间建立加密的通信链路,常见用途包括远程控制、文件传输等。F-Secure SSH File Transfer工具是一款由F-Secure公司提供的SSH连接解决方案,它特别强调...

    Ubuntu SSH连接其他机器很慢的解决办法.docx

    Ubuntu SSH 连接其他机器很慢的解决办法 在 Ubuntu 系统中,SSH 连接其他机器可能会出现非常慢的现象,这严重影响了我们的工作或者游戏体验。到底是什么原因导致了这种情况的发生?如何解决这个问题?本文将详细...

    Putty_ssh连接器

    6. 错误日志:PuTTY记录错误日志,有助于排查连接问题和故障诊断。 7. 集成X11转发:对于运行X Window System的Linux系统,PuTTY支持X11转发,可以在本地机器上显示远程服务器的图形界面应用程序。 8. 兼容性强:...

    window用ssh连接本机虚拟机中的ubuntu.docx

    * 如何解决 SSH 连接问题 * 高级 SSH 连接配置 相关概念 * SSH(Secure Shell) * 防火墙(ufw) * IP 地址 * 子网掩码 * 广播地址 * 网关 * SSH 客户端工具 * 公钥认证 应用场景 * 远程访问服务器 * 远程管理...

    c# asp.net ssh连接到服务器进行命令交互

    在这个场景中,我们将讨论如何使用C#和ASP.NET结合PUTTY来实现SSH连接,以便在服务器上进行命令交互。 首先,为了在C#中实现SSH功能,我们需要一个支持SSH的库。PuTTY本身并不提供编程接口,但我们可以使用如...

    vscode连接远程ubuntu服务器,使用remote-ssh插件+连接问题解决

    vscode连接远程ubuntu服务器,使用remote-ssh插件+连接问题解决

    ssh自动连接服务器并邮件提醒

    在IT行业中,SSH(Secure Shell)是一种用于在网络设备之间安全地执行远程命令和传输数据的协议。自动SSH连接脚本可以极大地提高系统管理员的...当SSH连接出现异常时,系统管理员可以立即收到通知,以便及时处理问题。

    SSH协议连接远程服务器的java实现

    为了提高SSH连接的性能,可以采取以下措施: 1. **使用SSH2协议**:SSH2协议相比SSH1具有更高的安全性和性能。 2. **压缩传输数据**:启用数据压缩可以减少数据传输量,从而提高效率。 3. **优化连接池管理**:对于...

    SSH远程连接客户端编码设置

    完成以上设置后,尝试重新建立SSH连接,检查中文字符是否能够正常显示。 ### 总结 通过以上步骤,可以有效地解决SSH远程连接时出现的中文乱码问题。关键在于确保客户端和服务器端的字符编码一致,并通过正确的...

    ssh使用中常遇到的问题以及解决方法

    问题描述:使用 SSH 连接服务器时,连接超时,无法登录服务器。 解决方法:检查网络连接是否正常,确保服务器的 SSH 服务是否启动。尝试使用其他 SSH 客户端程序,检查是否是客户端程序的错误。 2. SSH 无法连接...

    putty7.0解决华为设备ssh连接报错,不能连接的问题

    putty7.0解决华为设备ssh连接报错,不能连接的问题。

    ssh 问题整理

    首先,SSH连接问题可能源于多种原因,如防火墙设置、服务器配置错误、公钥认证失败等。当尝试SSH连接时,如果遇到“连接被拒绝”错误,检查服务器的SSH服务是否正在运行,端口22是否开放,并确认防火墙规则允许入站...

    解决CentOS SSH连接时中文乱码

    然而,有时会遇到一个常见的问题——通过SSH连接后,原本设置为中文的语言环境出现了乱码现象。本文将详细介绍如何解决CentOS系统通过SSH连接时出现的中文乱码问题。 #### 问题背景 在安装CentOS系统时,如果选择...

    这是一个可以自定义参数的使用Ssh2连接远程服务器的连接池

    1. **目标服务器地址**:这是远程服务器的IP地址或域名,用于建立SSH连接。 2. **名称**:这可能指的是用户名,用于在远程服务器上进行身份验证。 3. **密码**:对应用户名的密码,也是认证的一部分。在生产环境中,...

Global site tag (gtag.js) - Google Analytics