I opened from firewall port 21 for FTP on Google Cloud Engine but I can only connect via active mod to FTP. I want to use passive mod too.

According to https://stackoverflow.com/questions/24566692/filezilla-ftp-server-fails-to-retrieve-directory-listing port 50000-55000 must be open but I tried that. This answers is not worked on my situation. When I open all ports to TCP I can connect via passive mod but I do not want to open all ports (or do i need to open all ports ??)

Here i found all port things:

Passive mode

In passive mode, the client has no control over what port the server chooses for the data connection. Therefore, in order to use passive mode, you'll have to allow outgoing connections to all ports in your firewall.

My question is do i need to open all ports for passive mod or can i something else ?


OS: CentOS 7 with latest packages

FTP Service: PureFTPd


When I try on passive mod, logs says logged in, after stucks at retreiving file list (i can't post logs because my log file is not English)

Thanks & Regards

  • Show us some logs and/or error messages that you are getting with the passive mode. Do not even try the active mode. Are you connecting to or from the GCE? Jan 5, 2017 at 12:07
  • When I try on passive mod, logs says logged in, after stucks at retreiving file list (i can't post logs because my log file is not English)
    – ahmetertem
    Jan 5, 2017 at 12:10

1 Answer 1


Add the following:

PassivePortRange 50000 55000



and i think that your problem will be solved. Keep in mind that this port range should also be allowed in your firewall.


Quoted from this wonderful source:

In passive mode FTP the client initiates both connections to the server, solving the problem of firewalls filtering the incoming data port connection to the client from the server. When opening an FTP connection, the client opens two random unprivileged ports locally (N > 1023 and N+1). The first port contacts the server on port 21, but instead of then issuing a PORT command and allowing the server to connect back to its data port, the client will issue the PASV command. The result of this is that the server then opens a random unprivileged port (P > 1023) and sends P back to the client in response to the PASV command. The client then initiates the connection from port N+1 to port P on the server to transfer data.

the trick here is that with the

PassivePortRange 50000 55000

directive will force pureFtp to pick random ports from this range that you have previously allowed in your firewall.

  • Thanks it worked but i want to ask anyway; I found a line starts with PassivePortRange and ports. Which one is correct a) open 50000-55000 or default passiveportrange ?
    – ahmetertem
    Jan 5, 2017 at 12:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .