[错误解决]paramiko.ssh_exception.SSHException: Error reading SSH protocol banner 设置
2024-08-29 23:35:45
报错信息
上午的时候数据组的同事跟我说有几个程序报错,经过查看log发现找到报错信息:
paramiko.ssh_exception.SSHException: Error reading SSH protocol banner
经过搜索,得知引起该错误的原因是因为banner_timeout默认设置太短,只有15s。
错误分析
经查看paramiko库下面的transport.py下面的Transport代码如下:
class Transport(threading.Thread, ClosingContextManager):
self.banner_timeout = 15
# how long (seconds) to wait for the handshake to finish after SSH
重设banner_timeout属性值
网上的方法大多数是修改源码,重新安装,感觉略麻烦。这里在代码里面进行属性重新设置。
transport = paramiko.Transport((self.host, self.port))
print(transport.banner_timeout)
transport.banner_timeout = 30
print(transport.banner_timeout)
经过测试,两次打印出来的属性值不同,说明属性设置成功,问题解决。
最新文章
- 运维请注意:”非常危险“的Linux命令大全
- 最全面的 C++ 资源、框架大全
- ios github网址
- public static void main(String[] args){}函数理解
- 状压DP SGU 223 Little Kings
- 象写程序一样写博客:搭建基于github的博客
- 安装eclipse for c/c++环境
- linux环境中 对tomcat配置java环境
- 超强vim配置文件
- angular中ueditor插件的使用
- 用sql语句按周、按月、按季、按年统
- winsock编程WSAEventSelect模型
- 无锁同步-JAVA之Volatile、Atomic和CAS
- 【Centos 7】使用screen恢复终端连接
- vue_条件渲染_v-if_v-else_v-show
- open()函数 linux中open函数使用
- SpringDataJPA
- Jira客户端
- atoi函数原型
- Linux sort命令使用方法