Command-line FTP function does not work












11














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 gets disconnected when the dir or ls command is used. The response is:




Connection closed by remote host.




How can I fix this problem?










share|improve this question
























  • Open up ports 20, 21 in your firewall.
    – Sean Perkins
    Nov 19 '15 at 19:15
















11














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 gets disconnected when the dir or ls command is used. The response is:




Connection closed by remote host.




How can I fix this problem?










share|improve this question
























  • Open up ports 20, 21 in your firewall.
    – Sean Perkins
    Nov 19 '15 at 19:15














11












11








11


2





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 gets disconnected when the dir or ls command is used. The response is:




Connection closed by remote host.




How can I fix this problem?










share|improve this question















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 gets disconnected when the dir or ls command is used. The response is:




Connection closed by remote host.




How can I fix this problem?







windows-7 command-line ftp






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited May 9 '16 at 17:32









Peter Mortensen

8,331166184




8,331166184










asked Nov 28 '10 at 2:56









Hong

2092410




2092410












  • Open up ports 20, 21 in your firewall.
    – Sean Perkins
    Nov 19 '15 at 19:15


















  • Open up ports 20, 21 in your firewall.
    – Sean Perkins
    Nov 19 '15 at 19:15
















Open up ports 20, 21 in your firewall.
– Sean Perkins
Nov 19 '15 at 19:15




Open up ports 20, 21 in your firewall.
– Sean Perkins
Nov 19 '15 at 19:15










6 Answers
6






active

oldest

votes


















13














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. You need a client that supports PASV mode.



You can enable PASV mode in Internet Explorer. Or use a different client. I'm not sure if the command-line version can use PASV mode. It's a very basic client.






share|improve this answer























  • Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
    – Hong
    Nov 28 '10 at 4:53










  • As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
    – barlop
    Nov 28 '10 at 23:15






  • 1




    ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
    – Bratch
    Jun 28 '12 at 17:10






  • 6




    it needs to be QUOTE PASV
    – JosephStyons
    Jul 10 '12 at 5:29



















5














Windows FTP command-line client ftp.exe supports an active FTP mode only.



Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.



It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection for the directory listing (ls or dir commands).



Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT command), which the server is obviously not able to use.



See my article Network Configuration for Active Mode.





If possible, you should use a passive mode as it typically requires no additional setup on a client-side.



Unfortunately Windows FTP command-line client (the ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.



Use any other Windows FTP command-line client instead. Most other support passive mode.



For example WinSCP defaults to passive mode and there's a guide available for converting Windows FTP script to WinSCP script.



(I'm the author of WinSCP)






share|improve this answer























  • It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
    – Martin Prikryl
    Dec 20 '18 at 14:07












  • You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
    – Martin Prikryl
    Dec 20 '18 at 14:12












  • Np, please delete the comments.
    – Martin Prikryl
    Dec 20 '18 at 14:13



















4














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 it 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


It should be good to go now.






share|improve this answer























  • What are the security implications of doing this?
    – Peter Mortensen
    May 9 '16 at 17:37










  • Programs on your pc can now use ftp.
    – Mark Deven
    Dec 20 '18 at 12:10



















3














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:Windowssystem32ftp.exe






share|improve this answer























  • By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
    – Jags
    Mar 5 '14 at 15:12



















0














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



It worked fine until the client location changed ISPs and, therefore, static IP addresses. 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 router/firewall, and viola, it seems to be working again.






share|improve this answer































    0














    FTP issue



    Open Ports on azure NSG and server firewall: 21,20,4000-40009,990,14147



    Issue: Client cannot connect to ftp from command line and Powershell



    We are able to connect with testuser but not able see the directory/List



    Installed Wireshark on server and on my laptop to capture packets
    Created a filter on wireshark with “ftp” and “IP”
    The packet capture doesn’t states weather is it passive or active mode and source IP is correct. (we configure primary IP and secondary IP on the server)



    We found that the ftp connection is not working from the command prompt.
    trying to initiate a connection to ftp.abcd.com which was resolving to 11.22.33.44 and not to the actual FTP Server 44.33.22.11
    IP addresses 11.22.33.44 and 44.33.22.11 are both configured on the same Machine. However, the DNS was resolving to the secondary FTP IP instead of Primary



    Initially, We also found that the FTP connections to 11.22.33.44 was working fine and these connections were Active connections. We were unable to see that the Passive mode works here. Also while initiating connection to 11.22.33.44 from Commad promt the session freezes after you give 'dir' command however the same is working with other ftp clients like FileZilla and Winscp.



    I tried testing with WinSCP and FileZilla and got to see Passive mode connections are working fine and Active not which is an expected behavior.
    We checked why the 'dir' command is not working from the devices after the successful authentication, we got to see that the windows firewall is blocking the connection. We disabled the firewall and the everything started working as expected.
    I checked the same on my end after creating the firewall rule, issues were resolved. There was one system which even after disabling firewall was stuck at directory listing, this might be an issue within that system or the connections are being blocked by an external factor.
    Since after disabling most of us are able to work fine.



    settings need to be done on the machine
    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






    share|improve this answer





















    • This is what the answer by @Keljo already says (actually you have copied his/hers answer).
      – Martin Prikryl
      Dec 20 '18 at 5:14













    Your Answer








    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "3"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f215775%2fcommand-line-ftp-function-does-not-work%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    6 Answers
    6






    active

    oldest

    votes








    6 Answers
    6






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    13














    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. You need a client that supports PASV mode.



    You can enable PASV mode in Internet Explorer. Or use a different client. I'm not sure if the command-line version can use PASV mode. It's a very basic client.






    share|improve this answer























    • Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
      – Hong
      Nov 28 '10 at 4:53










    • As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
      – barlop
      Nov 28 '10 at 23:15






    • 1




      ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
      – Bratch
      Jun 28 '12 at 17:10






    • 6




      it needs to be QUOTE PASV
      – JosephStyons
      Jul 10 '12 at 5:29
















    13














    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. You need a client that supports PASV mode.



    You can enable PASV mode in Internet Explorer. Or use a different client. I'm not sure if the command-line version can use PASV mode. It's a very basic client.






    share|improve this answer























    • Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
      – Hong
      Nov 28 '10 at 4:53










    • As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
      – barlop
      Nov 28 '10 at 23:15






    • 1




      ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
      – Bratch
      Jun 28 '12 at 17:10






    • 6




      it needs to be QUOTE PASV
      – JosephStyons
      Jul 10 '12 at 5:29














    13












    13








    13






    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. You need a client that supports PASV mode.



    You can enable PASV mode in Internet Explorer. Or use a different client. I'm not sure if the command-line version can use PASV mode. It's a very basic client.






    share|improve this answer














    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. You need a client that supports PASV mode.



    You can enable PASV mode in Internet Explorer. Or use a different client. I'm not sure if the command-line version can use PASV mode. It's a very basic client.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 9 '16 at 17:35









    Peter Mortensen

    8,331166184




    8,331166184










    answered Nov 28 '10 at 4:11









    Matt H

    3,39822343




    3,39822343












    • Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
      – Hong
      Nov 28 '10 at 4:53










    • As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
      – barlop
      Nov 28 '10 at 23:15






    • 1




      ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
      – Bratch
      Jun 28 '12 at 17:10






    • 6




      it needs to be QUOTE PASV
      – JosephStyons
      Jul 10 '12 at 5:29


















    • Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
      – Hong
      Nov 28 '10 at 4:53










    • As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
      – barlop
      Nov 28 '10 at 23:15






    • 1




      ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
      – Bratch
      Jun 28 '12 at 17:10






    • 6




      it needs to be QUOTE PASV
      – JosephStyons
      Jul 10 '12 at 5:29
















    Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
    – Hong
    Nov 28 '10 at 4:53




    Thanks, Matt. I thought the command-line FTP client used passive mode by default but I have just found multiple posts saying Windows command-line FTP actually excludes passive mode. IE always works fine on my machine for FTP. I just want to use command-line to examine some raw data from an FTP server.
    – Hong
    Nov 28 '10 at 4:53












    As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
    – barlop
    Nov 28 '10 at 23:15




    As an experiment, you could see if enabling or disabling PASV in internet explorer makes a difference.. or gives similar or the same error.
    – barlop
    Nov 28 '10 at 23:15




    1




    1




    ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
    – Bratch
    Jun 28 '12 at 17:10




    ftp> PASV - Invalid command. (Windows 7 Ent.). This answer is exactly what happens at work.
    – Bratch
    Jun 28 '12 at 17:10




    6




    6




    it needs to be QUOTE PASV
    – JosephStyons
    Jul 10 '12 at 5:29




    it needs to be QUOTE PASV
    – JosephStyons
    Jul 10 '12 at 5:29













    5














    Windows FTP command-line client ftp.exe supports an active FTP mode only.



    Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.



    It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection for the directory listing (ls or dir commands).



    Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT command), which the server is obviously not able to use.



    See my article Network Configuration for Active Mode.





    If possible, you should use a passive mode as it typically requires no additional setup on a client-side.



    Unfortunately Windows FTP command-line client (the ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.



    Use any other Windows FTP command-line client instead. Most other support passive mode.



    For example WinSCP defaults to passive mode and there's a guide available for converting Windows FTP script to WinSCP script.



    (I'm the author of WinSCP)






    share|improve this answer























    • It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
      – Martin Prikryl
      Dec 20 '18 at 14:07












    • You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
      – Martin Prikryl
      Dec 20 '18 at 14:12












    • Np, please delete the comments.
      – Martin Prikryl
      Dec 20 '18 at 14:13
















    5














    Windows FTP command-line client ftp.exe supports an active FTP mode only.



    Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.



    It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection for the directory listing (ls or dir commands).



    Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT command), which the server is obviously not able to use.



    See my article Network Configuration for Active Mode.





    If possible, you should use a passive mode as it typically requires no additional setup on a client-side.



    Unfortunately Windows FTP command-line client (the ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.



    Use any other Windows FTP command-line client instead. Most other support passive mode.



    For example WinSCP defaults to passive mode and there's a guide available for converting Windows FTP script to WinSCP script.



    (I'm the author of WinSCP)






    share|improve this answer























    • It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
      – Martin Prikryl
      Dec 20 '18 at 14:07












    • You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
      – Martin Prikryl
      Dec 20 '18 at 14:12












    • Np, please delete the comments.
      – Martin Prikryl
      Dec 20 '18 at 14:13














    5












    5








    5






    Windows FTP command-line client ftp.exe supports an active FTP mode only.



    Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.



    It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection for the directory listing (ls or dir commands).



    Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT command), which the server is obviously not able to use.



    See my article Network Configuration for Active Mode.





    If possible, you should use a passive mode as it typically requires no additional setup on a client-side.



    Unfortunately Windows FTP command-line client (the ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.



    Use any other Windows FTP command-line client instead. Most other support passive mode.



    For example WinSCP defaults to passive mode and there's a guide available for converting Windows FTP script to WinSCP script.



    (I'm the author of WinSCP)






    share|improve this answer














    Windows FTP command-line client ftp.exe supports an active FTP mode only.



    Setting up the FTP in the active mode can be cumbersome nowadays due to firewalls and NATs.



    It's likely because of your local firewall or NAT that the server was not able to connect back to your client to establish data transfer connection for the directory listing (ls or dir commands).



    Or your client is not aware of its external IP address and provides an internal address instead to the server (in PORT command), which the server is obviously not able to use.



    See my article Network Configuration for Active Mode.





    If possible, you should use a passive mode as it typically requires no additional setup on a client-side.



    Unfortunately Windows FTP command-line client (the ftp.exe) does not support passive mode at all. It makes it pretty useless nowadays.



    Use any other Windows FTP command-line client instead. Most other support passive mode.



    For example WinSCP defaults to passive mode and there's a guide available for converting Windows FTP script to WinSCP script.



    (I'm the author of WinSCP)







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Nov 21 '16 at 13:15

























    answered Mar 3 '15 at 14:01









    Martin Prikryl

    10.8k43276




    10.8k43276












    • It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
      – Martin Prikryl
      Dec 20 '18 at 14:07












    • You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
      – Martin Prikryl
      Dec 20 '18 at 14:12












    • Np, please delete the comments.
      – Martin Prikryl
      Dec 20 '18 at 14:13


















    • It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
      – Martin Prikryl
      Dec 20 '18 at 14:07












    • You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
      – Martin Prikryl
      Dec 20 '18 at 14:12












    • Np, please delete the comments.
      – Martin Prikryl
      Dec 20 '18 at 14:13
















    It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
    – Martin Prikryl
    Dec 20 '18 at 14:07






    It works on any version of Windows (since XP). What error do you get? Consider asking a new separate question with more details.
    – Martin Prikryl
    Dec 20 '18 at 14:07














    You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
    – Martin Prikryl
    Dec 20 '18 at 14:12






    You need both winscp.com and winscp.exe in the same folder. I believe the error message clearly says that the winscp.com looks for winscp.exe in its folder. See also winscp.net/eng/docs/executables
    – Martin Prikryl
    Dec 20 '18 at 14:12














    Np, please delete the comments.
    – Martin Prikryl
    Dec 20 '18 at 14:13




    Np, please delete the comments.
    – Martin Prikryl
    Dec 20 '18 at 14:13











    4














    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 it 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


    It should be good to go now.






    share|improve this answer























    • What are the security implications of doing this?
      – Peter Mortensen
      May 9 '16 at 17:37










    • Programs on your pc can now use ftp.
      – Mark Deven
      Dec 20 '18 at 12:10
















    4














    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 it 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


    It should be good to go now.






    share|improve this answer























    • What are the security implications of doing this?
      – Peter Mortensen
      May 9 '16 at 17:37










    • Programs on your pc can now use ftp.
      – Mark Deven
      Dec 20 '18 at 12:10














    4












    4








    4






    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 it 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


    It should be good to go now.






    share|improve this answer














    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 it 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


    It should be good to go now.







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited May 9 '16 at 17:38









    Peter Mortensen

    8,331166184




    8,331166184










    answered May 3 '12 at 18:46









    Keljo

    411




    411












    • What are the security implications of doing this?
      – Peter Mortensen
      May 9 '16 at 17:37










    • Programs on your pc can now use ftp.
      – Mark Deven
      Dec 20 '18 at 12:10


















    • What are the security implications of doing this?
      – Peter Mortensen
      May 9 '16 at 17:37










    • Programs on your pc can now use ftp.
      – Mark Deven
      Dec 20 '18 at 12:10
















    What are the security implications of doing this?
    – Peter Mortensen
    May 9 '16 at 17:37




    What are the security implications of doing this?
    – Peter Mortensen
    May 9 '16 at 17:37












    Programs on your pc can now use ftp.
    – Mark Deven
    Dec 20 '18 at 12:10




    Programs on your pc can now use ftp.
    – Mark Deven
    Dec 20 '18 at 12:10











    3














    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:Windowssystem32ftp.exe






    share|improve this answer























    • By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
      – Jags
      Mar 5 '14 at 15:12
















    3














    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:Windowssystem32ftp.exe






    share|improve this answer























    • By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
      – Jags
      Mar 5 '14 at 15:12














    3












    3








    3






    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:Windowssystem32ftp.exe






    share|improve this answer














    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:Windowssystem32ftp.exe







    share|improve this answer














    share|improve this answer



    share|improve this answer








    edited Mar 9 '12 at 19:29









    Diogo

    21.9k56132209




    21.9k56132209










    answered May 9 '11 at 20:22









    pants

    311




    311












    • By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
      – Jags
      Mar 5 '14 at 15:12


















    • By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
      – Jags
      Mar 5 '14 at 15:12
















    By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
    – Jags
    Mar 5 '14 at 15:12




    By default windows firewall include ftp.exe in its exception but only for home/work network. Make sure you are not on public network else allow ftp for public network as well.
    – Jags
    Mar 5 '14 at 15:12











    0














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



    It worked fine until the client location changed ISPs and, therefore, static IP addresses. 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 router/firewall, and viola, it seems to be working again.






    share|improve this answer




























      0














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



      It worked fine until the client location changed ISPs and, therefore, static IP addresses. 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 router/firewall, and viola, it seems to be working again.






      share|improve this answer


























        0












        0








        0






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



        It worked fine until the client location changed ISPs and, therefore, static IP addresses. 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 router/firewall, and viola, it seems to be working again.






        share|improve this answer














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



        It worked fine until the client location changed ISPs and, therefore, static IP addresses. 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 router/firewall, and viola, it seems to be working again.







        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited May 9 '16 at 17:42









        Peter Mortensen

        8,331166184




        8,331166184










        answered May 7 '12 at 21:06









        Plexus Sage

        91




        91























            0














            FTP issue



            Open Ports on azure NSG and server firewall: 21,20,4000-40009,990,14147



            Issue: Client cannot connect to ftp from command line and Powershell



            We are able to connect with testuser but not able see the directory/List



            Installed Wireshark on server and on my laptop to capture packets
            Created a filter on wireshark with “ftp” and “IP”
            The packet capture doesn’t states weather is it passive or active mode and source IP is correct. (we configure primary IP and secondary IP on the server)



            We found that the ftp connection is not working from the command prompt.
            trying to initiate a connection to ftp.abcd.com which was resolving to 11.22.33.44 and not to the actual FTP Server 44.33.22.11
            IP addresses 11.22.33.44 and 44.33.22.11 are both configured on the same Machine. However, the DNS was resolving to the secondary FTP IP instead of Primary



            Initially, We also found that the FTP connections to 11.22.33.44 was working fine and these connections were Active connections. We were unable to see that the Passive mode works here. Also while initiating connection to 11.22.33.44 from Commad promt the session freezes after you give 'dir' command however the same is working with other ftp clients like FileZilla and Winscp.



            I tried testing with WinSCP and FileZilla and got to see Passive mode connections are working fine and Active not which is an expected behavior.
            We checked why the 'dir' command is not working from the devices after the successful authentication, we got to see that the windows firewall is blocking the connection. We disabled the firewall and the everything started working as expected.
            I checked the same on my end after creating the firewall rule, issues were resolved. There was one system which even after disabling firewall was stuck at directory listing, this might be an issue within that system or the connections are being blocked by an external factor.
            Since after disabling most of us are able to work fine.



            settings need to be done on the machine
            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






            share|improve this answer





















            • This is what the answer by @Keljo already says (actually you have copied his/hers answer).
              – Martin Prikryl
              Dec 20 '18 at 5:14


















            0














            FTP issue



            Open Ports on azure NSG and server firewall: 21,20,4000-40009,990,14147



            Issue: Client cannot connect to ftp from command line and Powershell



            We are able to connect with testuser but not able see the directory/List



            Installed Wireshark on server and on my laptop to capture packets
            Created a filter on wireshark with “ftp” and “IP”
            The packet capture doesn’t states weather is it passive or active mode and source IP is correct. (we configure primary IP and secondary IP on the server)



            We found that the ftp connection is not working from the command prompt.
            trying to initiate a connection to ftp.abcd.com which was resolving to 11.22.33.44 and not to the actual FTP Server 44.33.22.11
            IP addresses 11.22.33.44 and 44.33.22.11 are both configured on the same Machine. However, the DNS was resolving to the secondary FTP IP instead of Primary



            Initially, We also found that the FTP connections to 11.22.33.44 was working fine and these connections were Active connections. We were unable to see that the Passive mode works here. Also while initiating connection to 11.22.33.44 from Commad promt the session freezes after you give 'dir' command however the same is working with other ftp clients like FileZilla and Winscp.



            I tried testing with WinSCP and FileZilla and got to see Passive mode connections are working fine and Active not which is an expected behavior.
            We checked why the 'dir' command is not working from the devices after the successful authentication, we got to see that the windows firewall is blocking the connection. We disabled the firewall and the everything started working as expected.
            I checked the same on my end after creating the firewall rule, issues were resolved. There was one system which even after disabling firewall was stuck at directory listing, this might be an issue within that system or the connections are being blocked by an external factor.
            Since after disabling most of us are able to work fine.



            settings need to be done on the machine
            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






            share|improve this answer





















            • This is what the answer by @Keljo already says (actually you have copied his/hers answer).
              – Martin Prikryl
              Dec 20 '18 at 5:14
















            0












            0








            0






            FTP issue



            Open Ports on azure NSG and server firewall: 21,20,4000-40009,990,14147



            Issue: Client cannot connect to ftp from command line and Powershell



            We are able to connect with testuser but not able see the directory/List



            Installed Wireshark on server and on my laptop to capture packets
            Created a filter on wireshark with “ftp” and “IP”
            The packet capture doesn’t states weather is it passive or active mode and source IP is correct. (we configure primary IP and secondary IP on the server)



            We found that the ftp connection is not working from the command prompt.
            trying to initiate a connection to ftp.abcd.com which was resolving to 11.22.33.44 and not to the actual FTP Server 44.33.22.11
            IP addresses 11.22.33.44 and 44.33.22.11 are both configured on the same Machine. However, the DNS was resolving to the secondary FTP IP instead of Primary



            Initially, We also found that the FTP connections to 11.22.33.44 was working fine and these connections were Active connections. We were unable to see that the Passive mode works here. Also while initiating connection to 11.22.33.44 from Commad promt the session freezes after you give 'dir' command however the same is working with other ftp clients like FileZilla and Winscp.



            I tried testing with WinSCP and FileZilla and got to see Passive mode connections are working fine and Active not which is an expected behavior.
            We checked why the 'dir' command is not working from the devices after the successful authentication, we got to see that the windows firewall is blocking the connection. We disabled the firewall and the everything started working as expected.
            I checked the same on my end after creating the firewall rule, issues were resolved. There was one system which even after disabling firewall was stuck at directory listing, this might be an issue within that system or the connections are being blocked by an external factor.
            Since after disabling most of us are able to work fine.



            settings need to be done on the machine
            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






            share|improve this answer












            FTP issue



            Open Ports on azure NSG and server firewall: 21,20,4000-40009,990,14147



            Issue: Client cannot connect to ftp from command line and Powershell



            We are able to connect with testuser but not able see the directory/List



            Installed Wireshark on server and on my laptop to capture packets
            Created a filter on wireshark with “ftp” and “IP”
            The packet capture doesn’t states weather is it passive or active mode and source IP is correct. (we configure primary IP and secondary IP on the server)



            We found that the ftp connection is not working from the command prompt.
            trying to initiate a connection to ftp.abcd.com which was resolving to 11.22.33.44 and not to the actual FTP Server 44.33.22.11
            IP addresses 11.22.33.44 and 44.33.22.11 are both configured on the same Machine. However, the DNS was resolving to the secondary FTP IP instead of Primary



            Initially, We also found that the FTP connections to 11.22.33.44 was working fine and these connections were Active connections. We were unable to see that the Passive mode works here. Also while initiating connection to 11.22.33.44 from Commad promt the session freezes after you give 'dir' command however the same is working with other ftp clients like FileZilla and Winscp.



            I tried testing with WinSCP and FileZilla and got to see Passive mode connections are working fine and Active not which is an expected behavior.
            We checked why the 'dir' command is not working from the devices after the successful authentication, we got to see that the windows firewall is blocking the connection. We disabled the firewall and the everything started working as expected.
            I checked the same on my end after creating the firewall rule, issues were resolved. There was one system which even after disabling firewall was stuck at directory listing, this might be an issue within that system or the connections are being blocked by an external factor.
            Since after disabling most of us are able to work fine.



            settings need to be done on the machine
            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







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Dec 19 '18 at 19:28









            Desh Kanth

            1




            1












            • This is what the answer by @Keljo already says (actually you have copied his/hers answer).
              – Martin Prikryl
              Dec 20 '18 at 5:14




















            • This is what the answer by @Keljo already says (actually you have copied his/hers answer).
              – Martin Prikryl
              Dec 20 '18 at 5:14


















            This is what the answer by @Keljo already says (actually you have copied his/hers answer).
            – Martin Prikryl
            Dec 20 '18 at 5:14






            This is what the answer by @Keljo already says (actually you have copied his/hers answer).
            – Martin Prikryl
            Dec 20 '18 at 5:14




















            draft saved

            draft discarded




















































            Thanks for contributing an answer to Super User!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.





            Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


            Please pay close attention to the following guidance:


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f215775%2fcommand-line-ftp-function-does-not-work%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Index of /

            Tribalistas

            Listed building