SFTP using ftplib
29,720
As the question you linked to states, ftplib doesn't support SFTP (which is a transfer protocol over SSH and has nothing to do with FTPS, FTP over SSL). Use the recommended Paramiko instead.
Author by
Abruzzo Forte e Gentile
Updated on December 03, 2020Comments
-
Abruzzo Forte e Gentile over 3 years
I need to download a file from a host using SFTP.
Do you know if is it possible to do that using Python ftplib? I saw an example here, but when I try to connect I receive
EOFError
.I tried this code:
import ftplib ftp = ftplib.FTP() ftp.connect( "1.2.3.4", "22" )
This method returns with an error after long time so I cannot perform a call to login. I cannot try the constructor
FTP([host[, user[, passwd[, acct[, timeout]]]]])
because my port is 22 butftplib
default is 21.If I follow the example
ftp = ftplib.FTP("1.2.3.4") ftp = ftplib.FTP("1.2.3.4","22")
I receive a connection refused so I cannot enter any username password. Can you help me? Thank you very much
-
Abruzzo Forte e Gentile over 14 yearsAuch.. I am sorry! I didn't realize it. Thank you very much