python ftplib login OK but ftp.retrlines KO

51 views Asked by At

I try this python code with python 3.11.4 :

f = FTP(ftp_host)
print(f.login(ftp_login, ftp_password))
print(f.pwd())
f.retrlines('LIST')
f.close()

f.login, return :

230 Login successful.

f.pwd() return:

/home/ftp_login

But f.retrlines('LIST') doesn't works

Exception has occurred: TimeoutError [WinError 10060] Une tentative de connexion a échoué car le parti connecté n’a pas répondu convenablement au-delà d’une certaine durée ou une connexion établie a échoué car l’hôte de connexion n’a pas répondu

I have the same error using

f.nlst('/home/{}'.format(ftp_login)

I specify that the server to which I am trying to connect is a CentOS7 VM of which I am the administrator and I have just installed the vsftpd service then launched like this

sudo systemctl restart vsftpd

I have tried, to do the same things with CLI, from the same computer:

C:\Users\ME>ftp 192.168.0.103
Connecté à 192.168.0.103.
220 (vsFTPd 3.0.2)
200 Always in UTF8 mode.
Utilisateur (192.168.0.103:(none)) : login
331 Please specify the password.
Mot de passe :
230 Login successful.
ftp> ls
200 PORT command successful. Consider using PASV.
150 Here comes the directory listing.
PROJECT_DATA
DATA
test.txt
226 Directory send OK.
ftp : 31 octets reçus en 0.00 secondes à 31000.00 Ko/s.
ftp>
0

There are 0 answers