I have a script that should connect to a FTP
from ftplib import FTP
with FTP('IP') as ftp:
ftp.login(user='my user', passwd='my password')
ftp.cwd('/MY_DIR')
ftp.dir()
I have an error :
ConnectionRefusedError: [Errno 111] Connection refused
The ftp is an EC2 with vsftpd
pasv_enable=YES
pasv_min_port=1024
pasv_max_port=1048
pasv_address=IP
pasv_addr_resolve=YES
Already tried :
The code work on other FTP with and without TLS (hosted on 1and1, OVH...)
I tried this script in NodeJS
const ftpClient = require('ftp-client');
const client = new ftpClient({
host: "IP",
port: 21,
user: "My user", // defaults to "anonymous"
password: "My password" // defaults to "@anonymous"
});
client.connect(() => {
client.download('/MY_DIR/file','/tmp/file', (res) => {
console.log(res)
})
});
Works perfectly fine so I exclude a firewall problem
I have tried enable TLS
ssl_enable=YES
require_ssl_reuse=NO
then sudo service vsftpd restart
and use
FTP_TLS
instead of FTP
but did not work
Also I tried disable passive mode by setting
pasv_enable=NO
then
sudo service vsftpd restart
and ftp.set_pasv(False)
didn't work either