• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 604
  • Last Modified:

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?
0
lifetech
Asked:
lifetech
  • 5
  • 3
  • 2
1 Solution
 
yuzhCommented:
You need to have FTP server running in your W2k box, and your DOS batch command
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
0
 
Matt_AveryCommented:
Actually, I think yuzh has already answered the question but here are a few thoughts:

Problem #1 - need to make sure that an FTP server is installed on the Windows machine in the first place

Problem #2 - need to configure the Windows FTP server so that FTP clients can actually write to the relevant directory. (Most Unix FTP servers will let you read/write files to any directory you want, as long as your ID has the necessary permissions. By contrast, Windows FTP servers tend only to expose certain directories)

Devious Solution #1 - Persuade your boss that it really is a better idea to initiate the transfer from Windows (no need to install an FTP server on your Windows machine)

Devious Solution #2 - Share the windows directory and access it from the unix machine using the "smbclient" program instead of FTP.
0
 
lifetechAuthor Commented:
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.
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
lifetechAuthor Commented:
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.
0
 
Matt_AveryCommented:
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.
0
 
lifetechAuthor Commented:
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?
0
 
Matt_AveryCommented:

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)


0
 
lifetechAuthor Commented:
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?
0
 
yuzhCommented:
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.body


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.
0
 
lifetechAuthor Commented:
Thanks Matt! I ended up persuading my boss to run it from Windows to Unix...
0

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 5
  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now