Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

SOLVED FTP Connects but Timeout with Error Failed to retrieve directory listing

Discussion in 'General Discussion' started by Success1, Sep 8, 2016.

Tags:
  1. Success1

    Success1 Member

    Joined:
    Sep 8, 2016
    Messages:
    13
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Famunda
    cPanel Access Level:
    Root Administrator
    We are in the process of setting up a new server and anytime we try to connect via FTP we get a message stating a successful login, but the connection can not get a directory listing.

    We have tried using the default cPanel user and tried setting up another test FTP account but all ends in the below Error Messsage.

    Code:
    Status:    Disconnected from server
    Status:    Resolving address of *****
    Status:    Connecting to **.**.**.**:21...
    Status:    Connection established, waiting for welcome message...
    Status:    Logged in
    Status:    Retrieving directory listing...
    Command:    PWD
    Response:    257 "/" is your current location
    Command:    TYPE I
    Response:    200 TYPE is now 8-bit binary
    Command:    PASV
    Response:    227 Entering Passive Mode (**,**,**,**,176,105)
    Command:    MLSD
    Error:    The data connection could not be established: ETIMEDOUT - Connection attempt timed out
    Error:    Connection timed out after 40 seconds of inactivity
    Error:    Failed to retrieve directory listing
    Status:    Disconnected from server
    Status:    Resolving address of *****
    Status:    Connecting to **.**.**.**:21...
    Status:    Connection established, waiting for welcome message...
    Status:    Logged in
    Status:    Retrieving directory listing...
    Command:    PWD
    Response:    257 "/" is your current location
    Command:    TYPE I
    Response:    200 TYPE is now 8-bit binary
    Command:    PASV
    Response:    227 Entering Passive Mode (**,**,**,**,118,88)
    Command:    MLSD
    Error:    The data connection could not be established: ETIMEDOUT - Connection attempt timed out
    Error:    Connection timed out after 40 seconds of inactivity
    Error:    Failed to retrieve directory listing
    
     
  2. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,323
    Likes Received:
    49
    Trophy Points:
    178
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    You should follow the directions on cPanel's site for enabling Passive Mode FTP support on the server.

    How to Enable FTP Passive Mode - cPanel Knowledge Base - cPanel Documentation

    In case you don't want to read that, below is what I do.

    You'll want to make sure you have Passive Mode FTP support enabled by uncommenting the appropriate line in /etc/pureftpd.conf and then making sure those ports are open in your firewall.

    1. Edit /etc/pureftpd.conf

    Uncomment the below line and save /etc/pureftpd.conf

    PassivePortRange 30000 50000

    2. Run /scripts/restartsrv_pureftpd to restart pureftpd

    3. Make sure your firewall is allowing incoming connections in the PassivePortRange

    If you are using CSF, look in /etc/csf/csf.conf for a line starting with TCP_IN =

    TCP_IN = "20,21,22,25,26,53,80,110,113,143,443,465,587,967,993,995,2077,2078,2082,2083,2086,2087,2095,2096,30000:35000"

    Notice how the allowing of ranges of ports is set up in CSF - you use 30000:35000.

    4. Run csf -r to apply the CSF config change

    5. In your FTP client make sure you are using Passive mode FTP. I never do this. But I know my firewall on my PC will not block outbound connections from my FTP client. If you aren't sure, then on your PC you will want to force passive mode.

    Mike
     
    kwdamp and cPanelMichael like this.
  3. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Yes, as mentioned in the previous post, you should be able to follow the instructions on the following document to address the problem:

    How to Enable FTP Passive Mode - cPanel Knowledge Base - cPanel Documentation

    Starting with version 60, the cPanel installation process will automatically enable passive mode and ensure the required ports are open as part of the standard firewall configuration.

    Thank you.
     
  4. Ally

    Ally Registered

    Joined:
    May 5, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Canada
    cPanel Access Level:
    Root Administrator
    I am having these exact same problems. I have tried various things such as work with the firewall, and attempt to change to passive mode. When I am in the Cpanel, looking at etc. file I do not see the files I am supposed to be working with and editing (I read the above suggested documentation). After doing a wizard configuration in my FTP it says I MUST set FTP to passive mode, still having troubles as to how I do that.

    Thoughts?
     
  5. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello @Ally,

    Do you have root access to the system? If so, you need to access the server via the command line as the "root" user in order to make the documented changes to the Pure-FTPd configuration file.

    Thank you.
     
  6. Mario Rocha

    Mario Rocha Registered

    Joined:
    May 23, 2017
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    1
    Location:
    Managua
    cPanel Access Level:
    Root Administrator
    ports are opened in the firewall. Everything was working fine until the last update for cPanel.
     
  7. Dave Smith

    Dave Smith Active Member

    Joined:
    Mar 20, 2016
    Messages:
    37
    Likes Received:
    9
    Trophy Points:
    8
    Location:
    Lisbon
    cPanel Access Level:
    Root Administrator
    Run in terminal as Root:

    /sbin/modprobe ip_conntrack_ftp
     
  8. cPanelMichael

    cPanelMichael Forums Analyst
    Staff Member

    Joined:
    Apr 11, 2011
    Messages:
    42,734
    Likes Received:
    1,706
    Trophy Points:
    363
    cPanel Access Level:
    Root Administrator
    Hello,

    Could you open a support ticket using the link in my signature so we can take a closer look? You can post the ticket number here so we can update this thread with the outcome.

    Thank you.
     
  9. kwdamp

    kwdamp Active Member

    Joined:
    Dec 7, 2017
    Messages:
    27
    Likes Received:
    3
    Trophy Points:
    3
    Location:
    usa
    cPanel Access Level:
    Root Administrator
    Had the same issues, and this fixed it perfectly. Thank you for taking the time to type this out.

    The Passive Port range was there in pure-ftpd.conf from the start, though a slightly higher range.
    But the ports were NOT open in CSF's TCP_IN.

    I added them and it worked immediately. My only question is: was opening the ports some kind of security risk? If not, why were they not there (listed) in the first place?
     
    cPanelMichael likes this.
  10. mtindor

    mtindor Well-Known Member

    Joined:
    Sep 14, 2004
    Messages:
    1,323
    Likes Received:
    49
    Trophy Points:
    178
    Location:
    inside a catfish
    cPanel Access Level:
    Root Administrator
    Any time you have to open a port for inbound/outbound access, the cost of doing so needs to be weighed. Because some admins might not allow FTP or some environments might not allow TCP 20 through corporate firewalls, and because people may set their own preference for passive ports, Chirpy probably figured it was best that the admin actually add the passive ports manually rather than have CSF actually try and guess. Just a hunch.

    If you are a server admin who allows FTP access, then you almost certainly will want to make sure that passive mode is supported.

    I'm glad the post helped you out!

    M
     
    cPanelMichael and kwdamp like this.
Loading...

Share This Page