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:
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.]
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.
The post “FTP cannot retrieve directory listing”; error –; We troubleshoot it for you appeared first on Bobcares.