Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

All of my computer are behind a single router. I have a FileZilla server running on one of them. I am trying to automate an upload to the server using a batch script and Window's built-in ftp.exe. I have set up a dynamic DNS service to be able to access my server from outside the router and I have set up port forwarding in the router to my server. I can connect and transfer just fine using Google Chrome, Windows Explorer, and the FileZilla client. However, whenever I try using ftp.exe (either manually or in batch script) I can connect to the server but if I try doing anything that would open a data connection (LIST, STOR, or RETR) I get the following error: 425 Can't open data connection. I have allowed ftp.exe in both computer's firewalls. Any ideas what is going on or how I could fix it? I don't need to use ftp.exe if anyone knows of a portable independent (just an exe with no other files) command line client.

EDIT I know that my ISP blocks many ports including 21 and several others in that range. This is all set up on port 2121, with the passive ports set up to be 2122-2142, all of these have been forwarded in the router. Perhaps ftp.exe will only use a certain port for data connection, which my ISP blocked? If so how would I change this?

share|improve this question

3 Answers 3

up vote 4 down vote accepted

Regular active FTP uses a separate server-initiated data connection for transfers and only uses the regular port 21 connection as the control channel. When the client is behind a firewall, however, the firewall is likely to block this connection. I'm guessing Chrome, Explorer, FireZilla, etc. are smart enough to try passive mode, in which the original client-initiated connection is used as both the control and data channel.

It appears that Windows' default CLI FTP client doesn't support passive mode. So you'll need to switch to NcFTP. Alternatively, and I think probably the better option, is just to use SFTP instead. FTP is insecure and really only to be used on LANs. SFTP is fully encrypted and also only uses a single channel for data and commands. If you need a CLI SFTP client, PSFTP is a good option.

share|improve this answer
    
I have already tried that with no luck –  Garrett Apr 13 '12 at 11:58
    
@Garrett: Hrmm... it appears that the blog article I linked to is wrong, and the default CLI FTP client doesn't support passive mode. In that case, you'll have to switch FTP clients. NcFTP is one option, and it definitely supports passive mode. –  Lèse majesté Apr 13 '12 at 12:03
    
I watched the request/response while transferring through Windows Explorer, used quote to manually send the exact same commands, yet still got the same error –  Garrett Apr 13 '12 at 12:03
    
@Garrett: I thought Windows Explorer worked? If the client doesn't support passive mode, then telling the server to switch to it won't matter. –  Lèse majesté Apr 13 '12 at 12:06
    
Does it support command line, and is it an independent exe? –  Garrett Apr 13 '12 at 12:06

Windows FTP CLI does support PASSIVE mode. Use "quote pasv" to enter into passive mode.

share|improve this answer
    
I don't think that actually works. Can you confirm that quote pasv actually does something in ftp.exe and isn't just a dummy command? –  Lèse majesté Oct 1 '13 at 9:28

I had this problem as well. The solution was stop the firewall of the antivirus (in my case the McAfee), it was blocking the ports of FTP.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.