FTP Active vs passive mode

ftp

I have a FTP server and while doing testing I found an odd issue that I don't understand. I send a RETR command on file "/Folder1/file.txt" and it works fine. Then I send a RETR command on file "/Folder1/SubFolder1/file.txt" and it times out on transfering the data to the client. This was in active mode. When I switch to passive mode it works fine.

I understand the difference between the two modes, but what I don't understand is why it worked for one file in active mode, but not the other. I tried it a dozen times and still got the same results.

Any ideas? Thanks!

Best Answer

If you check the official specification of the File Transfer Protocol, you'll find that:

FTP can be run in active mode or passive mode, which control how the second connection is opened. In active mode the client sends the server the IP address port number that the client will use for the data connection, and the server opens the connection. Passive mode was devised for use where the client is behind a firewall and unable to accept incoming TCP connections. The server sends the client an IP address and port number and the client opens the connection to the server. Both modes were updated in September 1998 to add support for IPv6 and made some other changes to passive mode, making it extended passive mode.

So, my first thought is that there's something wrong with your folder permissions. Double check them.