Linux Paramiko 错误:读取 SSH 协议横幅时出错
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/7206272/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Paramiko Error: Error reading SSH protocol banner
提问by Mridang Agarwalla
I'm using Fabric for my build script. I just cloned one of my VMs and created a new server. The Fabric script (which uses paramiko underneath) works fine one server but not the other. Since it's a clone I don't know what could be different but everytime I run my Fabric script I get the error Error reading SSH protocol banner
. This script is connecting with the same user on both servers. The script works fine on all other servers except this new one that I just clones. The only thing that is radically different is the IP address which is totally different range.
我正在将 Fabric 用于我的构建脚本。我刚刚克隆了一个虚拟机并创建了一个新服务器。Fabric 脚本(在下面使用 paramiko)在一台服务器上运行良好,但在另一台服务器上运行良好。由于它是一个克隆,我不知道有什么不同,但每次运行我的 Fabric 脚本时,我都会收到错误消息Error reading SSH protocol banner
。此脚本与两台服务器上的同一用户连接。除了我刚刚克隆的这个新服务器之外,该脚本在所有其他服务器上都可以正常工作。唯一完全不同的是 IP 地址的范围完全不同。
Any ideas on what could be causing this?
关于可能导致这种情况的任何想法?
采纳答案by Mridang Agarwalla
This issue didn't lie with Paramiko, Fabric or the SSH daemon. It was simply a firewall configuration in ISPs internal network. For some reason, they don't allow communication between different subnets of theirs.
这个问题不在于 Paramiko、Fabric 或 SSH 守护进程。它只是 ISP 内部网络中的防火墙配置。出于某种原因,他们不允许他们的不同子网之间进行通信。
We couldn't really fix the firewall configuration so instead we switched all our IPs to be on the same subnet.
我们无法真正修复防火墙配置,因此我们将所有 IP 切换到同一子网上。
回答by Gabriel Ross
Try changing the banner timeout from 15 seconds to 30 secs in the transport.py file. Also, it could be that the sshd daemon on the server is hung. Can you SSH into it manually?
尝试在 transport.py 文件中将横幅超时从 15 秒更改为 30 秒。此外,也可能是服务器上的 sshd 守护进程挂了。您可以手动通过 SSH 登录吗?