Need help?

Our experts have had an average response time of 11.7 minutes in August 2021 to fix urgent issues.

We will keep your servers stable, secure, and fast at all times for one fixed price.

“FTP cannot retrieve directory listing” error – We troubleshoot it for you

by | Apr 24, 2019

Are you getting an error like “FTP cannot retrieve directory listing” when you try to access FTP server remotely?

This error is caused due to the bad settings in the FTP server, misconfiguration of FTP client, when passive mode setting disables and much more.

That’s why we often get requests from our customers to solve the error like “FTP cannot retrieve directory listing” as part of our Server Management Services.

Today, we’ll see how our Support Engineers fixed the issue for our customers.

What is “FTP cannot retrieve directory listing” error?

This error “FTP cannot retrieve directory listing” means that the user could not access the files from FTP server.

Users encounter an error message like this.

Error: Failed to retrieve directory listing

Now, let’s see the reasons for the error and the real solution to fix it.

 

Top 4 reasons and solutions to fix it

Here, we have the top 4 reasons for this error to occur and how we troubleshoot it.

 

1. Wrong encryption settings in FTP client

For instance, in FileZilla, when you connect to FTP server, you will see something like this.

Response: 227 Entering Passive Mode (11,22,33,44,167,111)
Command: MLSD
Error: Connection timed out
Error: Failed to retrieve directory listing

This happens when encryption is set to “Use explicit FTP over TLS if available” in FTP client settings.

So, we changed the encryption to “only use plain FTP” by executing the below steps.

1. First, we click on the File menu and choose Site Manager.

2. Then add Host and change Encryption to only use plain FTP.

3. Also, change the Logon Type to Normal and enter Username and Password.

4. Finally, click Connect to continue.

 

2. Problem with Passive mode

FTP operates in both active and passive mode. By default, FTP clients like FileZilla, CuteFTP uses passive as transfer mode.

But, in some cases, you may get an error like “FTP cannot retrieve directory listing” in passive mode. Then, try to change the default transfer mode by simply doing the steps below.

1. Go to Settings > Edit and click on Connection > FTP and choose Active.

2. Then under Active mode IP > select Ask your operating system for the external IP address.

3. Finally, under Passive mode > choose Fall back to active mode and click ok to save.

 

3. Missing passive port range in FTP server

In most of the cases “FTP cannot retrieve directory listing” error happens when passive port range is not mentioned FTP server configuration.

In cPanel for FTP servers like PureFTP, we perform the following steps.

1. We log in to the server via SSH.

2. Open the /var/cpanel/conf/pureftpd/local file and we add the entry like:

ForcePassiveIP: X.X.X.X

We add these changes to the file because FTP server exists behind the firewall.

3. Then we change the server’s default passive port range, by running the command.

echo "PassivePortRange: 49152 65534" >> /var/cpanel/conf/pureftpd/local
/usr/local/cpanel/scripts/setupftpserver pure-ftpd --force

4. Next, we configure the server to allow the passive port range to pass through the firewall.

5. Finally, restart the PureFTP service.

/usr/local/cpanel/scripts/setupftpserver pure-ftpd --force

 

4. Lacking Port range in firewall settings

Often this error happens when a firewall blocks passive FTP ports. So, it results in getting an error like “FTP cannot retrieve directory listing”.

We execute the following steps to add the passive port range to the firewall.

1. For firewall like iptables, we open the /etc/sysconfig/iptables file in a text editor.

2. Then add the entry like:

iptables -I INPUT -p tcp --dport 49152:65534 -j ACCEPT

3. Finally, run the command to save.

service iptables save

This is how we fix the error like “FTP cannot retrieve directory listing”.

 

[Having trouble in “FTP cannot retrieve directory listing” error? We’ll fix it for you.]

 

Conclusion

In short, “FTP cannot retrieve directory listing” error can happen due to a misconfiguration in firewall settings, incorrect passive port range, and more. Today, we’ve discussed the top 4 reasons for this error and how our Technical Engineers fixed them.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

var google_conversion_label = "owonCMyG5nEQ0aD71QM";

1 Comment

  1. Kodu Ali

    Thanks a lot finally it works!!! Problem happening with “2. Problem with Passive mode”

    Reply

Submit a Comment

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

Privacy Preference Center

Necessary

Necessary cookies help make a website usable by enabling basic functions like page navigation and access to secure areas of the website. The website cannot function properly without these cookies.

PHPSESSID - Preserves user session state across page requests.

gdpr[consent_types] - Used to store user consents.

gdpr[allowed_cookies] - Used to store user allowed cookies.

PHPSESSID, gdpr[consent_types], gdpr[allowed_cookies]
PHPSESSID
WHMCSpKDlPzh2chML

Statistics

Statistic cookies help website owners to understand how visitors interact with websites by collecting and reporting information anonymously.

_ga - Preserves user session state across page requests.

_gat - Used by Google Analytics to throttle request rate

_gid - Registers a unique ID that is used to generate statistical data on how you use the website.

smartlookCookie - Used to collect user device and location information of the site visitors to improve the websites User Experience.

_ga, _gat, _gid
_ga, _gat, _gid
smartlookCookie

Marketing

Marketing cookies are used to track visitors across websites. The intention is to display ads that are relevant and engaging for the individual user and thereby more valuable for publishers and third party advertisers.

IDE - Used by Google DoubleClick to register and report the website user's actions after viewing or clicking one of the advertiser's ads with the purpose of measuring the efficacy of an ad and to present targeted ads to the user.

test_cookie - Used to check if the user's browser supports cookies.

1P_JAR - Google cookie. These cookies are used to collect website statistics and track conversion rates.

NID - Registers a unique ID that identifies a returning user's device. The ID is used for serving ads that are most relevant to the user.

DV - Google ad personalisation

IDE, test_cookie, 1P_JAR, NID, DV, NID
IDE, test_cookie
1P_JAR, NID, DV
NID
hblid

Security

These are essential site cookies, used by the google reCAPTCHA. These cookies use an unique identifier to verify if a visitor is human or a bot.

SID, APISID, HSID, NID, PREF
SID, APISID, HSID, NID, PREF