cPanel & WHMLinux

FTP Error loading directory. FTP failed to retrieve directory listing

Mostly we see the FTP Error loading directory. FTP failed to retrieve directory listing error on cPanel NVMe VPS Servers running the default ProFTP client and a firewall like CSF. Older versions of FileZilla before version 3.4 didn’t seem to have this issue. So if you have recently updated your FileZilla FTP client and you now see an error. Similar to cPanel FTP Error loading directory you will likely need to make some changes to the FTP configuration file and firewall. Often the error message being given will be similar to;

  • FTP Connection Error.
  • FTP Error loading directory.
  • SFTP Connection Error: Error loading directory
  • FTP failed to retrieve directory listing

To resolve the error and regain access by FTP first log in to the server as the root user or a user that has root privileges and, if you are using the default FTP client in cPanel open up the configuration file in nano.

Edit FTP Configuration

nano /etc/pure-ftpd.conf

Hit CNTRL+W to search the file and enter the name passive

Next, remove the comment (#) from the line that states “#  PassivePortRange 30000 50000“. Ensure you just remove the ~ and nothing else.

Save and close the file. Next, in your Firewall, you now need to allow this port range. We’re using CSF so from the “config server” menu select “Firewall Configuration” then select “IPv4 Port Settings” and in the ports, box add at the very end “30000:50000”. So your port file should look like this;

2087,2095,2096,3004,5656,5353,30000:50000

our ports may be different but the format should still be the same.

IPTables FTP Firewall Rule

If you’re using just IPtables you can use the following rule to allow the range

iptables -A INPUT -p tcp --match multiport --dports 30000:50000 -j ACCEPT

Now restart FTP and CSF and try to connect to the server using FTP again.

Related Articles

Leave a Reply

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

Back to top button