I'm trying to send a file to a ftp server using the ftplib library.
I have tied two different approaches.
1st)
from ftplib import FTP
ftp = FTP('HOST')
ftp.login('USERNAME','PASSWORD')
On this case when I try to login I get the following error:
ftplib.error_perm: 550 SSL/TLS required on the control channel.
2nd)
from ftplib import FTP_TLS
ftp = FTP_TLS('HOST')
ftp.login('USERNAME','PASSWORD')
file = open('test.xml','rb') # file to send
session.storbinary('STOR test.xml', file)
In this case I can confirm that I'm able to connect and login into the server but when trying to send the file, using storbinary
, I get the same error:
ftplib.error_perm: 550 SSL/TLS required on the control channel.
Any suggestions?
I was able to solve the problem by adding:
ftp.prot_p() # switch to secure data connection
After
ftp.login('USERNAME','PASSWORD')
with that I was able to perform all kind of actions on the ftp server