Paramiko:读取 SSH 协议横幅时出错 [英] Paramiko : Error reading SSH protocol banner

查看:77
本文介绍了Paramiko:读取 SSH 协议横幅时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

最近,我制作了一个基于 paramiko 连接到不同用户名(多亏了私钥)工作站的代码.

Recently, I made a code that connect to work station with different usernames (thanks to a private key) based on paramiko.

我从来没有遇到过任何问题,但是今天,我遇到了:SSHException:读取 SSH 协议横幅时出错

I never had any issues with it, but today, I have that : SSHException: Error reading SSH protocol banner

这很奇怪,因为它在任何连接上都是随机发生的.有什么办法可以解决吗?

This is strange because it happens randomly on any connections. Is there any way to fix it ?

推荐答案

这取决于您所说的修复"是什么意思.正如评论中指出的,根本原因是拥塞/缺乏资源.这样,它类似于某些 HTTP 代码.这是正常原因,可能是 ssh 服务器返回了错误的标头数据.

It depends on what you mean by "fix". The underlying cause, as pointed out in the comments, are congestion/lack of resources. In that way, it's similar to some HTTP codes. That's the normal cause, it could be that the ssh server is returning the wrong header data.

429 Too Many Requests,告诉客户端使用速率限制,或者如果超出配额,有时 API 会以类似的方式返回 503.这个想法是,稍后再试,延迟.

429 Too Many Requests, tells the client to use rate limiting, or sometimes APIs will return 503 in a similar way, if you exceed your quota. The idea being, to try again later, with a delay.

您可以尝试在代码中处理此异常,稍等片刻,然后重试.您还可以编辑您的 transport.py 文件,将横幅超时设置为更高的值.如果您的应用程序的服务器响应速度无关紧要,则可以将其设置为 60 秒.

You can attempt to handle this exception in your code, wait a little while, and try again. You can also edit your transport.py file, to set the banner timeout to something higher. If you have an application where it doesn't matter how quickly the server responds, you could set this to 60 seconds.

这篇关于Paramiko:读取 SSH 协议横幅时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆