Introduction
When connecting to a cPanel server using FileZilla or another FTP client, you may encounter the error:
Failed to retrieve directory listing
In many cases, this issue occurs when the server is configured behind a NAT environment and the ForcePassiveIP value in the Pure-FTPd configuration is incorrect. Since FTP passive mode relies on the correct public IP address, an invalid setting can prevent directory listings from loading successfully.
This article explains how to identify and fix the issue and make the configuration persistent across future cPanel updates.
Cause
The Pure-FTPd service uses the ForcePassiveIP directive to advertise the server’s public IP address during passive FTP connections.
If:
- The server is behind NAT.
- The public IP address has changed.
- The ForcePassiveIP value is incorrect.
FTP clients may connect successfully but fail when attempting to retrieve directory listings.
Temporary Fix
Edit the Pure-FTPd configuration file:
vi /etc/pure-ftpd.conf
Locate and update:
ForcePassiveIP xx.xx.xx.xx
Replace xx.xx.xx.xx with the correct public IP address.
Restart the Pure-FTPd service:
systemctl restart pure-ftpd
Test the FTP connection again using FileZilla.
Permanent Fix
The configuration in /etc/pure-ftpd.conf may be overwritten during cPanel updates.
To make the change persistent, update the cPanel-managed configuration file:
vi /var/cpanel/conf/pureftpd/main
Set the correct public IP:
ForcePassiveIP: xx.xx.xx.xx
Save the file and rebuild the configuration if required, then restart the Pure-FTPd service.
systemctl restart pure-ftpd
Verification
After updating the configuration:
- Connect using FileZilla.
- Enable Passive Mode in the FTP client.
- Browse directories and upload/download a test file.
- Confirm that the “Failed to retrieve directory listing” error no longer appears.
Conclusion
The “Failed to retrieve directory listing” error in Pure-FTPd is commonly caused by an incorrect ForcePassiveIP configuration, especially on servers operating behind NAT. Updating the correct public IP address and making the change in the cPanel-managed configuration ensures that FTP connections continue to work even after future cPanel upgrades.
Frequently Asked Questions
1. Why does FileZilla show “Failed to retrieve directory listing”?
This typically occurs when Passive FTP mode cannot establish a data connection due to an incorrect ForcePassiveIP setting, firewall restrictions, or NAT-related networking issues.
2. Will cPanel updates overwrite Pure-FTPd configuration changes?
Yes. Direct modifications to /etc/pure-ftpd.conf can be overwritten during cPanel updates. Use /var/cpanel/conf/pureftpd/main for persistent configuration changes.
3. How can I verify the correct ForcePassiveIP value?
Use the server’s public IP address that FTP clients use to connect. If the server is behind NAT, configure the externally accessible public IP rather than the private internal address.
Related Articles
- Install mod_evasive Module in EasyApache 4 on cPanel
- Configure Multiple PHP Versions with LiteSpeed on cPanel
- Modify VirtualHost for a Single Domain in Apache 2.4 on cPanel
Talk to our experts
Looking for the right technology solution for your business? Our team of experts can help you with development, cloud, DevOps, design, and a wide range of other technology needs. Get in touch with our team here.