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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

FTP into Unix from W2K Server

Status
Not open for further replies.

PoliMalaka

IS-IT--Management
Aug 31, 2004
138
US
We have a unix server (backup drive has failed) from which we need to be able to back up files.
We'd like to send these file via FTP to one of our W2K servers that has plenty of backup space.
My first idea was to set up a job in cron to run a script similar to this one that we run from another server cluster:
#!/bin/sh
ftp -n -v 10.1.1.50 <<EOT
user ftpuser ftppassword
cd Directory
put /export/home/data.txt data1.txt
put /export/home/data2.txt data3.txt
bye
EOT
Unfortunately, this script works in the opposite direction from what we would like to do.
This particular Unix server has a modem used by the support vendor. If we were to include the username and pass in this script, you can see the security issue raised. ()back door to our network and file servers via modem then FTP)
We'd like to instead create a scheduled job on the W2K server to run a batch file that will go out and mget the files from the unix box.
In this case, I am not worried about using plain text username and passwords in a btach file on our W2K server as only admins have access to this.
Here is what I have so far but am unable to get it working.
@echo off
ftp -n -v 10.1.1.90
user root rootpassword
mget *.z E:\DataFiles
bye
Thanks in advance.
 
i think all you need is a /y at the end of the mget line. windows command line ftp makes you confirm each file before copying, so the /y might do the trick for you.

~Intruder~
CEH, MCSA/MCSE 2000/2003

"The Less You Do, The Less Can Go Wrong" :)
 
I am having trouble sending the username and password though. The script just stops and waits for the username.
 
ftp accepts redirected input. Put your commands in a text file and redirect it to the input of ftp.


Contents of commands.txt
--------------------------
open 10.1.1.10
user root rootpassword
mget *.z E:\datafiles
bye

---------------------------

At the command line:

ftp <commands.txt

 
ftp accepts redirected input. Put your commands in a text file and redirect it to the input of ftp.


Contents of commands.txt
--------------------------
open 10.1.1.10
user root rootpassword
mget *.z E:\datafiles
bye

---------------------------

At the command line:

ftp <commands.txt
Bah, great help but still not working.
It is sitting at the password prompt. The script I wrote so send files from a Unix server to a W2K server works great.
Is it two different implementations of FTP?
 
In this particular case i will get each file on a seperate line. mget is not working well on this box and complains about the file type.
ftp> mget *.Z
200 Type set to A.
mget uhdata1.tar.Z?

Argh...
 
I put the command in wrong.

open 10.10.1.10
user
root
rootpassword
....
....


Noticle the CRLF between the userid and password

launch it by:

ftp -n -s:commands.txt

This gets around the issue with the password prompt.



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top