解决ssh连接linux服务器速度慢

简介:
+关注继续查看

  解决ssh连接linux服务器速度慢

    发表于2011/10/24feng

  核心:

 服务器端sshd配置文件 /etc/ssh/sshd_config 看是否有如下的两条配置条目

GSSAPIAuthentication no
UseDNS no

 如果前面带#,请把#删掉,或者新添加入这样两行。
 然后重启sshd服务,或者重启服务器也可以。

 注意是文件 /etc/ssh/sshd_config 而不是/etc/ssh/ssh_config

 

 ssh 登录远程服务器,速度非常慢,通过网上查询,发现有一个参数 -v 可以输出显示连接的具体消     息。于是连接加上这个参数连接

[feng@fsc ~]$ ssh -v foo.path8.net
OpenSSH_5.3p1, OpenSSL 1.0.0-fips 29 Mar 2010
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug1: Connecting to v.path8.net [64.120.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/feng/.ssh/identity type -1
debug1: identity file /home/feng/.ssh/id_rsa type 1
debug1: identity file /home/feng/.ssh/id_dsa type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.3
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
debug1: Host 'v.path8.net' is known and matches the RSA host key.
debug1: Found key in /home/feng/.ssh/known_hosts:4
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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
/*--------- 这里停留的十多秒钟时间 ----------*/
reverse mapping checking getaddrinfo for srv3.mktmaster.net [64.120.xxx.xxx] failed - POSSIBLE BREAK-IN ATTEMPT!
debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information
Credentials cache file '/tmp/krb5cc_501' not found

debug1: Unspecified GSS failure.  Minor code may provide more information


debug1: Next authentication method: publickey
debug1: Offering public key: /home/feng/.ssh/id_rsa
debug1: Server accepts key: pkalg ssh-rsa blen 277
debug1: Authentication succeeded (publickey).
debug1: channel 0: new [client-session]
debug1: Requesting no-more-sessions@openssh.com
debug1: Entering interactive session.
debug1: Sending environment.
debug1: Sending env XMODIFIERS = @im=ibus
debug1: Sending env LANG = zh_CN.utf8
Last login: Mon Oct 24 10:26:30 2011 from 124.79.xxx.xxx
[feng@v ~]$

     大概就是GSSAPIAuthentication这个参数的问题了,之前就是因为连接速度慢,网上查,说是/etc/ssh/sshd_config 里加入参数 UseDNS no,再加个GSSAPIAuthentication yes, 结果速度还是慢。
      于是去把这行改为GSSAPIAuthentication no,重启服务器端的ssdh服务,再次连接,速度快多了。










本文转自 妙曼  51CTO博客,原文链接:http://blog.51cto.com/yanruohan/1596336,如需转载请自行联系原作者
目录
相关文章
|
13天前
|
弹性计算 jenkins 持续交付
|
1月前
|
缓存 网络协议 测试技术
一招教你快速学会Linux ssh连接免密登录
#编辑配置文件,在最后添加如下内容: AllowUsers student1 student2 #重启ssh服务后生效
57 0
|
1月前
|
Ubuntu 搜索推荐 Linux
让你的SSH连接提示更加个性化
让你的SSH连接提示更加个性化
30 0
让你的SSH连接提示更加个性化
|
1月前
|
Ubuntu Linux 网络安全
SSH客户端连接远程服务器
一、什么是客户端连接远程服务器 发起连接的一方,计算机或设备(称为客户端)与另一个计算机或设备(称为远程服务器)建立连接。 客户端通过网络连接到远程服务器,远程服务器则是提供所需服务或资源的一方。 客户端通常使用特定的协议(如SSH、HTTP、FTP等)与远程服务器进行通信。 示例:你使用SSH客户端从本地计算机连接到远程服务器以执行远程命令。 二、什么是服务端连接远程服务器 指的是在服务端设备上建立到其他远程服务器的连接。服务端设备充当客户端的角色(启动SSH客户端),通过SSH协议与远程服务器进行通信。 三、查看网络信息 1、图形程序查看网络信息 打开设置,找到网络,进入网络界面中,点击设
65 0
|
2月前
|
网络安全 Go Cloud Native
【小技巧】SSH连接服务器后如何默认执行多条命令?
大家平时有没有遇到自己连接云服务器,ssh 连接上去之后,发现自己的一些小工具用不了 例如go build无法使用 ,由于我们安装配置golang 环境的时候
【小技巧】SSH连接服务器后如何默认执行多条命令?
|
2月前
|
网络安全 Go Cloud Native
SSH连接服务器后执行多条命令 |Go主题月
大家平时有没有遇到自己连接云服务器,ssh 连接上去之后,发现自己的一些小工具用不了 例如go build无法使用 ,由于我们安装配置golang 环境的时候,是在文件/etc/profile中写了配置,因此需要source 一下/etc/profile
SSH连接服务器后执行多条命令 |Go主题月
|
2月前
|
网络安全 数据安全/隐私保护
mac本地创建ssh key连接github
mac本地创建ssh key连接github
|
3月前
|
Cloud Native 网络安全 Docker
云原生之部署ssh连接工具webssh2
云原生之部署ssh连接工具webssh2
162 0
|
3月前
|
安全 网络安全 数据安全/隐私保护
SSH 穿越多个跳板机的连接方法
SSH 穿越多个跳板机的连接方法
150 0
|
3月前
|
域名解析 网络协议 Linux
Linux系统ssh连接无响应
Linux系统ssh连接无响应
201 0
推荐文章
更多