Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XP's FTP command line utility

Status
Not open for further replies.

torturedmind

Programmer
Jan 31, 2002
1,052
PH
Good day to all. Forgive me if my post is not appropriate to this forum so kindly point me to the right direction.

Well anyways, I have a small script that should upload a group of small text files to a remote ftp server. Here's what i did:
Code:
ftp -i -n -s:PutFTPTest.ini
the file PutFTPTest.ini contains the following:
Code:
open ftp.ourdomain.com
user ftpuser1 abcdefg1234567
cd /var/myfolder
ascii
quote PASV
mput *.txt

Notice i did not include "bye" or "quit" at the end because i wanted to see what the responses were. I found out that there were messages after the "mput *.txt" line saying "Illegal PORT command" and "Use PORT or PASV first.". So i enable debugging to see what the debugging messages were:
Code:
ftp -i [b][blue]-d[/blue][/b] -n -s:PutFTPTest.ini
After the "mput *.txt" line, a debug message saying "PORT 192,168,xxx,xxx,xxx,xxx" then the error message "Illegal PORT command" followed by "Use PORT or PASV first." for every attempt to upload a file. I was wondering - why was it PORTing my IP address? Anyways, i temporarily disabled my firewall (Comodo) and run again FTP. The result was the same. Any help will be much appreciated.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
I don't see anything wrong with your script.
I tried it on my ftp server. Here is the log:
Code:
B:\apps\test>testftp.bat

B:\apps\test>ftp -i -n -s:testftp.txt
ftp> open mydomain.com
Connected to mydomain.com.
220 My FTP Server Ready
ftp> user jock pswdremoved
331 Password required for jock
230 Logged on
ftp> cd jock
250 CWD successful. "/jock" is current directory.
ftp> ascii
200 Type set to A
ftp> quote pasv
227 Entering Passive Mode (aa,bb,cc,ddd,19,137)
ftp> mput *.txt
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 904 bytes sent in 0.20Seconds 4.50Kbytes/sec.
200 Port command successful
150 Opening data channel for file transfer.
226 Transfer OK
ftp: 87 bytes sent in 0.20Seconds 0.44Kbytes/sec.
ftp>

The ip address removed (aa.bb.cc.ddd) is the real ip for mydomain.com.

- What happens if you open just your domain, without the ftp. prefix? Or if you connect via the IP address?
- Is this ftp server on your local network or on the same machine?
- Is there an entry in your hosts file pointing directly to the internal address of your domain?
- Are the active and passive ftp ports open on firewall(s) and router(s)?

Jock
 
thanks jock for taking time to reply. and apologies also for my own late reply.

anyways, the problem is both from our firewall and theirs. our network admin said both firewalls were blocking each other. it took a little while to resolve the issue from their side as they don;' want to admit they were also blocking ours. anyways, everything's working now. thanks.

kilroy [knight]
philippines

"Once a king, always a king. But being a knight is more than enough."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top