I'm trying to ftp from a Unix machine to a Windows machine..
I've tried the following
#!/bin/sh
#set -x
USER="user1"
PASS="pass1"
HOSTNAME="host1"
ftp -n -i -v $HOSTNAME << EOT
user $USER $PASS
cd /
send text1.txt
close
bye
EOT
When I try to run this, I get prompted for the password. But since this will be working in a Production environment and run by people who have no idea what this script will be doing , the process should be automated. The user id and password have to go in automatically and the file should be put in.
I've tired different options like
ftp -n -i -v << EOT
open $HOSTNAME
$USER
$PASS
cd /
send text1.txt
close
as well as
ftp -n << EOT
open $HOSTNAME
quote USER $USER
quote PASS $PASS
cd /
send text1.txt
close
but always I keep getting the same error, where I'm prompted for the password.
Output when running script
----------------------------------
****
Connected to host1
220 FTP server (Hummingbird Ltd. (HCLFTPD) Version 9.0.0.0) ready.
331 Password required for user1
***
This is kind of urgent. Any help would be greatly appreciated.
Thanks
Sam