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月前
|
网络安全 数据安全/隐私保护 开发者
诊断并修复SSH连接Github时遇到的"connection closed"错误。
解决"connection closed"错误往往是一个排除法的过程。需要从基础的网络检查做起,逐步过渡到深入的配置和服务端日志审查。每一步都应当仔细验证,确保不遗漏可能导致连接问题的任何细节。在执行以上步骤后,大多数SSH连接问题可以得到解决。如果所有步骤都未能解决问题,可能需要寻求更专业的技术支持,或者在GitHub社区寻找是否有其他开发者遇到并解决了类似的问题。
518 0
|
4月前
|
安全 网络安全 数据安全/隐私保护
解决SSH测试连接GitHub时出现“connection closed by remote host”的问题。
然后使用 `ssh -T git@ssh.github.com`来测试连接。
520 0
|
7月前
|
Ubuntu Linux 网络安全
在Linux云服务器上限制特定IP进行SSH远程连接的设置
温馨提示,修改iptables规则时要格外小心,否则可能导致无法远程访问你的服务器。最好在掌握足够技术知识和理解清楚操作含义之后再进行。另外,在已经配置了防火墙的情况下,例如ufw(Ubuntu Firewall)或firewalld,需要按照相应的防火墙的规则来设置。
373 24
|
6月前
|
安全 网络协议 Linux
Linux查 ssh端口号和服务状态
本指南详细介绍如何检查SSH服务的运行状态,包括通过进程命令验证服务启动、查看监听端口、检测系统服务状态以及防火墙配置。同时提供安全建议,如修改默认端口、禁用密码登录和定期更新系统,确保SSH服务稳定与安全。适用于不同Linux发行版(Systemd/SysVinit),帮助用户全面排查和优化SSH配置。
|
8月前
|
安全 Linux 网络安全
在Linux(CentOS和AWS)上安装更新的git2的方法并配置github-ssh
经过以上这些步骤,你现在就能在GitHub上顺利往返,如同海洋中的航海者自由驰骋。欢迎你加入码农的世界,享受这编程的乐趣吧!
346 10
|
安全 Linux 网络安全
Linux端的ssh如何升级?
Linux端的ssh如何升级?
1066 59
|
运维 网络安全
解决ssh: connect to host IP port 22: Connection timed out报错(scp传文件指定端口)
通过这些步骤和方法,您可以有效解决“ssh: connect to host IP port 22: Connection timed out”问题,并顺利使用 `scp`命令传输文件。
11587 7
|
12月前
|
网络协议 Ubuntu Linux
解决ssh: connect to host IP port 22: Connection timed out报错(scp传文件指定端口)
解决 `ssh: connect to host IP port 22: Connection timed out` 报错涉及检查 SSH 服务状态、防火墙配置、网络连通性和主机名解析等多个方面。通过逐步排查上述问题,并在 `scp` 命令中正确指定端口,可以有效解决连接超时的问题,确保文件传输的顺利进行。希望本文提供的解决方案能帮助您快速定位并解决该错误。
2924 3
|
监控 Ubuntu Linux
使用VSCode通过SSH远程登录阿里云Linux服务器异常崩溃
通过 VSCode 的 Remote - SSH 插件远程连接阿里云 Ubuntu 22 服务器时,会因高 CPU 使用率导致连接断开。经排查发现,VSCode 连接根目录 ".." 时会频繁调用"rg"(ripgrep)进行文件搜索,导致 CPU 负载过高。解决方法是将连接目录改为"root"(或其他具体的路径),避免不必要的文件检索,从而恢复正常连接。
|
网络协议 Shell 网络安全
ssh: connect to host github.com port 22: Connection refused
本文讨论了在使用Git命令操作GitHub时遇到的"ssh: connect to host github.com port 22: Connection refused"错误,分析了可能的原因,并提供了使用443端口或https协议作为解决方案,最终确定问题是由于DNS解析错误导致,通过修改hosts文件解决。
ssh: connect to host github.com port 22: Connection refused