FTP Failed to Retrieve Directory Listing error Fix


Failed to open directory listing

cPanel is shipped with two FTP Server PureFTP and ProFtp. PureFTP is more widely used as its more optimized for cpanel utilizing less resources. If ftp server is not properly configured with firewall users will get Failed to retrieve directory listing error and FTP client will be struck loading directory index.


Error: Connection timed out after 20 seconds of inactivity
Error: Failed to retrieve directory listing

To explain the error it means FTP client is trying to communicate on passive ports at server which are blocked in server firewall.

In order to fix this you first need to specify passive port range in pureftp.conf and then open up those passive port range in firewall.

1) Login to Shell as root with your favorite SSH client
2) PureFTP config file is called pure-ftpd.conf and its usually in /etc folder.

Open pure-ftpd.conf using vi or nano
vi /etc/pure-ftpd.conf

Search file for string “Port range for passive connections replies” or “Passive connections”. You will end up with this code

# Port range for passive connections replies. - for firewalling.


# PassivePortRange 30000 50000

Remove Comment # from above code and save the file so that new code is

# Port range for passive connections replies. - for firewalling.

PassivePortRange 30000 50000


This will tell PureFTP to use 30000 to 50000 as Passive port range.

Restart FTP service using this command

/etc/init.d/pure-ftpd restart

3) Now open Port 30000 to 50000 in your server firewall, If you are using CSF Firewall then simply edit /etc/csf/csf.conf File and add this at end of TCP_IN TCP_OUT
30000:50000

You can also do this from WHM -> Plugins -> ConfigServer Security & Firewall -> Firewall Configuration -> IPV4_Port Settings

Leave a comment

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