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天前
|
存储 安全 Linux
深入解析Linux的`read`命令
`read`命令在Linux shell中用于从标准输入读取数据并赋值给变量。它可以用于交互式脚本,提供用户输入或读文件。关键选项包括`-p`(提示用户)、`-r`(禁用转义)、`-s`(静默模式,适合密码)、`-t`(超时)和`-n`(读取特定字符数)。示例包括基本输入、带提示的密码输入和设置超时的输入。注意安全处理密码和验证用户输入。
|
5天前
|
安全 Linux Shell
Linux中SSH命令介绍
Linux中SSH命令介绍
16 2
|
5天前
|
网络协议 Linux 网络安全
Linux配置SSH允许TCP转发
Linux配置SSH允许TCP转发
12 1
|
10天前
|
安全 Linux Shell
【Linux基础】SSH登录
安全外壳协议(Secure Shell Protocol,简称SSH)是一种加密的网络传输协议,可在不安全的网络中为网络服务提供安全的传输环境。 SSH通过在网络中建立安全隧道来实现SSH客户端与服务器之间的连接。 SSH最常见的用途是远程登录系统,人们通常利用SSH来传输命令行界面和远程执行命令。
24 6
|
11天前
|
Shell Linux 网络安全
Linux怎样在使用ssh 链接时就指定gcc 的版本
Linux怎样在使用ssh 链接时就指定gcc 的版本
19 7
|
13天前
|
监控 安全 Linux
【权限维持】Linux&OpenSSH&PAM后门&SSH软链接&公私钥登录
【权限维持】Linux&OpenSSH&PAM后门&SSH软链接&公私钥登录
|
13天前
|
存储 安全 Unix
【内网安全】Win&Linux&内存离线读取&Hashcat破解&RDP&SSH存储提取
【内网安全】Win&Linux&内存离线读取&Hashcat破解&RDP&SSH存储提取
|
13天前
|
网络协议 安全 Linux
【内网安全】隧道技术&SSH&DNS&ICMP&SMB&上线通讯Linux&Mac
【内网安全】隧道技术&SSH&DNS&ICMP&SMB&上线通讯Linux&Mac
|
15天前
|
Linux 网络安全
|
21天前
|
运维 Linux 网络安全
跨平台SSH文件传输:Linux与Windows环境下的实践指南
本文介绍了在Linux和Windows之间使用SCP、SecureCRT及PuTTY工具集进行文件传输的方法。在Linux中,利用SCP命令进行文件下载、上传及目录传输。在Windows环境下,PSFTP和PSCP提供类似功能,而SecureCRT作为SSH客户端,支持设置上传下载目录并进行文件传输。掌握这些工具的使用可提升跨平台运维效率。