Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing FTP server behind a proxy via command prompt in Windows 7

I want to connect to the FTP server ftp://trmmopen.gsfc.nasa.gov/pub/merged/3B42RT from my command prompt in Windows 7.

It's always showing not connected.

I am running my PC behind proxy. I came to know about port error. Followed this solution here about port forwarding but still no result.

like image 470
Uchiha_itachi Avatar asked May 26 '15 16:05

Uchiha_itachi


1 Answers

Windows built-in command-line ftp.exe client does not support connecting over a proxy. It also supports an active mode only, what makes it difficult to connect though proxy anyway (even if some transparent proxy solution is used).

You have to use a 3rd party command-line FTP client that supports a passive mode and a proxy.

For example with WinSCP FTP client, you can use the following batch file (.bat):

WinSCP.com /command ^
    "open ftp://anonymous:[email protected]/ -rawsettings ProxyMethod=3 ProxyHost=proxy ProxyUsername=username ProxyPassword=password" ^
    "cd /pub/merged/3B42RT" ^
    "ls" ^
    "exit"

See a guide to scripting with WinSCP and a guide for converting Windows FTP script to WinSCP script.

The above code is for an HTTP proxy. If you use a different proxy type, alter the ProxyMethod setting accordingly. See https://winscp.net/eng/docs/rawsettings

Though easier is to configure the connection in WinSCP GUI and then have it generate a script template for you.

(I'm the author of WinSCP)

like image 70
Martin Prikryl Avatar answered Oct 20 '22 08:10

Martin Prikryl