使用多进程启动多个ssh报错:
Exception (client): Error reading SSH protocol banner[Errno 104] Connection reset by peer
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/root/anaconda3/envs/Python38/lib/python3.8/site-packages/paramiko/transport.py", line 2091, in run
self._check_banner()
File "/root/anaconda3/envs/Python38/lib/python3.8/site-packages/paramiko/transport.py", line 2272, in _check_banner
raise SSHException(
Traceback (most recent call last):
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner[Errno 104] Connection reset by peer
File "/root/anaconda3/envs/Python38/lib/python3.8/site-packages/paramiko/transport.py", line 2268, in _check_banner
buf = self.packetizer.readline(timeout)
File "/root/anaconda3/envs/Python38/lib/python3.8/site-packages/paramiko/packet.py", line 374, in readline
buf += self._read_timeout(timeout)
File "/root/anaconda3/envs/Python38/lib/python3.8/site-packages/paramiko/packet.py", line 601, in _read_timeout
x = self.__socket.recv(128)
ConnectionResetError: [Errno 104] Connection reset by peer
其中一种可能原因是目标Linux系统的ssh连接数有限制,可尝试修改ssh连接数后重启ssh:
vim /etc/ssh/sshd_config
文章来源:https://www.toymoban.com/news/detail-708940.html
MaxStartups参数可以设置最大未认证连接数。默认设置是 10:30:100,意思是从第10个连接开始以30%的概率拒绝新连接,直到连接数达到100为止。文章来源地址https://www.toymoban.com/news/detail-708940.html
# Ubuntu系统
/etc/init.d/ssh restart
# Centos系统
service sshd restart
到了这里,关于Python 报错处理 paramiko.ssh_exception.SSHException: Error reading SSH protocol banner的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!