I am trying to download a from FTP server from Unix command prompt but getting "Connection closed by remote host" exception.

Same exception I am getting while trying from Window command prompt as well but using WinScp able to download file without any issue.

Not able get that is the issue. We want to schedule file download task using crontab .

Can anyone give me some idea to investigate the root cause.

Note - connecting FTP server using user and password

Please see below the steps that I am following. I dont know where to check FTP log while executing FTP command in window command prompt.

enter image description here

There might be some firewall is blocking but wondering I am able to do the same using Winscp from same system.

  • How are you connecting, active or passive? When exactly does the error arrive? Tried disabling security? Firewall? Read and comment in your post on link1 and link2. – harrymc Apr 30 at 19:50
  • @ Martin Prikryl, Not able to find FTP logs in window 10 system. I have added steps that I followed in my question section – Atanu chatterjee Apr 30 at 20:10
  • @ harrymc, If any Firewall and Security is blocking my FTP command then same activity can also blocked while I am performing using Winscp tool also. Is there any specific settings available in Winscp tool that I am missing from command prompt ? – Atanu chatterjee Apr 30 at 20:14
  • Please do not post output as an image, post it as a text. ftp has -d switch to enable debugging. Both on Windows and *nix. + WinSCP default to the passive mode. Contrary to Windows ftp, which does not even support the passive mode. *nix ftp usually does support the passive mode (though it may not default to it). – Martin Prikryl May 1 at 6:14
  • @ Martin Prikry, thanks, In Window it did not work but after making passive in Linux it worked – Atanu chatterjee May 4 at 8:24

Almost all modern FTP servers run in passive mode - your command line FTP client may default to active mode and would give you this disconnect message.

Try the following:

ftp> open <server>
<login with username and password>
ftp> passive
ftp> get <file>

You should get confirmation of passive mode after entering the passive command.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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