FTP - Status: Retrieving directory listing...

Discussion in 'Installation/Configuration' started by EckyBrazzz, Feb 13, 2017.

  1. EckyBrazzz

    EckyBrazzz Member

    Hi,

    My pure-ftp-mysql instalatoin suddenly stoped working. It does login fine, but it stops at Retrieve directory listing.
    Code:
    Status:    Resolving address of ftp.xxxxx.com.br
    Status:    Connecting to 52xxxx.xx: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:    PORTxxx,xx,xxx,195,103
    Response:    200 PORT command successful
    Command:    MLSD
    Error:    Connection timed out after 20 seconds of inactivity
    Error:    Failed to retrieve directory listing
    
    I have spend all night to resolve this, but I did not succeed with it.
    I have an instance at Amazon AWS. I do have an elastic IP attached to the instance.
    Dubbel checked the firewalls (ISPConfig, notebook, router and the Amzon firewall)
    Set PassivePortRange, ForecePassiveIP

    Code:
    Feb 13 07:22:27 secure pure-ftpd: ([email protected]) [INFO] New connection from 177.18.12.0
    Feb 13 07:22:27 secure pure-ftpd: ([email protected]) [DEBUG] Command [user] [eckybrazzzvecks]
    Feb 13 07:22:27 secure pure-ftpd: ([email protected]) [DEBUG] Command [pass] [<*>]
    Feb 13 07:22:27 secure pure-ftpd: ([email protected]) [INFO] eckybrazzzvecks is now logged in
    Feb 13 07:22:27 secure pure-ftpd: ([email protected]) [DEBUG] Command [opts] [UTF8 ON]
    Feb 13 07:22:28 secure pure-ftpd: ([email protected]) [DEBUG] Command [pwd] []
    Feb 13 07:22:28 secure pure-ftpd: ([email protected]) [DEBUG] Command [type] [I]
    Feb 13 07:22:28 secure pure-ftpd: ([email protected]) [DEBUG] Command [port] [177,18,12,0,195,112]
    Feb 13 07:22:28 secure pure-ftpd: ([email protected]) [DEBUG] Command [mlsd] []
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [INFO] New connection from 177.18.12.0
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [user] [eckybrazzzvecks]
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [pass] [<*>]
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [INFO] eckybrazzzvecks is now logged in
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [opts] [UTF8 ON]
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [pwd] []
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [type] [I]
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [port] [177,18,12,0,195,113]
    Feb 13 07:22:48 secure pure-ftpd: ([email protected]) [DEBUG] Command [mlsd] []
    Feb 13 07:23:01 secure CRON[2897]: (root) CMD (/usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Feb 13 07:23:01 secure CRON[2900]: (root) CMD (/usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Feb 13 07:23:52 secure pure-ftpd: ([email protected]) [INFO] Logout.
    Feb 13 07:24:01 secure CRON[2923]: (root) CMD (/usr/local/ispconfig/server/server.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Feb 13 07:24:01 secure CRON[2924]: (root) CMD (/usr/local/ispconfig/server/cron.sh 2>&1 | while read line; do echo `/bin/date` "$line" >> /var/log/ispconfig/cron.log; done)
    Feb 13 07:24:12 secure pure-ftpd: ([email protected]) [INFO] Logout.
    
     
    Last edited: Feb 13, 2017
  2. barbanza

    barbanza New Member

    Do you have open TCP/UDP ports in AWS ?

    Sample:

    EC2 -> NETWORK & SECURITY -> Security Groups: default -> Inbound:

    Custom TCP Rule TCP 21 0.0.0.0/0
    Custom TCP Rule TCP 65526 - 65535 0.0.0.0/0
    Custom UDP Rule UDP 65526 - 65535 0.0.0.0/0

    Remember open same ports at ISPConfig firewall and config Pure-FTPd for this range, for this sample:
    Code:
    echo "10" > /etc/pure-ftpd/conf/MaxClientsNumber
    echo 'yes' > /etc/pure-ftpd/conf/DontResolve
    echo '65526 65535' > /etc/pure-ftpd/conf/PassivePortRange
    
    /etc/init.d/pure-ftpd-mysql restart
    
     
  3. EckyBrazzz

    EckyBrazzz Member

    Thanks for your quick response, but done all these parts already. Until now it keeps hanging at Retrieving directory listing
     
  4. barbanza

    barbanza New Member

    Do you use FileZilla as client ? I have same issue one year ago only with FileZilla client (other FTP clients work fine but not FileZilla). If you searh about "Failed to retrieve Directory Listing" you can view a lot issues with FileZilla connection in passive mode.

    First try to connect to server in active mode (not passive or auto), if you can connect and retrieve directory try to add TCP port 20 to AWS & ISPConfig firewall and try again in passive mode:

    Custom TCP Rule TCP 20 0.0.0.0/0
    Custom TCP Rule TCP 21 0.0.0.0/0
    Custom TCP Rule TCP 65526 - 65535 0.0.0.0/0
    Custom UDP Rule UDP 65526 - 65535 0.0.0.0/0

    Yes, rare, TCP port 20 (FTP data) its required for active mode, not for passive, but in my case this resolve this issue and I can connect with FileZilla in passive mode to my AWS instance.

    Note: remember to use high passive range greater than or equal to 1024 (strongly recommended 49152-65534).
     
  5. EckyBrazzz

    EckyBrazzz Member

    Update : After done all the above I could get into the directory but it only worked for 50%. After 100 files or so the upload didn't complete anymore and kept in a repeated mode.
    After setting the login with PLAIN text the problem was resolved. The files flew to the server, now I have to find a way to encrypt my connection..... I used an self-compiled version of OpenSSL ( OpenSSL 1.1.0d from source ), going back to the systems OpenSSL
     
  6. barbanza

    barbanza New Member

    I remember I have this ussue more 1 year ago only with AWS and FileZilla and resolve it open TCP 20/21 and TCP/UDP passive range ports at AWS Security group and ISPConfig firewall and Post-FTPd, I dont require open it at router/pc firewall at client side, only open it at server.

    From this date FTP passive mode work fine for my and (my AWS instance are installed with perfect server guide from HowToForge and os installed are Debian Wheezy).

    Only diference with your case are located at Elastic IP, if you are in Free Tier program you can try to request and assign one to your AWS instance.

    Elastic IP have one little charge outside Free Tier program, but are free at Free Tier program. AWS only charge for it if you request it and dont associate to one AWS instance (sample if you request one IP, delete your instante associate to it and IP continue listed in your AWS control panel Elastic IP).

    If you delete instance remember release your IP at Elastic IP and this resolve this little issue, if you delete your instance to open new one at only delay some minutes and like use same Elastic IP (sample because you have reverse dns to it with your server name) dont release it, AWS charge only some cents for time you IP are not associated to one instance, and stop charge it when you reasociate to one new instance.
     

Share This Page