Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a Windows 2008 R2 Amazon EC2 and it needs to download a file from an external server via ftp. The file name is different everyday so I have to ls and then get the newest file. ls fails:

[REDACTED]:\[REDACTED]>ftp [REDACTED]
Connected to [REDACTED].
220 ProFTPD 1.3.3c Server ready.
User ([REDACTED]:(none)): [REDACTED]
331 Password required for [REDACTED]
Password:
230 User [REDACTED] logged in
ftp>ls
Connection closed by remote host.
ftp>

So it takes a while for it to say "Connection closed by remote host." this is what happens when I try on any non-Amazon EC2 Windows 2008 R2 server:

[REDACTED]:\[REDACTED]>ftp [REDACTED]
Connected to [REDACTED].
220 ProFTPD 1.3.3c Server ready.
User ([REDACTED]:(none)): [REDACTED]
331 Password required for [REDACTED]
Password:
230 User [REDACTED] logged in
ftp>ls
200 PORT command successful
150 Opening ASCII mode data connection for file list
photos
tmp
key
logs
customer
reversefeed
reviews
thesaurus
incoming
ad
226 Transfer complete
ftp: 144 bytes received in 0.01Seconds 18.00Kbytes/sec.
ftp>

So just to be clear I'm not running an FTP Server, I am trying to connect to one and download a file. But it is unable to open the data transfer channel. What do I need to change in the Amazon EC2 config for this to work?

Thanks in advance.

share|improve this question

2 Answers 2

This is usually (in my experience) a problem caused by a firewall or filter/proxy on one end of the connection not properly handling PASV (passive) FTP connections. First thing I'd try is using an active FTP connection, and then I'd try to remove the firewall(s) from the equation, which will give you a fairly exact indication of where the issue lies.

And, just as a general point of interest, SFTP (FTP over SSH) does not suffer from this active/passive problem (it's a single, "active" connection), in addition to being a secure, encrypted method of transferring files. You should probably switch to it, if possible. It will probably eliminate your problem, and wrap a layer of security around your file transfers at the same time.

share|improve this answer
    
I have no control over the server and must connect to them via the protocol they provide. It is an $8 million profit a year company so they don't care if I am encountering issues. –  Robert Louis Murphy Sep 21 '12 at 16:13
1  
@RobertLouisMurphy Then you're limited to making sure there's no firewall or proxy/filter on your end blocking things, or trying to use an ACTIVE FTP connection. Might also consider dumping those asshats too. I'm pretty sure my current employer makes more than 8 million dollars profit a week, and I get tickets for $externalcustomer having issues connecting to $oursystem a fair bit. If I told them I didn't care because we make so much money already, I'd be fired. Time to maybe consider that these guys are small time asshats and your business is better given to a competitor. –  HopelessN00b Sep 21 '12 at 16:25

Both FTP and FTPS use 2 or more ports in their connection protocol. You need to open at least 2 ports to make them work. For FTP, its usually 21 and 20. For FTPS its usually 989 and 990 I think. So, I think most people prefer to use SFTP, which uses a single port tunnelled in a SSL channel, usually on port 22, which is the same port that SSH shells use.

You can verify ports using this batch script:

@echo off
cls
ECHO TCP ports that are listening...
ECHO.
ECHO   Prot   Local Address          Foreign Address        State           PID
ECHO.
netstat -an -o | find "LISTENING"
ECHO.
pause
share|improve this answer
    
You know I'm running a client, not a server right? My issue is the the data stream. –  Robert Louis Murphy Sep 21 '12 at 16:51
    
Yes, that much is clear. Really when it comes down to it, you just need to verify the servers ports are open (depending on protocol type) and also that the client is not being blocked on any of the ports outgoing either. It isn't a hard thing to troubleshoot if you just look at it from a technical perspective... –  djangofan Sep 25 '12 at 15:09

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.