Questions tagged [paramiko]

Paramiko is a Python module that implements the SSH2 protocol.

Paramiko is a Python module that implements the SSH2 protocol. It is written entirely in Python and released under the GNU LGPL license.

Links:

2658 questions
12
votes
1 answer

paramiko.SSHException: Error reading SSH protocol banner

I am using Paramiko and trying to connect to my SFTP server. Here is the code I wrote: class SFTPUploader: def __init__(self, host, username, password, port): transport = paramiko.Transport((host, port)) print transport …
masnun
  • 11,635
  • 4
  • 39
  • 50
12
votes
2 answers

Upload a file-like object with Paramiko?

I have a bunch of code that looks like this: with tempfile.NamedTemporaryFile() as tmpfile: tmpfile.write(fileobj.read()) # fileobj is some file-like object tmpfile.flush() try: self.sftp.put(tmpfile.name, path) except…
Brendan Long
  • 53,280
  • 21
  • 146
  • 188
12
votes
3 answers

How to keep ssh session not expired using paramiko?

I intend to run several commands on remote host using paramiko, but the ssh session closed after running a command. The code listed below: from paramiko import SSHClient import paramiko ssh =…
J.Wang
  • 1,241
  • 3
  • 13
  • 17
12
votes
4 answers

Paramiko - ssh to console server, having to hit return for script to continue

Just using my first paramiko script, we have an opengear console server, so I'm trying to automate setup of any device we plug into it. The open gear listens for ssh connections on ports, for example a device in port 1 would be 3001. I am connecting…
AlexW
  • 2,843
  • 12
  • 74
  • 156
12
votes
1 answer

Paramiko error: size mismatch in put

I am trying to copy few files from my local windows directory to remote linux dir. It is working for file having same kind of extension. But breaks when there are different extensions in a folder. The Code: import os import glob import…
May
  • 1,158
  • 2
  • 13
  • 24
12
votes
5 answers

Python import paramiko error "cannot import name util"

I have installed the paramiko module. However, when I tried to import that module. I got the following error. import paramiko --------------------------------------------------------------------------- ImportError …
Eaton Chow
  • 205
  • 2
  • 4
  • 9
12
votes
3 answers

How to check paramiko version installed?

I have installed paramiko 1.15.2 on Linux machine. But i want to know its version via command. Is there any command that prints out version of paramiko installed?
akkidukes
  • 189
  • 1
  • 1
  • 9
12
votes
4 answers

Running Sudo Command with paramiko

I am trying to execute a sudo command on a remote machine using python-paramiko, when I execute the command, I bind it with 3 streams, and I use the input stream to pass the password, but it doesn't work, this is the traceback result: Traceback…
user3176971
  • 599
  • 2
  • 6
  • 16
12
votes
4 answers

How to know if a paramiko SSH channel is disconnected?

I'm desinging test cases in which I use paramiko for SSH connections. Test cases usually contain paramiko.exec_command() calls which I have a wrapper for (called run_command()). Here self.ssh is an intance of paramiko.SSHClient(). I use a decorator…
Milo
  • 655
  • 1
  • 12
  • 25
12
votes
2 answers

Paramiko: Port Forwarding Around A NAT Router

Configuration LOCAL: A local machine that will create an ssh connection and issue commands on a REMOTE box. PROXY: An EC-2 instance with ssh access to both LOCAL and REMOTE. REMOTE: A remote machine sitting behind a NAT Router (inaccessible by…
cooncesean
  • 1,294
  • 2
  • 18
  • 26
12
votes
2 answers

fabric keeps asking for password using SSH connection

I'm trying to connect to a windows azure instance using fabric, but despite I configure ssh conection to execute commands, fabric keeps asking for password. This is my fabric file: def azure1(): env.hosts = ['host.cloudapp.net:60770'] …
kothvandir
  • 2,111
  • 2
  • 19
  • 34
12
votes
1 answer

Dynamic Hosts and Parallel Tasks with Fabric library

Is there a way to dynamically modify hosts in between multiple parallel tasks? This is what I have so far. def init_hosts(): env.hosts = [host1,host2,host3,host4] @parallel def task_1(): if condition is False: …
dj29
  • 161
  • 1
  • 5
11
votes
5 answers

Python paramiko script, problems reading output during exec_command()

Background: I am using python and paramiko to automate the process I go through everytime I have to hand in a program for a class. We use a command called "handin" to submit source code, but this must be done from a school computer. So when I…
macgregor
  • 150
  • 1
  • 1
  • 10
11
votes
5 answers

Issues trying to SSH into a fresh EC2 instance with Paramiko

I'm working on a script that spins up a fresh EC2 instance with boto and uses the Paramiko SSH client to execute remote commands on the instance. For whatever reason, the Paramiko client is unabled to connect, I get the error: Traceback (most recent…
rr.
  • 6,484
  • 9
  • 40
  • 48
11
votes
1 answer

Reading file opened with Python Paramiko SFTPClient.open method is slow

I am trying to remote read a netcdf file. I used Paramiko package to read my file, like this: import paramiko from netCDF4 import Dataset client =…
Chun-Ye Lu
  • 343
  • 1
  • 2
  • 10