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

x11 forwarding with paramiko

I'm trying to run a command with paramiko that should be able to open an X window. The script I'm using would something as follows: import paramiko ssh_client =…
jcollado
  • 39,419
  • 8
  • 102
  • 133
17
votes
4 answers

Paramiko: "FutureWarning: CTR mode needs counter parameter"

I am trying to use Paramiko in Python2 for transferring files through SFTP with a private SSH key but it displays this warning: /usr/lib/python2.7/dist-packages/Crypto/Cipher/blockalgo.py:141: FutureWarning: CTR mode needs counter parameter, not IV…
Adrián Kálazi
  • 250
  • 1
  • 2
  • 13
16
votes
8 answers

Paramiko and exec_command - killing remote process?

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…
victorhooi
  • 16,775
  • 22
  • 90
  • 113
16
votes
6 answers

How to delete all files in directory on remote SFTP server in Python?

I'd like to delete all the files in a given directory on a remote server that I'm already connected to using Paramiko. I cannot explicitly give the file names, though, because these will vary depending on which version of file I had previously put…
Cuga
  • 17,668
  • 31
  • 111
  • 166
16
votes
2 answers

ImportError: No module named 'paramiko'

I have done through the other questions online here, and I feel that mine is different enough to warrant a new question. So I have a Centos 6 box, which is running a small website for me, acts as an office git server and I am trying to configure…
jeff_h
  • 519
  • 1
  • 9
  • 26
14
votes
3 answers

Python send control + Q then control + A (special keys)

I need to send some special keystrokes and am unsure of how to do it. I need to send Ctrl + Q followed by Ctrl + A to a terminal (I'm using Paramiko). i have tried shell =…
AlexW
  • 2,843
  • 12
  • 74
  • 156
14
votes
5 answers

SQLAlchemy through Paramiko SSH

I have a database on a server which I need to access through SSH. Right now I deal with the DB by using the command line to get the data. import paramiko ssh =…
Alexis G
  • 1,259
  • 3
  • 14
  • 27
14
votes
2 answers

Do you have to check exit_status_ready if you are going to check recv_ready()?

I am running a remote command with: ssh = paramiko.SSHClient() ssh.connect(host) stdin, stdout, stderr = ssh.exec_command(cmd) Now I want to get the output. I have seen things like this: # Wait for the command to finish while not…
David Doria
  • 9,873
  • 17
  • 85
  • 147
14
votes
5 answers

Paramiko: read from standard output of remotely executed command

so I was working with paramiko for some basic SSH testing and I'm not getting any output into stdout. Heres my code. import paramiko client=paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) com="ls…
ollien
  • 4,418
  • 9
  • 35
  • 58
13
votes
8 answers

Recursive directory download with Paramiko?

I want to download a directory with unknown contents recursively via SSH and have been trying Paramiko. I have seen several examples how to upload directories but none that covers recursive download. I can list all items in a directory but haven't…
Arahman
  • 414
  • 1
  • 5
  • 12
13
votes
2 answers

Paramiko - connect with private key - not a valid OPENSSH private/public key file

I am trying to find the solution to this and can't understand what I'm doing wrong. On my Linux server I have run the following command: ssh-keygen -t rsa This generated an id_rsa and id_rsa.pub file. I then copied them both locally and attempted…
whoisearth
  • 4,080
  • 13
  • 62
  • 130
13
votes
3 answers

paramiko combine stdout and stderr

I am trying to combine the output of stdout and stderr. My belief is that this can be done with the set_combine_stderr() of a Channel object. This is what I am doing: SSH = paramiko.SSHClient() #I connect and everything OK, then: chan =…
DanielS
  • 265
  • 1
  • 2
  • 12
13
votes
3 answers

obtaining error number of an error

I need to obtain the error number from an error that has occurred in Python. Ex; When trying to transfer a directory via the Paramiko package, an error is caught with this piece of code: try: sftp.put(local_path,target_path) except…
fixxxer
  • 15,568
  • 15
  • 58
  • 76
13
votes
2 answers

Paramiko with continuous stdout

I use Paramiko to run some ssh commands to the remote Linux server. The commands will have continuous output in the console and I want to print these all information in the local console window. stdin, stdout, stderr =…
Alfred
  • 165
  • 1
  • 1
  • 8
13
votes
3 answers

Write a local string to a remote file using python paramiko

I need to write a string to a file on a remote host using python's paramiko module. I've been trialing various methods of redirecting input but with no success. The localstring in the below code snippet is populated with the result of a cat…
user2451085
  • 131
  • 1
  • 1
  • 4