Ftp – VSFTPD: The data connection could not be established: ETIMEDOUT – Connection attempt timed out

ftpubuntu-18.04vsftpd

On July 7, our web server was dead. We restarted it and found that it received a Kernel 41 error, but this is not our problem right now.

We have three machines on that server, one with Windows (and it works perfectly fine), second is a Gateway with CentOS and that one works too. The third machine is the issue, with Ubuntu 18.4 and FTP.

After reboot our FTP server runs ufw, I closed\stopped it, so now we can connect to FTP, but not always.

FileZilla does not work properly with it, there is always an ETIMEOUT, 425 failed to establish connection, and cannot get a list.
I double checked the firewall (on the Gateway and on FTP) was turned off, on the Gateway I checked iptables and there are ACCEPT ALL rules.

There is our vsftpd.conf:

listen=YES

pasv_enable=YES

pasv_min_port=62000

pasv_max_port=65535

port_enable=YES

anonymous_enable=YES

no_anon_password=YES

anon_root=/home/ftpadmin

local_enable=YES

#local_umask=022 #local_root=/home/ftpadmin

write_enable=YES

listen_port=2121

connect_from_port_20=YES

chmod_enable=YES

chroot_local_user=YES

allow_writeable_chroot=YES

passwd_chroot_enable=YES

ascii_upload_enable=YES

ascii_download_enable=YES

pasv_adress=xx.x.xxx.xxx

pasv_addr_resolve=NO

dirlist_enable=NO

user_config_dir=/etc/vsftd_conf_dir

FileZilla Error:
Respond: 227 Entering Passive Mode (46,4,134,230,252,52).
Command: LIST
Error: The data connection could not be established: ETIMEDOUT – Connection
attempt timed out

tracert packets got stuck only on the FTP server, they got past the gateway, so I presume there is only problem in FTP, but I might be wrong.

Best Answer

This problem can have multiple causes but, when I see your configuration I immediately will give you the following suggestion:

Change dirlist_enable=NO to dirlist_enable=YES

Furthermore make sure to improve logging with adding the following lines to your vsftpd.conf:

xferlog_enable=YES
log_ftp_protocol=YES
xferlog_file=/var/log/ftp/xferlog

Also make sure to check /var/log/vsftpd.log for errors.