问题参考:
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服务。