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.

We have a legacy system that is using the built in Windows commandline ftp client to upload files to an ftp server. It does this using the -s switch, with an ftp file something like the following:

debug
open myftpsite.com 21
<username>
<password>
cd remote_folder
ascii
lcd "c:\myfolder"
prompt
put export.txt export.tx
rename export.tx export.txt
quit

This works 99% of the time, but the other 1% of the time it doesn't. When it runs successfully the resulting logfile contains response messages from the server like "250 OK" after each of the commands above. The problem is sometimes it seems to fail to connect then we get NO messages in the logfile (from the server or ftp client) at all. The ftp client also still seems to return a process exit code of 0.

Does anybody have any suggestions for:

Getting better logging back from the built in Windows commandline ftp client? AND\OR Forcing it to return a Process Exit Code other than 0 to indicate something has gone wrong?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Your best bet is to run Wireshark or tcpdump on either the client or the server when you are using FTP to try and discover what's actually going wrong. Something like the example below should be sufficient.

tcpdump -vv -w ftp_capture.log port ftp

Try using either just Active or Passive mode to see if it's a firewall issue. Try a better FTP client such as WinSCP, or Filezilla. And finally, examine whether you need to use FTP at all. There are far better and more secure options such as SCP/SFTP.

share|improve this answer
    
Problem is it happens very rarely so would I have to run wireshark\tcpdump on all ftp sessions until it happens to get something useful? What I'm really wondering is why the windows ftp commandline client doesn't report any errors? Is it just "crap"? –  mutex May 19 '11 at 22:11
    
Basically yes. It is crap. You could also try using a better FTP client. –  kce May 19 '11 at 22:15
1  
hah, fair enough. That's pretty much what I suspect, was just hoping I wouldn't need to make too many changes. Legacy systems, the bane of my life. ;-) +1 and answer (err, ok I'll +1 when I have 15 reputation) –  mutex May 19 '11 at 22:20
    
Yeah. Legacy systems...ugh. –  kce May 19 '11 at 22:26
add comment

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.