SSH连接慢的问题

2023-10-27

维护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连接慢》有错误请给我们留言,我们将尽快修复文章错误,如果您觉得本站不错,请分享给周围的朋友!谢谢!

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

SSH连接慢的问题 的相关文章

  • 在Java中执行.lnk文件

    我需要在java中执行 lnk文件 指向exe文件的lnk文件 我能怎么做 在 VB net 中我做 Process Start path 它有效 谢谢你的帮助 Use a 流程构建器 http download oracle com ja
  • 使用脚本检查 git 分支是否领先于另一个分支

    I have branch1 and branch2我想要某种 git branch1 isahead branch2 这将显示如果branch1已承诺branch2没有 也可能指定这些提交 我无法检查差异原因branch2 is在之前br
  • 使用 ioctl 在 C++ 中以编程方式添加路由

    我编写了简单的 C 函数 添加了新路线 void addRoute int fd socket PF INET SOCK DGRAM IPPROTO IP struct rtentry route memset route 0 sizeof
  • 更新Linux中的包含路径

    我的 my path to file 文件夹中有几个头文件 我知道如何将这些文件包含在新的 C 程序中 但每次我都需要在包含它之前输入头文件的完整路径 我可以在linux中设置一些路径变量 以便它自动查找头文件吗 您可以创建一个 makef
  • 如何从 Bash 命令行在后台 Vim 打开另一个文件?

    我正在从使用 Gvim 过渡到使用控制台 Vim 我在 Vim 中打开一个文件 然后暂停 Vim 在命令行上运行一些命令 然后想返回到 Vim Ctrl Z 在正常模式下 暂停 Vim 并返回到控制台 fg可用于将焦点返回到 Vim job
  • Bash:将字符串添加到文件末尾而不换行

    如何将字符串添加到文件末尾而不换行 例如 如果我使用 gt gt 它将添加到文件末尾并换行 cat list txt yourText1 root host 37 echo yourText2 gt gt list txt root hos
  • Python glob,操作系统,相对路径,将文件名放入列表中[重复]

    这个问题在这里已经有答案了 我正在尝试创建一个目录中所有文件的列表 其中文件名以 root 结尾 在阅读了论坛中的一些文章后 我尝试使用 glob 和 os listdir 的基本策略 但我都遇到了麻烦 首先 当我使用 import glo
  • Ruby:在 Ubuntu 上安装 rmagick

    我正在尝试在 Ubuntu 10 04 上安装 RMagick 看起来here https stackoverflow com questions 1482823 is there an easy way to install rmagic
  • 为什么此 NASM 代码会打印我的环境变量?

    本学期我刚刚完成计算机体系结构课程 除其他外 我们一直在涉足 MIPS 汇编并在 MARS 模拟器中运行它 今天 出于好奇 我开始在我的 Ubuntu 机器上摆弄 NASM 基本上只是将教程中的内容拼凑起来 并感受一下 NASM 与 MIP
  • 正则表达式删除块注释也删除 * 选择器

    我正在尝试使用 bash 从 css 文件中删除所有块注释 我有以下 sed 命令的正则表达式 sed r s w s w d 这可以很好地去除块注释 例如 This is a comment this is another comment
  • 为 Linux 编译 Objective-C 应用程序(API 覆盖范围)

    我可能在这里问一些奇怪的问题 但我不确定从哪里开始 问题是我正在考虑使用 Obj C 和 Foundation 类在 Mac 上编写一个命令行工具 但存在一个非常大的风险 那就是我希望能够为不同的 Linux 发行版编译它 以便将来作为服务
  • Ubuntu Python shebang 线不工作

    无法让 shebang 线在 Ubuntu 中为 python 脚本工作 我每次只收到命令未找到错误 test py usr bin env python print Ran which python usr bin python 在 sh
  • 如何在线程创建和退出时调用函数?

    include
  • 如何才能将 TCP 连接返回到同一端口?

    机器是 RHEL 5 3 内核 2 6 18 有时我在 netstat 中注意到我的应用程序有连接 建立了 TCP 连接本地地址 and 国外地址是一样的 其他人也报告了同样的问题 症状与链接中描述的相同 客户端连接到本地运行的服务器的端口
  • 关键字“if”如何测试一个值是真还是假?

    在 bash 脚本中 if 1 then echo Yes else echo No fi Output Yes 它表示 1 被视为真值 但在代码中 word Linux letter nuxi if echo word grep q le
  • 如何使用 docker ENTRYPOINT 与 shell 脚本文件组合参数

    我编写 shell 脚本文件并将其与 docker ENTRYPOINT 一起使用 但是当我运行 docker image 时 由于入口点代码行 它只是停止而没有任何错误日志 我的 Dockerfile FROM ubuntu 16 04
  • awk 在循环中使用时不打印任何内容[重复]

    这个问题在这里已经有答案了 我有一堆使用 file 1 a 1 txt 格式的文件 如下所示 A 1 B 2 C 3 D 4 并使用以下命令添加包含每个文件名称的新列 awk print FILENAME NF t 0 file 1 a 1
  • Tomcat Intellij Idea:远程部署

    RackSpace 云服务器 Ubuntu 12 04 Intellij Idea 11 1 2 Windows 8 Tomcat 7 0 26 JDK 6 在 Intellij Idea 上 当我尝试在远程 Tomcat 7 服务器上运行
  • 找不到包“gdk-pixbuf-2.0”

    我正在尝试在 Amazon Linux 发行版实例上构建 librsvg 我已经通过 yum 安装了大部分依赖项 其中一些在实例上启用的默认 yum 存储库中不可用 因此必须从头开始构建它们 我已经走了很远 但还停留在最后一点 跑步时sud
  • 仅使用containerd(不使用Docker)修剪容器镜像

    如果我刚刚containerd安装在 Linux 系统上 即 Docker 是not安装 如何删除未使用的容器映像以节省磁盘空间 Docker 就是这么方便docker system prune https docs docker com

随机推荐

  • 静态库调用动态库或者静态库(Cmake例子)

    1 静态库无论调用动态库还是静态库都只需要include库的头文件 2 要在调用该静态库的地方添加库引用 并设置路径 结论 其实静态库调用动态库或者静态库 只是在用到库方法的地方把该方法添加到LIB当中 真正使用的地方才会把这些库LINK起
  • flutter_blue优化(FlutterBlue.instance.scan搜索重复、搜索结果处理、更新之前保存缓存数据、保存连接成功的设备)

    1 搜索列表优化 FlutterBlue instance scan搜索重复 搜索结果处理 更新之前保存缓存数据 2 保存连接过的设备 3 十进制转十六进制 4 写入十六进制数据 json scan dart 实体类 主要是使用flutte
  • Spring Boot是什么?它的优点是什么?

    Spring Boot是什么 它的优点是什么 Spring Boot是一个基于Spring框架的快速开发框架 它旨在简化Spring应用程序的开发过程和部署流程 Spring Boot提供了自动化配置和约定大于配置的方式 使开发人员可以专注
  • JavaWeb--- Filter(过滤器)学习

    Filter 过滤器 处理中文乱码 登录验证 1 xml依赖
  • 教你用Python做图像处理

    质量 速度 廉价 选择其中两个 提到图像处理第一个想到的库就是PIL 全称Python Imaging Library Python 图像处理类库 它提供了大量的图像操作 比如图像缩放 裁剪 贴图 模糊等等 很多时候它需要配合numpy库一
  • 无盘服务器怎么看使用情况,无盘服务器回写盘查看

    无盘服务器回写盘查看 内容精选 换一换 华为云帮助中心 为用户提供产品简介 价格说明 购买指南 用户指南 API参考 最佳实践 常见问题 视频帮助等技术文档 帮助您快速上手使用华为云服务 由于某些机型的服务器没有配备SDI卡 或者其他服务器
  • 代码随想录一刷-Day09

    LeetCode27 移除元素 public int removeElement int nums int val if nums length 0 return 0 双指针 int slow 0 fast 0 while fast lt
  • Dynamic 356 OP 9.0版本 同服务器环境还原DB导入组织报错

    环境 Dynamic 365 9 0 6 9 PRD和UAT组织在同一套服务器环境中 操作 1 备份PRD数据库 还原到UAT数据库 2 在CRM部署管理器中导入UAT组织数据库 提示错误如下 12 31 12 Verbose Databa
  • 代码简洁3 —— 注释

    前段时间在组织代码review时 提到代码可读性问题时 很多人的第一反应竟然是多添加注释 而我始终觉得注释只能是锦上添花 而不能雪中送炭 再多的注释也改变不了代码逻辑组织混乱的现实 反而过多的注释会加重代码阅读的时间 什么也比不上放置良好的
  • 大端模式(big-endian)与小端模式(little-endian)

    参考自 大端模式与小端模式 大端模式是指数据的低位保存在内存的高地址中 而数据的高位保存在内存的低地址中 小端模式是指数据的低位保存在内存的低地址中 而数据的高位保存在内存的高地址中 大小端模式的由来 在计算机系统中 我们是以字节为单位的
  • 【Caffe】官方例程之R-CNN物体检测

    R CNN is a state of the art detector that classifies region proposals by a finetuned Caffe model For the full details of
  • kvm cpu的亲和性绑定配置

    1 CPU的绑定配置 进程的处理器亲和性 process affinity 指将进程绑定到特定的一个或多个cpu上去执行 而不允许将进程调度到其他cpu上 物理cpu 表示真实的cpu个数 逻辑cpu 表示所有拥有一个完整真实cpu功能的单
  • nodejs npm 安装报错 无法安装 behind a proxy

    npm ERR Error connect ECONNREFUSED npm ERR at errnoException net js 878 11 npm ERR at Object afterConnect as oncomplete
  • Where-are-they-looking-PyTorch 代码Error: Bool value of Tensor with more than one value is ambiguous

    在Where are they looking PyTorch中的utils py中有一个判断 if temp lt best best temp 报出 Error Bool value of Tensor with more than o
  • Puppet

    1 Puppet简介 Puppet使用一种描述性语言来定义配置项 配置项中被称为 资源 描述性语言可以声明用户的配置状态 比如声明一个软件包应该被安装或一个服务应该被启动等 Puppet可以运行在一台服务器端 每个客户端通过SSL证书连接到
  • 机器学习在工业应用中的新思考

    人工智能在学术界默默发展了很多很多年 从最早的神经网络 到10年前风靡的SVM bagging and boosting 如今的深度学习 日新月异 各领风骚数几年 工业界的发展从最早应用于纯粹的互联网企业 近几年开始应用到更多更广泛的场景
  • Win32环境下两种用于C++的线程同步类

    线程同步是多线程程序设计的核心内容 它的目的是正确处理多线程并发时的各种问题 例如线程的等待 多个线程访问同一数据时的互斥 防死锁等 Win32提供多种内核对象和手段用于线程同步 如互斥量 信号量 事件 临界区等 所不同的是 互斥量 信号量
  • RPC流程一 - proto编写

    参考 https github com goyas goya rpc tree master src 对RPC中的Server端和Client端流程进行整理 代码目录 CMakeLists txt config cmake sample e
  • 手把手教你用代码实现 SSO 单点登录

    点击上方 Java基基 选择 设为星标 做积极的人 而不是积极废人 每天 14 00 更新文章 每天掉亿点点头发 源码精品专栏 原创 Java 2021 超神之路 很肝 中文详细注释的开源项目 RPC 框架 Dubbo 源码解析 网络应用框
  • SSH连接慢的问题

    维护linux经常需要使用ssh进行连接 但是有时会很郁闷的发现ssh连接部分机器的时候特别的慢 之前写过一篇文章