paramiko

Paramiko AuthenticationException issue

徘徊边缘 提交于 2019-11-28 09:14:01
I am having a problem connecting to a device with a Paramiko (version 1.7.6-2) ssh client: $ python Python 2.6.5 (r265:79063, Apr 16 2010, 13:09:56) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import paramiko >>> ssh = paramiko.SSHClient() >>> ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) >>> ssh.connect("123.0.0.1", username="root", password=None) Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/usr/lib/pymodules/python2.6/paramiko/client.py", line 327, in connect self._auth(username, password, pkey,

Paramiko Protocol error: expected packet SSH_MSG_USERAUTH_REQUEST, got SSH_MSG_SERVICE_REQUEST

落花浮王杯 提交于 2019-11-28 08:58:45
问题 When I use ssh command to manually connect to the host, everything works fine: $ ssh -v admin@mycli.abc.com -p 10000 OpenSSH_6.1p1, OpenSSL 1.0.1c 10 May 2012 debug1: Reading configuration data /home/todd/.ssh/config debug1: Reading configuration data /etc/ssh/ssh_config debug1: Connecting to mycli.abc.com [mycli.abc.com] port 10000. debug1: Connection established. debug1: identity file /home/todd/.ssh/id_rsa type 1 debug1: identity file /home/todd/.ssh/id_rsa-cert type -1 debug1: identity

Paramiko : Error reading SSH protocol banner

六眼飞鱼酱① 提交于 2019-11-28 08:53:00
Recently, I made a code that connect to work station with different usernames (thanks to a private key) based on paramiko. 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 ? 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

python paramiko外部传参和内部调用命令的方法

给你一囗甜甜゛ 提交于 2019-11-28 08:06:28
import paramikoimport sysimport oshostname = '192.168.1.202'port = 22username = 'root'password = '123456' def shells(args): #从外部调用脚本参数 例如: python paramiko_demo.py ls ifconfig #开启日志 paramiko.util.log_to_file('paramiko.log') s = paramiko.SSHClient() #s.load_host_keys() #不适用公钥登陆 s.set_missing_host_key_policy(paramiko.AutoAddPolicy()) s.connect(hostname, port, username, password) #print(commds()) for i in args: print(i) #打印循环好的列表 ls,ifconfig stdin, stdout, stderr = s.exec_command(i) #分别执行这两个命令 print(stdout.read().decode()) s.close() if __name__ == '__main__': args=sys.argv #args=args shells(args)

Paramiko channel stucks when reading large ouput

梦想的初衷 提交于 2019-11-28 07:45:29
I have a code where i am executing a command on remote Linux machine and reading the output using Paramiko. The code def looks like this: ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect(IPAddress, username=user['username'], password=user['password']) chan = self.ssh.get_transport().open_session() chan.settimeout(10800) try: # Execute thecommand chan.exec_command(cmd) contents = StringIO.StringIO() data = chan.recv(1024) # Capturing data from chan buffer. while data: contents.write(data) data = chan.recv(1024) except socket.timeout: raise socket

Paramiko and exec_command - killing remote process?

大憨熊 提交于 2019-11-28 07:38:44
I'm using Paramiko to tail -f a file on a remote server. Previously, we were running this via ssh -t , but that proved flaky, and the -t caused issues with our remote scheduling system. My question is how to kill tail when the script catches a SIGINT? My script (based on Long-running ssh commands in python paramiko module (and how to end them) ) #!/usr/bin/env python2 import paramiko import select client = paramiko.SSHClient() client.load_system_host_keys() client.connect('someserver', username='victorhooi', password='blahblah') transport = client.get_transport() channel = transport.open

Execute command/script using different shell in SSH/Paramiko

谁说胖子不能爱 提交于 2019-11-28 06:30:34
问题 I am rather new to Linux and Paramiko, but the issue I am having is anytime I attempt to change a shell the remote Paramiko session will hang. The remote host is in /etc/csh by default I am running various scripts, some require csh and others require bash . Any of my scripts running in csh work properly since the remote host is in csh by default. To run the other scripts I need to be in bash . Whenever I attempt to change the shell using bash or /bin/bash paramiko connection will simply hang.

CMDB和运维自动化

亡梦爱人 提交于 2019-11-28 06:12:11
CMDB和运维自动化 2018-05-05 IT运维的分类 传统运维痛点 自动化运维平台的特性 资产管理系统(CMDB) CMDB包含的功能 CMDB实现的四种方式 IT运维的分类 IT运维,指的是对已经搭建好的网络,软件,硬件进行维护。运维领域也是细分的,有硬件运维和软件运维 硬件运维主要包括对基础设施的运维,比如机房的设备,主机的硬盘,内存这些物理设备的维护 软件运维主要包括系统运维和应用运维,系统运维主要包括对OS,数据库,中间件的监控和维护,这些系统介于设备和应用之间,应用运维主要是对线上业务系统的运维 这里讨论的主要是软件运维的自动化,包括系统运维和应用运维的自动化 传统运维痛点 日常工作繁琐 日常运维工作是比较繁琐的,研发同学会经常需要到服务器上查日志,重启应用,或者是说今天上线某个产品,需要部署下环境。这些琐事是传统运维的大部分工作 应用运行环境不统一 在部署某应用后,应用不能访问,就会听到开发人员说,在我的环境运行很好的,怎么部署到测试环境后,就不能用了,因为各类环境的类库不统一 还有一种极端情况,运维人员习惯不同,可能凭自己的习惯来安装部署软件,每种服务器上运行软件的目录不统一 运维及部署效率低下 想想运维人员需要登陆到服务器上执行命令,部署程序,不仅效率很低,并且非常容易出现人为的错误,一旦手工出错,追溯问题将会非常不容易 无用报警信息过多

python, paramiko, ssh exception ssh session not active

女生的网名这么多〃 提交于 2019-11-28 04:41:20
问题 I'm working on a python script that goes to each switch in our network, and issues a copy running-config TFTP command, that backs up the running configuration of the switch. I'm on windows and utilizing the paramiko library in Python 2.7. The script itself is pretty simple, all it does is create a directory called "Backups" if one doesn't exist already, and another directory named today's date, and then uses that directory for the TFTP. And it starts up the TFTP Server. Then it simply issues

paramiko: SSH port forwarding to get SQL dump

和自甴很熟 提交于 2019-11-28 04:33:50
问题 I am trying to use a python script to get an SQL dump from a remote host, with an intermediate host as proxy, like so: local machine -> proxy -> remote The proxy needs to be there because the remote host only allows connections through that proxy. Note: I am aware of a similar question at How to connect to a database through a Paramiko Tunnel (or similar package) but the solution seems to be specific to PostgreSQL. I am making the connection using SSH via paramiko. I am aware that forward.py