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 script

Status
Not open for further replies.

kukuluku

MIS
May 2, 2002
56
US
We are using the following scripts (test and test.in)
to run some ftp job. User claims the scripts have
been working fine until now. I tried to login
manually with USER/PASSWD, it login/transfer file successfully. But
running this script gets error:
530-331 Password required for (null).
530 530 Login incorrect.
Login failed.
503 Login with USER first.
530 Please login with USER and PASS.
530 Please login with USER and PASS.

script test:
ctlf=/home/psft/hr/bin/test.in; export ctlf
ftp -n < $ctlf
exit 0

script test.in:
open IPADDRESS
user USERNAME PASSWRD
put /home/psft/interface/hr/TEST.csv
bye

I tried different syntex
ftp -n <<EOF
open IPADDRESS
user USER PASSWD
put /home/psft/interface/hr/TEST.csv
close
bye
EOF

but got same error. Is there something on the server that could be set up to restrict the access through script?

Thanks in advance.
 
make sure your 'test' script [btw - name it something else other than 'test' - there's /usr/bin/test] is interpreted by the expected shell interpreter. Accroding to your syntax I'd assume it's either /bin/sh or /bin/ksh

Add the following line as the FIRST line in the script:
#!/bin/ksh vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
Sorry, I do have #!/bin/ksh in the script. It does same thing when I use different name for the script.
 
debug the script with &quot;set -x&quot; - see how the parameters and the variables get expanded. vlad
+----------------------------+
| #include<disclaimer.h> |
+----------------------------+
 
For some reason, it seems not taking the USER login at all:

=> sh -x ./test
+ ctlf=/home/psft/hr/bin/test.in
+ export ctlf
+ ftp -n
+ 0< /home/psft/hr/bin/test.in
Connected to server. Logging in...
220-Welcome to The JJJJ Co. FTP site
220-
220-Please contact ftpmaster@jjjj.com if you experience technical difficulties.
220-
220-Accessed from nokia-dmz-225.jjjj.com at Tue Jan 7 14:45:43 2003
220-
220 ftp FTP server (Version wu-2.4.2-academ[BETA-18-VR15](1) Tue Feb 23 11:25:32 PST 1999) ready.
331 Password required for (null).
530 Login incorrect.
Login failed.
Login with USER first.
Please login with USER and PASS.
Please login with USER and PASS.
+ exit 0


Ping seems hang and never come back:
pshp3_psft_hrprod => /etc/ping IPADDRESS
PING IPADDRESS: 64 byte packets

But again, fpt manually to transfer file works fine.
 
when we do a ftp that we supply the USER and Pasword the -i option is needed.

Code:
   ftp -i -n -v ${FTPADDR} << EOF > $FTPLOG 2>&1
   user ${LOGINID} ${PASSWORD}
   append ${WORK_DIR}/${TP_Data} ${DIR}/${DATAMGR}
   quit
EOF

See if this may help.
 
Thank you guys. I did use -i option. Somehow the server is not reading the username and password correctly when we run script. Manual trasferring file works fine.

The administrator on the ftp server said he found out that there was a bug when transmitting from HP-UX through Nokia firewall. He is checking to see if there's a work-around.

Appreciate all you input.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top