windows 7 - CMD FTP Issues Works on Server 2012, Not on Win 7

07
2014-07
  • Mr T

    I have the below command script running as a scheduled task on my Win 2012 Server without any issues. I want to replicate this on a clients Win 7 x64 computer.

    echo user [username]>> c:\ftp1.dat
    echo [my password]>> c:\ftp1.dat
    echo bin>> c:\ftp1.dat
    echo mkdir web2>> c:\ftp1.dat
    echo cd web2>> c:\ftp1.dat
    echo mkdir clientpc_%date:~-2,4%-%date:~-7,2%-%date:~-10,2%>> c:\ftp1.dat
    echo cd clientpc_%date:~-2,4%-%date:~-7,2%-%date:~-10,2%>> c:\ftp1.dat
    echo ascii>> c:\ftp1.dat
    echo quote pasv>> c:\ftp1.dat
    echo mput c:\Users\Administrator\Documents\backup_temp\*.*>> c:\ftp1.dat
    echo quit>> c:\ftp1.dat
    echo bye>> c:\ftp1.dat
    ftp -n -s:c:\ftp1.dat -i ftp.livedrive.com
    del c:\ftp1.dat
    

    However, when I get to mput, the command prompt informs me

    1. 200 PORT COMMAND SUCCESSFUL
    2. 150 Accepting Data Connection

    At which point the process just hangs. No error, no timeout, nothing. I mean nothing for 5-10 minutes.

    The setup is running Norton 360 which has the Firewall switched off.

    I've also tried active mode.

    Note that the earlier MKDIR commands work, so presumably there is no server contact issue. I can't seem to find any help on the web. Everyone with my issue seems to get a timeout issue, but thats not the case here.

    Thanks

  • Answers
  • Steffen Ullrich

    Its a connection issue. FTP needs a control connections for basic commands like login and mkdir, and for the real data transfer it opens another TCP connection: in passive mode the server opens a listener on a random port and tells the client about its address and in active mode the client opens a listener on a random port and tells the server about it.

    The control connection is working for your, but the data connection not. This means, that there is something restricting the connectivity, e.g. some kind of firewall either on your computer, the server computer or somewhere in between.


  • Related Question

    windows 7 - Command-line FTP function does not work
  • Hong

    I am using Windows 7 and have multiple FTP client applications working without any problem. However when I use command-line FTP, I can get connected, log in (after entering user name and password) but it always get disconnected when dir or ls command is used. The response is "Connection closed by remote host".

    Any tip would be greatly appreciated.


  • Related Answers
  • Matt H

    You'll usually see this type of thing happen when the server tries to connect back to you but can't. FTP originally used two TCP channels. One was for commands, and the other for transferring data. When you run the dir command it uses a data channel. The data channel is established on demand and results in the server trying to connect back to you.

    That's most likely being blocked by your router or windows firewall. What you need is a client that supports PASV mode.

    You can enable PASV mode in internet explorer. http://compnetworking.about.com/cs/novellgroupwise/ht/setpassiveftpie.htm

    Or use a different client. I'm not sure if the command line version can use PASV mode. It's a very basic client.

  • Diogo

    I encountered this problem on a Windows 2008 server.

    This article suggests enabling the Application Layer Gateway Service. This did not fix the problem for me.

    What did fix the problem was adding an exception in the Windows Firewall for C:\Windows\system32\ftp.exe

  • slhck

    I was experiencing the same issue with 3rd party POS software on a Windows 7 machine that batches client transaction data over back to a SQL server.

    It worked fine until the client location changed ISPs and, therefore, static IPs. Command line FTP commands did not work beyond the initial login and none of the remedies I found online or this thread worked.

    Just for kicks, I re-created the FTP rule in the firewall, a cheapo D-Link, and viola, it seems to be working again.

  • Indrek

    I had an issue with transmitting files via FTP once I was logged into the box in question. It would create the file name, but the file was empty. I resolved by doing the following:

    • go to Control Panel → Windows Firewall → Advanced Settings → Inbound Rules
    • double-click the Name column to sort by name
    • scroll down until you see two rules called "File Transfer Program"; these were set to Block on my PC (big red circle with a line through it)
    • double-click on the rule
    • on the General tab, under Action, set to "Allow the connection"
    • click OK
    • do this for the other rule

    Should be good to go now.