Linux(16)ssh_exchange_identification: read: Connection reset by peer问题

简介: Linux(16)ssh_exchange_identification: read: Connection reset by peer问题

问题参考:

https://brucewayne2099.github.io/2019/11/21/Ssh%E6%97%B6%E5%87%BA%E7%8E%B0Bad-protocol-version-identification%E7%9A%84%E5%9D%91/

https://stackoom.com/cn_en/question/3zGM3

问题原因:

ssh -v xxx@192.168.1.130
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 192.168.1.130 [192.168.1.130] port 22.
debug1: Connection established.
debug1: identity file /work/.ssh/id_rsa type 1
debug1: identity file /work/.ssh/id_rsa-cert type -1
debug1: identity file /work/.ssh/id_dsa type -1
debug1: identity file /work/.ssh/id_dsa-cert type -1
debug1: identity file /work/.ssh/id_ecdsa type -1
debug1: identity file /work/.ssh/id_ecdsa-cert type -1
debug1: identity file /work/.ssh/id_ed25519 type -1
debug1: identity file /work/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.13
debug1: ssh_exchange_identification: )\327\020d@\330\264\027L\331\365\271\227
 
ssh_exchange_identification: read: Connection reset by peer

检查:

1.检查ssh认证日志

leon@leon-MS-7850:/mnt/hby/code$ cat /var/log/auth.log

Nov 28 11:23:15 leon-MS-7850 sshd[10431]: Bad protocol version identification ')\327\020d@\330\264\027L\331\365\271\227' from 192.168.1.22 port 38912

2.检查防火墙

sudo iptables -L -n

3.对比ssh文件夹

文件ssh_config,sshd_config 一致

A服务器$ ls -ll /etc/ssh/

B服务器$ ls -ll /etc/ssh/

4.重新安装ssh

1、先停掉SSH服务:sudo stop ssh

2、卸载openssh-server:apt-get remove openssh-server

3、卸载openssh-client: apt-get remove openssh-server

4、安装openssh-server:apt-get install openssh-server

5、安装openssh-client:apt-get install openssh-client

6、安装完成以后,启动服务:sudo /etc/init.d/ssh start

7、启动后,查看服务是否正确启动: ps -e|grep ssh

8、确认ssh-server已经正常工作: netstat -tlp

猜测是open ssh版本号不一致导致的A端连不上B的ssh服务。

相关文章
|
4天前
|
Web App开发 存储 Linux
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
Linux(33)Rockchip RK3568 Ubuntu22.04上通过SSH运行Qt程序和关闭Chrome的密钥提示
66 0
|
4天前
|
安全 Linux Shell
Linux SSH(Secure Shell)服务
Linux SSH提供安全网络协议,使用公钥加密技术确保远程服务传输安全。OpenSSH是实现SSH服务的免费开源工具,允许用户加密连接远程登录Linux服务器执行任务。SSH比Telnet更安全,防止数据被截获。SSH还支持端口转发和隧道,广泛应用于系统管理和网络维护,是安全远程访问服务器的重要工具。
28 1
|
4天前
|
算法 Linux C++
【Linux系统编程】深入解析Linux中read函数的错误场景
【Linux系统编程】深入解析Linux中read函数的错误场景
212 0
|
4天前
|
缓存 IDE Shell
【Shell 命令集合 系统设置 】Linux 重置终端的显示 reset命令 使用指南
【Shell 命令集合 系统设置 】Linux 重置终端的显示 reset命令 使用指南
43 0
|
4天前
|
存储 Shell Linux
【Shell 命令集合 文件管理】Linux 读取命令 read命令使用指南
【Shell 命令集合 文件管理】Linux 读取命令 read命令使用指南
40 0
|
4天前
|
安全 Shell Linux
【Shell 命令集合 文件管理】Linux ssh 远程主机之间复制文件 scp 命令使用教程
【Shell 命令集合 文件管理】Linux ssh 远程主机之间复制文件 scp 命令使用教程
45 0
|
4天前
|
Linux 网络安全 数据安全/隐私保护
SSH工具连接远程服务器或者本地Linux系统
SSH工具连接远程服务器或者本地Linux系统
24 0
|
4天前
|
Linux 网络安全
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
linux免密登录报错 Bad owner or permissions on /etc/ssh/ssh_config.d/05-redhat.conf
35 1
|
4天前
|
存储 安全 Linux
|
4天前
|
监控 安全 Linux
【专栏】Linux SSH 的安全对于远程管理至关重要,这几个小妙招安排上!
【4月更文挑战第28天】在数字化时代,Linux SSH 的安全对于远程管理至关重要。增强 SSH 安全包括:使用强密码,调整 SSH 配置文件,尤其是端口号和认证方式;采用密钥认证代替密码;限制登录用户,禁止密码登录;使用防火墙限制访问;定期更新系统和软件。此外,通过日志监控、入侵检测系统及及时应对攻击来提升安全监控。保持对安全知识的学习和更新,结合最佳实践,是保障 SSH 安全的关键。记得安全是个持续过程,时刻保持警惕!
http://www.vxiaotou.com