1833589 Members
4099 Online
110061 Solutions
New Discussion

Re: FTP Scripting

 
SOLVED
Go to solution
Yvonne Butler
Regular Advisor

FTP Scripting

I've been trying to figure out why I can't get this FTP script to work correctly (this is my first real attempt at writing an FTP script). I can't seem to get the script to login yet, it won't take the password. I've copied the script below:

USER=username
PASS=password
COLLECT=" /home/username/audit"
FILE1=" au_audit.op"

cd /home/ye103910/logftp01

ftp -nv 10.2??.?.? </tmp/get_logftp01.$$
user ${USER}${PASS}
cd${COLLECT}
get${FILE1}
quit
FTPEOF

The error output is as follows:

Connected to 10.2??.?.?.
220 logftp01.tntlogistics.co.uk FTP server (Version 1.1.214.8 Fri Apr 20 07:27:42 GMT 2001)
ready.
Remote system type is UNIX.
Using binary mode to transfer files.
331 Password required for usernamepassword.
530 Login incorrect.
Login failed.
530 Please login with USER and PASS.
530 Please login with USER and PASS.
221 Goodbye.

Any ideas anyone?
4 REPLIES 4
Solution

Re: FTP Scripting

Don't you need a space between ${USER} and ${PASS} ? As in:

user ${USER} ${PASS}

HTH

Duncan

I am an HPE Employee
Accept or Kudo

Re: FTP Scripting

In fact your missing some other spaces as well. Try:

USER=username
PASS=password
COLLECT=" /home/username/audit"
FILE1=" au_audit.op"

cd /home/ye103910/logftp01

ftp -nv 10.2??.?.? </tmp/get_logftp01.$$
user ${USER} ${PASS}
cd ${COLLECT}
get ${FILE1}
quit
FTPEOF

I am an HPE Employee
Accept or Kudo
Mark Greene_1
Honored Contributor

Re: FTP Scripting

In addition to the space between the user and password, add -i to the ftp options to disable interactive prompting.

mark
the future will be a lot like now, only later
Yvonne Butler
Regular Advisor

Re: FTP Scripting

You are all correct about putting spaces in the appropriate places and adding -i to the initial line. Most importantly was that I'd been using the wrong password (DOH!!!).

Thanks everyone...