FTP Connection Error : Error loading directory. FTP failed to retrieve directory listing
A common issue with Filezilla is the fact it just won’t connect to some servers. Mostly we see this on cPanel servers running the default ProFTP client. 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 can’t now connect to your server using FTP 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 Connection Error: Error loading directory
- FTP failed to retrieve directory listing
To resolve the error and gain access by FTP first log in to the server as the root user or a user that has root privileges and, if your using the default FTP client in cPanel open up the configuration file in nano.
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;
Your ports may be different but the format should still be the same. 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.
How was this article?