SSHException: Error reading SSH protocol banner

当我在使用ssh  远程connect 另一台机器的server 时出现了错误,错误如下,起初以为是自己代码写的有问题,后来本地了一下看了跑的没问题,我就开始根据报错去查寻原因,

起初在论坛博客看到这篇文章,试着看了下意思就是你的self.banner默认源码时间设置只有15s  让我修改源码在transform.py 然后离线安装paramiko ,试了后还是报上面的错,试了下还是没什么用网友的技术贴并不是都实用还得靠自己啊,这里的问题可以排除了,继续找原因,查看sshd端口

paramiko   Exception: Error reading SSH protocol banner

File "/usr/local/lib/python3.5/site-packages/paramiko/transport.py", line 2044, in _check_banner
    buf = self.packetizer.readline(timeout)
修改:self.banner_timeout = 15
self.banner_timeout = 300
下载:https://src.fedoraproject.org/repo/pkgs/python-paramiko/ 源码. 我选了:paramiko-1.15.2.tar.gz
tar -xzvf  paramiko-1.15.2.tar.gz
cd paramiko-1.15.2  cd parakimo
vim transport.py   :s/self.banner_timeout 修改为:300  (按N 下一个)
cd ..

python3 setup.py build

python3 setup.py install

3.查询sshd port 配置

ssh localhost 显示端口竟然是36000

ssh: connect to host localhost port 36000: No route to host

为了确认配置是不是被人改了检查sshd配置:

vi   /etc/ssh/sshd_conf

一脸的黑线,你懂的端口默认这里是22 被人改成了36000

重新修改代码port 问题解决:

def run():

    ip = ‘192.168.110.136‘    port = 36000

    pwd = ‘admin‘    user = ‘root‘    client = SshConnect(ip, user, pwd, port)    res = client.exe_cmd(‘pwd&&cd /usr/local&&pwd‘)  # type should be str    log.info(res)

原文地址:https://www.cnblogs.com/SunshineKimi/p/11731065.html

时间: 2024-10-14 07:06:39

SSHException: Error reading SSH protocol banner的相关文章

Spring mvc 中使用ftl引用共通文件出错 FreeMarker template error: Error reading included file "/WEB-INF/ftl/common/errormessage.ftl"

初次接触spring mvc,想做一个小的练习项目,结果在ftl文件中引用其它的共通ftl文件时出错. 目录结构如图所示,想在login.ftl中引用common下的errormessage.ftl <#include '/WEB-INF/ftl/common/errormessage.ftl' /> 结果画面报错: FreeMarker template error: Error reading included file "/WEB-INF/ftl/common/errormes

npm install Error:EPROTO: protocol error, symlink &#39;../mime/cli.js&#39; -&gt; &#39;/vagrant/src/nodejs/node_modules/express/node_modules/send/node_modules/.bin/mime&#39;

我在ubuntu上使用npm安装依赖是出现下面错误: npm ERR! Linux 3.13.0-101-genericnpm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "install" "express"npm ERR! node v4.6.2npm ERR! npm v2.15.11npm ERR! path ../mime/cli.jsnpm ERR! code EPROTO

ERROR: ORA-12560: TNS:protocol adapter error

C:\Users\yan>sqlplus / as sysdba SQL*Plus: Release 11.2.0.2.0 Production on Sun Nov 12 12:04:24 2017 Copyright (c) 1982, 2010, Oracle. All rights reserved. ERROR: ORA-12560: TNS:protocol adapter error 进入Oracle安装目录执行: C:\Users\yan>cd /d D:\oraclexe\a

python error: curl: (1) Protocol &quot;&#39;https&quot; not supported or disabled in libcurl

python 调用curl访问一个网页时,出现error: curl: (1) Protocol "'https" not supported or disabled in libcurl 控制台直接curl xxx是ok的 output = subprocess.check_output(["curl","https://stackoverflow.com/questions/6884669/curl-1-protocol-https-not-suppo

MySQL ERROR Got an error reading communication packets

200 ? "200px" : this.width)!important;} --> 介绍 经常会在错误日志中看到这个报错,复制官方文档的解释. Aborted_connects If a client is unable even to connect, the server increments the Aborted_connects status variable. Unsuccessful connection attempts can occur for the f

Change SSH Welcome Banner on Ubuntu

One of the easiest way to protect and secure SSH logins by displaying warming message to UN-authorized users or display welcome or informational messages to authorized users. Being a system administrator whenever configure Linux servers I always use

&lt;Linux&gt; SSH配置之后 SHH slave1 测试 error:SSH: command not found

首先要查看一下ssh命令存在何处 # which ssh /usr/bin/ssh 使用ssh的绝对路径 # /usr/bin/ssh slave1Welcome to Ubuntu 16.04 LTS (GNU/Linux 4.4.0-21-generic x86_64) * Documentation: https://help.ubuntu.com/ 545 packages can be updated.240 updates are security updates.

&lt;Linux&gt; Ubuntu error: ssh: connect to host master port 22: No route to host lost connection

iptables当找到匹配的规则时,就会执行相应的动作,而不会向下继续匹配.因为ssh端口开放的规则在all规则之后,所以永远都不会匹配到,也就是ssh永远被禁止. root下执行:iptables -I INPUT -p tcp --dport 22 -j ACCEPT 即可.

hadoop报错:WARN mapred.JobClient: Error reading task outputNo route to host

解决方案: /etc/sysconfig/network/etc/hosts$hostname 这三处的主机名都要一样. 具体参考:http://blog.itpub.net/28254374/viewspace-1059607/