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
37
votes
5 answers

Nested SSH session with Paramiko

I'm rewriting a Bash script I wrote into Python. The crux of that script was ssh -t first.com "ssh second.com very_remote_command" I'm having a problem with the nested authentication with paramiko. I wasn't able to find any examples dealing with my…
mqsoh
  • 3,180
  • 2
  • 24
  • 26
37
votes
7 answers

Upload files using SFTP in Python, but create directories if path doesn't exist

I want to upload a file on a remote server with Python. I'd like to check beforehand if the remote path is really existing, and if it isn't, to create it. In pseudocode: if(remote_path not exist): create_path(remote_path) upload_file(local_file,…
franzlorenzon
  • 5,845
  • 6
  • 36
  • 58
35
votes
4 answers

Execute a command on Remote Machine in Python

I am writing a program in python on Ubuntu, to execute a command ls -l on RaspberryPi, connect with Network. Can anybody guide me on how do I do that?
Irfan Ghaffar7
  • 1,143
  • 4
  • 11
  • 30
33
votes
5 answers

How to create a SSH tunnel using Python and Paramiko?

I need to create tunneling to read information from a database. I use Paramiko, but I have not worked with tunneling yet. Please provide an example of a simple code that creates and closes a tunnel.
Ivan
  • 333
  • 1
  • 3
  • 4
33
votes
2 answers

'put' in SFTP using Paramiko

I've installed and written the following Paramiko which is unable to put the file. It is easily able to 'get' a file and execute ls commands on it. #set username & password username='runaway' password='runaway' port=22 source= '/Unzip.sh'…
fixxxer
  • 15,568
  • 15
  • 58
  • 76
32
votes
4 answers

python libraries for ssh handling

I'm going to write first code for handling ssh commands on python and I did search over the stackoverflow and can see that there are several python libraries that can be used for handling commands passed through ssh, like paramiko, pexpect and…
yart
  • 7,515
  • 12
  • 37
  • 37
31
votes
1 answer

Timeout in paramiko (python)

I'm looking for a way to set a timeout for this: transport = paramiko.Transport((host, port)) transport.connect(username = username, password = password) sftp = paramiko.SFTPClient.from_transport(transport) sftp.get(remotepath,…
Kukosk
  • 2,892
  • 1
  • 27
  • 30
31
votes
6 answers

paramiko no existing session exception

Using the python interactive shell and openssh running locally, I keep getting an "No existing session" exception using paramiko. My code is below. import paramiko ssh =…
Sam Johnson
  • 943
  • 1
  • 13
  • 19
30
votes
6 answers

Get output from a Paramiko SSH exec_command continuously

I am executing a long-running python script via ssh on a remote machine using paramiko. Works like a charm, no problems so far. Unfortunately, the stdout (respectively the stderr) are only displayed after the script has finished! However, due to the…
Lukas N.P. Egger
  • 923
  • 2
  • 9
  • 12
29
votes
8 answers

paramiko Incompatible ssh peer (no acceptable kex algorithm)

I'm getting the following error when trying to ssh to a Cisco ACS device using the paramiko library. I've used paramiko in python without issue, and I can ssh to this box from the command line, or using putty without issue. I've turned on…
Tony
  • 391
  • 1
  • 4
  • 11
29
votes
1 answer

pysftp vs. Paramiko

I have a simple requirement to drop a file on an SFTP server. I have found pysftp and Paramiko libraries that seem to allow me to this and developed a simple application using Paramiko but I can't find a proper source that compares the two so I can…
Jorjani
  • 827
  • 1
  • 16
  • 31
29
votes
2 answers

No module named 'winrandom' when using pycrypto

I already spent 2 days trying to install pyCrypto for Paramiko module. So, first issue I had faced was this: >>> import paramiko Traceback (most recent call last): File "", line 1, in File "C:\Program…
vedburtruba
  • 1,089
  • 1
  • 9
  • 10
28
votes
3 answers

Turning off logging in Paramiko

I am using the ssh client provided by Paramiko to create a function call remoteSSH (the file name is remoteConnect.py): import paramiko import logging logger = paramiko.util.logging.getLogger() logger.setLevel(logging.WARN) def…
user963986
  • 363
  • 1
  • 5
  • 10
27
votes
11 answers

Paramiko AuthenticationException issue

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. >>>…
waffleman
  • 4,159
  • 10
  • 39
  • 63
26
votes
3 answers

Paramiko: Add host_key to known_hosts permanently

This code helps me make an ssh connection. I know that set_missing_host_key_policy helps when the key is not found in the known_hosts. But it is not behaving like the actual ssh, because after the first time I run this code, I assumed that that the…
nidHi
  • 833
  • 3
  • 10
  • 21