SSH Connection reset处理

简介: ssh连接执行命令出现Connection reset失败时的处理方式

【问题现象】

执行ssh命令时出现Connection reset by 192.168.100.183 port 22

[root@centos35 deploy_183]# sh auto_deploy.sh
+ sshpass -p Root.123 scp -o UserKnownHostsFile=/dev/null -o 'StrictHostKeyChecking no' ./fitstor_api.py 192.168.100.183:/opt/
Warning: Permanently added '192.168.100.183' (ECDSA) to the list of known hosts.
+ sshpass -p Root.123 ssh -o ConnectTimeout=3000 -o UserKnownHostsFile=/dev/null -o 'StrictHostKeyChecking no' root@192.168.100.183 sleep 100
Connection reset by 192.168.100.183 port 22

【解决办法】

删除节点DNS配置,有可能DNS配置不通导致

#192.168.100.183,删除无效的DNS配置
vim /etc/resolv.conf

执行scp导致,连续执行scp和ssh会导致ssh reset,可以增加等待时间 sleep 10

  # Create roles
  sshpass -p ${Master_PW} scp -o UserKnownHostsFile=/dev/null -o 'StrictHostKeyChecking no' ./add_api.py ${Master_IP}:/opt/
  sshpass -p ${Master_PW} ssh -o UserKnownHostsFile=/dev/null -o 'StrictHostKeyChecking no' root@${Master_IP} python /opt/add_api.py
相关文章
|
4月前
|
网络协议 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
|
7月前
|
Linux 网络安全
Linux(16)ssh_exchange_identification: read: Connection reset by peer问题
Linux(16)ssh_exchange_identification: read: Connection reset by peer问题
61 0
|
5月前
|
网络安全 开发工具 git
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
【git】解决git报错:ssh:connect to host github.com port 22: Connection timed out 亲测有效
1222 1
|
5月前
|
网络安全 数据安全/隐私保护
服务器密码登录出现了:SSH connection failed: connect ECONNREFUSEDxxxxxxxx:22 * Xshell提示 SSH connection fa
服务器密码登录出现了:SSH connection failed: connect ECONNREFUSEDxxxxxxxx:22 * Xshell提示 SSH connection fa
|
7月前
|
分布式计算 Hadoop 网络安全
[m1pro ] ssh: connect to host localhost port 22: Connection refused
[m1pro ] ssh: connect to host localhost port 22: Connection refused
|
Linux 网络安全 数据安全/隐私保护
Linux下ssh远程主机报错:ssh_exchange_identification: read: Connection 解决
Linux下ssh远程主机报错:ssh_exchange_identification: read: Connection 解决
208 0
|
iOS开发
iOS 逆向编程(Error)ssh_exchange_identification: read: Connection reset by peer
iOS 逆向编程(Error)ssh_exchange_identification: read: Connection reset by peer
143 0
|
jenkins 持续交付 网络安全
2. 成功解决 BUG:Exception when publishing, ...[Failed to connect and initialize SSH connection...
SSH: Connecting from host [WIN-...] SSH: Connecting with configuration [192.168....] ... ERROR: Exception when publishing, exception message [Failed to connect and initialize SSH connection. Message: [Failed to connect session for config [192.168....]. Message [java.net.ConnectException: Connection
1608 0
|
Linux Shell 网络安全
【Linux】——在Xshell输入ssh root@公网ip进行远程连接Linux失败,显示(port 22): Connection failed的完美解决方法
【Linux】——在Xshell输入ssh root@公网ip进行远程连接Linux失败,显示(port 22): Connection failed的完美解决方法
981 0
|
分布式计算 Hadoop 程序员
Apache Hadoop 启动报错:masternode:ssh: connect to host master port 22: Connection timed out 总结
Apache Hadoop 启动报错:masternode:ssh: connect to host master port 22: Connection timed out 总结
445 0
Apache Hadoop 启动报错:masternode:ssh: connect to host master port 22: Connection timed out 总结