1748144 Members
3584 Online
108758 Solutions
New Discussion юеВ

Shell Script

 
SOLVED
Go to solution
vthiru
Advisor

Shell Script

Hello Admins,

I am trying to ftp files from HP-UX server to Windows 2003 server using one of the domain account to login to windows 2003 server. Here is my script:

Domain is xyz
User is abc
Password is 123
Server name is Server1

#!/usr/bin/ksh
HOST='Server1'
USER='xyz\\abc'
PASSWD='123'
ftp -n $HOST <quote USER $USER
quote PASS $PASSWD
lcd /test/dbdata/
cd "FTP\Dbdata"
mput *.csv
quit
END_SCRIPT
exit 0



But it throws an error stating below:

User xyz\abc cannot log in
Local directory now /test/dbdata
Please login with USER and PASS.



Thanks in advance..

vthiru
10 REPLIES 10
James R. Ferguson
Acclaimed Contributor

Re: Shell Script

Hi:

Drop the word "quote" in front of the user and password commands.

Regards!

...JRF...
vthiru
Advisor

Re: Shell Script

Hi James,

I removed quote..but still getting the same error..

Thanks,
vthiru
James R. Ferguson
Acclaimed Contributor

Re: Shell Script

Hi:

Are you sure that your USER value is correct? When I connect to a Windows' server my USER looks like "ddd/aaa" where ddd=domain and aaa=account.

Regards!

...JRF...
vthiru
Advisor

Re: Shell Script

Hi James,

I think so..bcoz when I connect it manually like this
ftp -n
user

it is allowing me to login without any issues.

Thanks,
vthiru
James R. Ferguson
Acclaimed Contributor

Re: Shell Script

Hi (again):

This is odd. I used your script, including the 'quote' command, and have no problems unless I supply an invalid account. Then I get:

User abc/xyz cannot log in.
Local directory now /tmp
Please login with USER and PASS.
Please login with USER and PASS.

Regards!

...JRF...
OldSchool
Honored Contributor

Re: Shell Script

"I think so..bcoz when I connect it manually like this
ftp -n
user

it is allowing me to login without any issues."
=================================

OK. How many "\" are in the name, and what is the *EXACT* message you are getting?
"User xyz\abc cannot log in"

it appears that you need more "\" in the variable in the script perhaps, as the name you TYPED doesn't appear to match the name in the error message you showed
Dennis Handly
Acclaimed Contributor

Re: Shell Script

Here is another thread about scripting ftp with the "\" char.
http://forums.itrc.hp.com/service/forums/questionanswer.do?threadId=1234894

You may have to use: USER "$USER"
vthiru
Advisor

Re: Shell Script

Thanks All. I figured it out that my password contains backslash. Like this...94503hj\%94\%PHF


Bcoz am able to login successfully with the account its password doesn't carry backslash. Please let me know is there any otherway I could make this script works without modifying the password.

Thanks again,
vthiru

Dennis Handly
Acclaimed Contributor
Solution

Re: Shell Script

>Please let me know is there any other way I could make this script works without modifying the password.

You add an extra "\"s in your shell variable.