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连接慢的问题 的相关文章

  • Unix 命令列出包含字符串但*不*包含另一个字符串的文件

    如何递归查看包含一个字符串且不包含另一个字符串的文件列表 另外 我的意思是评估文件的文本 而不是文件名 结论 根据评论 我最终使用了 find name html exec grep lR base maps xargs grep L ba
  • 修改linux下的路径

    虽然我认为我已经接近 Linux 专业人士 但显然我仍然是一个初学者 当我登录服务器时 我需要使用最新版本的R 统计软件 R 安装在 2 个地方 当我运行以下命令时 which R I get usr bin R 进而 R version
  • bluetoothctl 到 hcitool 等效命令

    在 Linux 中 我曾经使用 hidd connect mmac 来连接 BT 设备 但自 Bluez5 以来 这种情况已经消失了 我可以使用 bluetoothctl 手动建立连接 但我需要从我的应用程序使用这些命令 并且使用 blue
  • ReferenceError:MongoDB shell 中未定义 require

    我尝试通过 Windows 命令 Windows 8 1 从 Mongo 客户端连接 MongoDB 当我使用require 在 javascript 中 我遇到如下错误 有人有同样的问题吗 我有错过任何一个吗require有关的npm安装
  • 为什么我收到“无法进行二进制日志记录”的信息。在我的 MySQL 服务器上?

    当我今天启动 MySQL 服务器并尝试使用以下命令进行一些更改时用于 MySQL 的 Toad http www quest com toad for mysql 我收到此消息 MySQL 数据库错误 无法进行二进制日志记录 消息 交易级别
  • 在 bash 中使用单个命令为 shell 变量分配默认值

    我对 bash 3 00 shell 脚本中的变量进行了大量测试 如果未设置变量 则它会分配默认值 例如 if z VARIABLE then FOO default else FOO VARIABLE fi 我似乎记得有一些语法可以在一行
  • Linux 中的无缓冲 I/O

    我正在写入大量的数据 这些数据数周内都不会再次读取 由于我的程序运行 机器上的可用内存量 显示为 空闲 或 顶部 很快下降 我的内存量应用程序使用量不会增加 其他进程使用的内存量也不会增加 这让我相信内存正在被文件系统缓存消耗 因为我不打算
  • 如何通过替换为空页映射来取消映射 mmap 文件

    Linux 用户空间有没有办法用空页面 映射自 dev null 或者可能是一个空页面 重复映射到从文件映射的页面的顶部 对于上下文 我想找到这个 JDK bug 的修复 https bugs openjdk java net browse
  • 通过特定分隔符删除字符串

    我的文件中有几列 其中第二列有 分隔符 我想删除第二列中的第一个 第三个和第四个字符串 并将第二个字符串留在该列中 但我有正常的分隔符空间 所以我不知道 input 22 16050075 A G 16050075 A G 22 16050
  • 将文件从不同目录复制到公共目录

    我有很多目录 其中包含 c文件 我想复制全部 c使用 shell 脚本将不同目录中的文件复制到单个目录 find name c exec cp t tmp 启动当前目录中的所有项目 递归 获取名称结尾的项目 c 将这些项目复制到 tmp 如
  • nginx 上的多个网站和可用网站

    通过 nginx 的基本安装 您的sites available文件夹只有一个文件 default 怎么样sites available文件夹的工作原理以及如何使用它来托管多个 单独的 网站 只是为了添加另一种方法 您可以为您托管的每个虚拟
  • Linux TUN/TAP:无法从 TAP 设备读回数据

    问题是关于如何正确配置想要使用 Tun Tap 模块的 Linux 主机 My Goal 利用现有的路由软件 以下为APP1和APP2 但拦截并修改其发送和接收的所有消息 由Mediator完成 我的场景 Ubuntu 10 04 Mach
  • 如何在 shell 脚本中并行运行多个实例以提高时间效率[重复]

    这个问题在这里已经有答案了 我正在使用 shell 脚本 它读取 16000 行的输入文件 运行该脚本需要8个多小时 我需要减少它 所以我将其划分为 8 个实例并读取数据 其中我使用 for 循环迭代 8 个文件 并在其中使用 while
  • 我可以从命令行打印 html 文件(带有图像、css)吗?

    我想从脚本中打印带有图像的样式化 html 页面 谁能建议一个开源解决方案 我使用的是 Linux Ubuntu 8 04 但也对其他操作系统的解决方案感兴趣 你可以给html2ps http user it uu se jan html2
  • if [ -z "${FILE_LIST}" ] 中的 -z 是什么

    遇到了这个 什么是 z在 shell 脚本中if z FILE LIST 是相同的test And man test gives z STRING the length of STRING is zero 注意 在某些平台上 是一个符号链接
  • 在哪里可以找到并安装 pygame 的依赖项?

    我对 Linux 比较陌生 正在尝试安装 python 的 pygame 开发环境 当我运行 setup py 时 它说我需要安装以下依赖项 我找到并安装了其中之一 SDL 然而 其他人则更加难以捉摸 Hunting dependencie
  • Linux 中的动态环境变量?

    Linux 中是否可以通过某种方式拥有动态环境变量 我有一个网络服务器 网站遵循以下布局 site qa production 我想要一个环境变量 例如 APPLICATION ENV 当我在 qa 目录中时设置为 qa 当我在生产目录中时
  • 添加要在给定命令中运行的 .env 变量

    我有一个 env 文件 其中包含如下变量 HELLO world SOMETHING nothing 前几天我发现了这个很棒的脚本 它将这些变量放入当前会话中 所以当我运行这样的东西时 cat env grep v xargs node t
  • OSX bash 最小化窗口

    在 Mac 中并使用 bash shell 我想执行一个包含单个命令 启动 Jupyter Lab 的文件并立即最小化终端窗口 有没有办法在不安装第三方软件的情况下做到这一点 是的 只需使用osascript https ss64 com
  • 两种情况或 if 哪个更快? [关闭]

    Closed 这个问题不符合堆栈溢出指南 help closed questions 目前不接受答案 我必须制作一个 非常 轻的脚本 它将接受用户的选项并调用脚本中的函数来执行一些任务 现在我可以使用 IF 和 CASE 选项 但我想知道两

随机推荐

  • 静态库调用动态库或者静态库(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连接部分机器的时候特别的慢 之前写过一篇文章