ftpfilezilla

Filezilla FTP Server Fails to Retrieve Directory Listing


I'm running Filezilla Server 0.9.45 beta to manage my server remotely. After setting it up, I tested connecting to it using the IP 127.0.0.1, and it worked successfully. However, to connect to the server remotely, I port forwarded to port 21, and tried to connect using my computer's IP.

Status: Connecting to [My IP]:21...
Status: Connection established, waiting for welcome message...
Response:   220 Powered By FileZilla Server version 0.9.45 beta
Command:    USER hussain khalil
Response:   331 Password required for user
Command:    PASS *********
Response:   230 Logged on
Status: Connected
Status: Retrieving directory listing...
Command:    CWD /
Response:   250 CWD successful. "/" is current directory.
Command:    PWD
Response:   257 "/" is current directory.
Command:    TYPE I
Response:   200 Type set to I
Command:    PORT 192,168,0,13,205,63
Response:   200 Port command successful
Command:    MLSD
Response:   150 Opening data channel for directory listing of "/"
Response:   425 Can't open data connection for transfer of "/"
Error:  Failed to retrieve directory listing

This continues to work locally, but not when connecting remotely... How can I fix this?


Solution

  • When you send the port command to your server, you are asking the server to connect to you (on the remote network). If the remote network also has a NAT router, and you have not port-forwarded the port you are sending with your PORT command, the server will not be able reach you.

    The most common solution would be to send the PASV command to the server instead of the PORT command. The PASV command will ask the server to create a listening socket and accept a connection from the remote machine to establish the data connection.

    For the PASV command to work, you will also need to port-forward a range of ports for the passive data connections. The passive connection ports (which need to be forwarded) should be listed in the FileZilla documentation.