The quote PASV
command is not a command to the ftp.exe
program, it is a command to the FTP server requesting a high order port for data transfer. A passive transfer is one in which the FTP data over these high order ports while control is maintained in the lower ports.
The windows ftp.exe
program can be used to send the FTP server commands to make a passive data transfer between two FTP servers. A standard windows installation will not, and probably should not, have FTP server service running as an endpoint for passive transfers. So if passive transfers are needed with a standard windows box, a solution other than ftp.exe
is necessary as FTPing to localhost as one of the connections won't work in most windows environments.
You can effect a passive FTP transfer between two different hosts (but not two connections on the same host) as follows:
Open up two prompts, use one to ftp.exe
connect to your source FTP server and one to ftp.exe
connect to your destination FTP server.
Now establish a passive connection between the servers using the raw commands PASV and PORT. The quote PASV
command will respond with an IP/port in ellipsis. Use that data for the quote PORT <data>
command. Your passive link is now established assuming that firewalls haven't blocked one or more of the four ports (2 for FTP control, 2 for FTP data)
Next start receive of data with the quote STOR <filename>
command to the receiving FTP server then send the control command quote RETR <filename>
to the source FTP server.
so for me:
client 1
> ftp.exe server1
ftp> quote PASV
227 Entering Passive Mode (10,0,3,1,54,161)
client 2
> ftp.exe server2
ftp> quote PORT 10,0,3,1,54,54,161
ftp> quote STOR myFile
client 1
ftp> quote RETR myFile
Cavet: I'm connecting to some old FTP servers YMMV