Ubuntu – 227 Entering Passive Mode (0,0,0,0,…) when connecting to vsftpd FTP server

ftpport-forwardingUbuntuvirtualboxvsftpd

As said in the title, I don't manage to connect my Windows 10 host to my FTP server on the VirtualBox guest side (Ubuntu 18.04).
On the guest side, the vsftpd server works fine, I can connect without any problem.

So I tried to forward the associated port to the host (NAT) and tried to connect to the server via FileZilla. It does login, but always fails to retrieve directory listing. I tried deactivating the firewalls, giving all the access permissions to the folder but it doesn't change anything.

I read that it could be a problem of passive mode there:
Problems with FTP file access to VirtualBox guest running Windows 2008 Server R2 x64

So I added the following lines to my vsftpd.conf:

pasv_enable=YES
pasv_min_port=8020
pasv_max_port=8020
port_enable=YES
pasv_address=127.0.0.1

I forwarded the port 8020 but I now get the following error on FileZilla:

The data connection could not be established: WSAEADDRNOTAVAIL – Cannot assign requested address

Full FileZilla response:

Status: Connecting to 127.0.0.1:2100...
Status: Connection established, waiting for welcome message...
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/home/cakephp" is the current directory
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   227 Entering Passive Mode (0,0,0,0,31,84).
Command:    LIST
Error:  The data connection could not be established:
WSAEADDRNOTAVAIL - Cannot assign requested address
Error:  Connection timed out after 20 seconds of inactivity
Error:  Failed to retrieve directory listing
Status: Disconnected from server

I'm a bit lost with this, does anybody have a suggestion?
Thanks in advance


EDIT1:
Without any kind of hope, I also tried to access from the Windows Command Prompt. It does connect but when I ls the current folder I get the following error:

500 illegal PORT command.
425 use PORT or PASV first.

But I guess that this is because ftp.exe doesn't support passive mode.

Just in case it can help, you can find here my whole current vsftpd config file.
Also, I can seamlessly access to the guest SSH server from the host with Putty.

EDIT2:
I set listen_ipv6 to YES, changed pasv_max_port to 8030 to increase the number of passive ports and forwarded them. I get the following logs from FileZilla:

Status:  Connecting to 127.0.0.1:2100...
Status: Connection established, waiting for welcome message...
Status: Server does not support non-ASCII characters.
Status: Logged in
Status: Retrieving directory listing...
Command:    PWD
Response:   257 "/home/cakephp" is the current directory
Command:    TYPE I
Response:   200 Switching to Binary mode.
Command:    PASV
Response:   227 Entering Passive Mode (0,0,0,0,31,90).
Command:    LIST
Error:  The data connection could not be established: WSAEADDRNOTAVAIL - Cannot assign requested address
Error:  Connection timed out after 20 seconds of inactivity
Error:  Failed to retrieve directory listing

Best Answer

Response: 227 Entering Passive Mode (0,0,0,0,31,84).

The 0,0,0,0 is most probably due to a known bug in vsftpd.

If that's the case, to fix this, make sure the server does not listen on IPv6 address:

listen_ipv6=NO
listen=YES

For details, see a similar question on Server Fault:
Vsftpd passive reply with 0,0,0,0 address even with correct pasv_address

Related Question