Questions tagged [pysftp]

pysftp is a thin wrapper over paramiko's SFTPClient.

pysftp is a thin wrapper over 's SFTPClient.

372 questions
107
votes
9 answers

Verify host key with pysftp

I am writing a program using pysftp, and it wants to verify the SSH host Key against C:\Users\JohnCalvin\.ssh\known_hosts. Using PuTTY, the terminal program is saving it to the Registry [HKEY_CURRENT_USER\Software\SimonTatham\PuTTY\SshHostKeys]. How…
Gabriel Theodoulos
  • 1,189
  • 2
  • 8
  • 5
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
28
votes
3 answers

Upload file via SFTP with Python

I wrote a simple code to upload a file to a SFTP server in Python. I am using Python 2.7. import pysftp srv = pysftp.Connection(host="www.destination.com", username="root", password="password",log="./temp/pysftp.log") srv.cd('public') #chdir to…
guagay_wk
  • 26,337
  • 54
  • 186
  • 295
25
votes
1 answer

Downloading file with pysftp

I'm trying to load (and directly save locally) a .csv file stored on a FTP Server (SFTP protocol). I'm using Python in combination with pysftp library. When I check if the file exists, it returns TRUE. But when trying to load the file, it seems to…
Dendrobates
  • 3,294
  • 6
  • 37
  • 56
18
votes
3 answers

"'Connection' object has no attribute '_sftp_live'" when pysftp connection fails

I'd like to catch nicely the error when "No hostkey for host *** is found" and give an appropriate message to the end user. I tried this: import pysftp, paramiko try: with pysftp.Connection('1.2.3.4', username='root', password='') as sftp: …
Basj
  • 41,386
  • 99
  • 383
  • 673
18
votes
2 answers

"No hostkey for host ***** found" when connecting to SFTP server with pysftp using private key

So I am having many issues connecting to a remote server via SFTP. I have tried the normal way like below. sftp = pysftp.Connection(host='Host',username='username',password='passwd',private_key=".ppk") Which did not work. I got the following error:…
SantiClaus
  • 666
  • 2
  • 8
  • 22
15
votes
3 answers

Connect to SFTP with key file using Python pysftp

I need to connect to a SFTP, download the most recent file, then change the file name and load again to the same SFTP folder and delete the 'original name' file. I have done this with FTP with user and password, however in this case, the SFTP has a…
rubio119
  • 191
  • 1
  • 2
  • 6
13
votes
3 answers

Specify file pattern in pysftp get

We can write a simple get like this: import pysftp hostname = "somehost" user = "bob" password = "123456" filename = 'somefile.txt' with pysftp.Connection(hostname, username=user, private_key='/home/private_key_file') as sftp: …
Saurabh Verma
  • 6,328
  • 12
  • 52
  • 84
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
10
votes
2 answers

How to write a string to file on ftp with pysftp?

I have a large xml file stored in a variable. I want to write it directly to an ftp using pysftp. I believe I need to use the pysftp.putfo and this needs a file like object. Here is a minimal example: from io import StringIO from pysftp import…
Stian
  • 1,221
  • 1
  • 19
  • 26
10
votes
5 answers

pysftp AuthenticationException while connecting to server with private key

I am trying to connect to SFTP server. I have a private key along with a password. I have tried to read related questions on SO, but have been unable to successfully connect. This is what I have tried: pysftp.Connection(host=,…
heathensoul
  • 291
  • 1
  • 2
  • 7
9
votes
2 answers

Use Paramiko AutoAddPolicy with pysftp

This code is not working: def sftp_connection(self): import pysftp connection = pysftp.Connection(self.host, username=self.system_name, private_key=os.path.join(HOME, '.ssh', 'id_rsa')) # in the next lines I try to use…
guettli
  • 25,042
  • 81
  • 346
  • 663
9
votes
2 answers

Explanation of pysftp.Connection.walktree() parameters

I have just started using Python's pysftp and I am confused as how to call it's walktree function. I found some code (found at http://pydoc.net/Python/pysftp/0.2.8/pysftp/) that helped me better understand what form my parameters should take def…
busebd12
  • 997
  • 2
  • 12
  • 24
8
votes
1 answer

Python moving file on SFTP server to another folder

I wrote this script to save a file from an SFTP remote folder to a local folder. It then removes the file from the SFTP. I want to change it so it stops removing files and instead saves them to a backup folder on the SFTP. How do I do that in…
KristianB
  • 83
  • 1
  • 4
7
votes
4 answers

How to fix import error "No module named '_cffi_backend' " when import pysftp from aws-lambda

I'm working on a simple script to connect my sftp server from aws-lambda and I'm getting Unable to import module 'lambda_function': No module named '_cffi_backend' when I import pysftp from aws-lambda. I'm using python3.6 and only import pysftp…
Daniel I. Cruz
  • 1,235
  • 1
  • 12
  • 13
1
2 3
24 25