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
相关文章
|
8月前
|
Linux 网络安全 数据安全/隐私保护
Linux下ssh远程主机报错:ssh_exchange_identification: read: Connection 解决
Linux下ssh远程主机报错:ssh_exchange_identification: read: Connection 解决
126 0
|
10月前
|
iOS开发
iOS 逆向编程(Error)ssh_exchange_identification: read: Connection reset by peer
iOS 逆向编程(Error)ssh_exchange_identification: read: Connection reset by peer
107 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
1259 0
|
Linux Shell 网络安全
【Linux】——在Xshell输入ssh root@公网ip进行远程连接Linux失败,显示(port 22): Connection failed的完美解决方法
【Linux】——在Xshell输入ssh root@公网ip进行远程连接Linux失败,显示(port 22): Connection failed的完美解决方法
712 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 总结
338 0
Apache Hadoop 启动报错:masternode:ssh: connect to host master port 22: Connection timed out 总结
ssh2 Connection .connect()方法抛出连接过早关闭异常
ssh2 Connection .connect()方法抛出连接过早关闭异常
ssh2 Connection .connect()方法抛出连接过早关闭异常
|
网络安全
mac下 ssh: connect to host localhost port 22: Connection refused
mac下 ssh: connect to host localhost port 22: Connection refused
712 0
mac下 ssh: connect to host localhost port 22: Connection refused
|
网络安全
mac下 ssh: connect to host localhost port 22: Connection refused
mac下 ssh: connect to host localhost port 22: Connection refused
407 0
|
Linux 网络安全
ssh连接提示 "Connection closed by remote host"
ssh连接提示 "Connection closed by remote host" ** 如果原来是可以用ssh连接的, 突然连接不上通常是连接数过多导致的.
16642 0