I recently configured my own FTP server and ran into the following problem when connecting to it:

...
Command: MLSD
Error: Connection timed out
Error: Failed to retrieve directory listing

The connection itself actually worked fine. But the directory listing could not be read. I did not find good advice initially on the web, but the solution to the problem was very simple eventually.

FTP is using separate connections through additional ports to transfer data. These ports can be configured with the parameter PassivePorts. Coincidentally, I had secured my server with a firewall blocking all ports except the ones I new were used for running services. So I also blocked the FTP server’s passive ports.

To solve the problem, open up the passive port range on your server. With ufw (uncomplicated firewall) this can be done like so:

ufw allow 60000:610000/tcp

Having done so, passive mode worked perfectly from Filezilla. No need to switch to active mode, as many posts on the internet suggested.

Leave a Reply

Your email address will not be published. Required fields are marked *