lifetech
asked on
FTP from unix (HP-UX) to Windows 2000 server
I need to know how to initiate an FTP transfer from a Unix Server (users home directory) to a Windows server on the same LAN. Ive been able set up a batch file initiated in windows that will pull the file from the Unix server, however my boss wants this initiated in Unix - not from Windows.
I know DOS batch commands and FTP commands well, however I am stuck at to how to direct the file transfer to a specific directory on windows. I have been experimenting with the put command - is this a good place to start?
I know DOS batch commands and FTP commands well, however I am stuck at to how to direct the file transfer to a specific directory on windows. I have been experimenting with the put command - is this a good place to start?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
The main problem is touched on by Matt (problem #2). I will try the suggestions. Yuzh - thank you for the sequrity warning. I dont believe security is an issue, but it is best to be informed.
ASKER
The reason (which I don't totally agree with) he wants this to happen from the Unix box is that a report will ge generated by a Unix user. Each time this report is generated, he wants the script to then run and send the file. He wants to avoid the second step of manually initiating the transfer from the W2K box.
Thinking outside the box again, here are a few more non-FTP solutions:
1. Don't place the file in a directory on the Windows box, send it via e-mail (very easy using "mail" or "mailx"). You might even be able to convince the customer that this is a more sophisticated solution.
2. Install Samba and share the directory on the Unix server, so that it appears as a network drive under Windows (however installing and configuring Samba is fairly tedious IMO).
3. Install a web server and make the file available to the windows user via HTTP. (Most Unix / Linux distributions seem to come bundled with a pre-configured version of Apache these days, so this would be fairly easy). Might also be able to sell this to the customer as a more sophisticated solution.
1. Don't place the file in a directory on the Windows box, send it via e-mail (very easy using "mail" or "mailx"). You might even be able to convince the customer that this is a more sophisticated solution.
2. Install Samba and share the directory on the Unix server, so that it appears as a network drive under Windows (however installing and configuring Samba is fairly tedious IMO).
3. Install a web server and make the file available to the windows user via HTTP. (Most Unix / Linux distributions seem to come bundled with a pre-configured version of Apache these days, so this would be fairly easy). Might also be able to sell this to the customer as a more sophisticated solution.
ASKER
Matt - I like the way you think. Don't know if they will go for any of these - but I love the ideas. What is the syntax for the mail or mailx commands? One more question - Once an ftp session is initiated at the W2K box (from a Unix command prompt) how do I see the directories available?
Re: "mail" and "mailx", the basic syntax is:
mailx foo@bar.com < filename.txt
"mailx" accepts a command line option of the form ' -s "Subject Line" ' , whilst "mail" allows you to preface your note with as many RFC822 header lines as you like (difficult to learn, but potentially very powerful). There are many questions and answers on this website involving "mail" and "mailx", if you have time to browse around.
(where "filename.txt" is the body of the e-mail you want to send)
Re: Command line FTP - FTP clients tend to accept the same commands as the local operating system. So the FTP client on a Unix box will probably accept the commands "ls -l" and "pwd", whilst FTP on a Windows machine will accept "dir". (The FTP client always has to translate your commands into FTP protocol commands anyway, so it makes sense for it to accept commands that might be familiar to a local user)
ASKER
I have another "outside the box" idea. I can Telnet to the windows box, login, then call the Batch script on the windows system to send the file from Unix to windows. I got this to work manually, however - I don't know if there is a wayt to automate the login process. Don't know how much of a security hole this will open. Could a script be used for this?
If you want to send the report as a proper email attachment, you can use "mutt",
the systax:
mutt email@ddress -a filename.to.attache -s "Subject of email" < file.containing.message.bo dy
You can download mutt from:
http://hpux.cs.utah.edu/hppd/hpux/Networking/Mail/mutt-1.4.2.1/
Please remember to install all the dependencies.
the systax:
mutt email@ddress -a filename.to.attache -s "Subject of email" < file.containing.message.bo
You can download mutt from:
http://hpux.cs.utah.edu/hppd/hpux/Networking/Mail/mutt-1.4.2.1/
Please remember to install all the dependencies.
ASKER
Thanks Matt! I ended up persuading my boss to run it from Windows to Unix...
will not run under Unix (HP-UX).
if you want to backup data from HP-UX to W2k server, you can use rsync, see:
http:Q_20800890.html
If you still want to use ftp script (FTP is insecure, plain text password!), consider
setup secure shell in your HP-UX box, and install secure shell in your W2k box, and
use secure FTP to transfer the files.
IF you don't care about security, have a look at the following FTP script:
http:Q_20702441.html
http:Q_20800090.html