Page 1 of 1

Problem in FTP unix script

Posted: Mon Dec 08, 2008 2:59 am
by sekaran12
Hi ,

My requirement is to transfer file from one server to another server.

Script is:
ftp -v -n -i $pHost <<EOD
user $pUserId $pPassword
$pFTPFormat
put $pSrcFilePath $pTgtFilePath
EOD

Example :
Paramters:
pHost : xxxxx.com
UserId:DomainName\userid
pPassword:**********
pFTPFormat:ascii
pSrcFilePath:\opt\datastage\ftpout\nte.txt
pTgtFilePath:\home\nte.txt

When i try to excute this script, it skips the "\" in userid. so it shows the error, login failed.I don't know why the ftp command removes "\" in UserId.

output:
Connected to xxxxx.com.

220 Microsoft FTP Service

331 Password required for DomainNameuserid. ------> "\" skipped

530 User DomainNameuserid cannot log in.

Login failed.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

221 Good-Bye



Please tell me the solution how to include "\" in the FTP command.

Thanks,
Raj

Posted: Mon Dec 08, 2008 3:33 am
by hemanthakumar
Hi,
To transfer file from one server to another server use coreftp software,this is userfriendly.For this software download from google.

Re: Problem in FTP unix script

Posted: Mon Dec 08, 2008 3:51 am
by Sharanrs21
Add one more backslash before the existing backslash or else put a single quote at the beginning and end of UserId like UserId:'DomainName\userid'..
sekaran12 wrote:Hi ,

My requirement is to transfer file from one server to another server.

Script is:
ftp -v -n -i $pHost <<EOD
user $pUserId $pPassword
$pFTPFormat
put $pSrcFilePath $pTgtFilePath
EOD

Example :
Paramters:
pHost : xxxxx.com
UserId:DomainName\userid
pPassword:**********
pFTPFormat:ascii
pSrcFilePath:\opt\datastage\ftpout\nte.txt
pTgtFilePath:\home\nte.txt

When i try to excute this script, it skips the "" in userid. so it shows the error, login failed.I don't know why the ftp command removes "" in UserId.

output:
Connected to xxxxx.com.

220 Microsoft FTP Service

331 Password required for DomainNameuserid. ------> "" skipped

530 User DomainNameuserid cannot log in.

Login failed.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

221 Good-Bye



Please tell me the solution how to include "" in the FTP command.

Thanks,
Raj

Re: Problem in FTP unix script

Posted: Mon Dec 08, 2008 5:20 am
by sekaran12
Hi,
I have tried in all ways include quote like 'DomainName\userid' and DomainName\\userid.But I got same output without any improvement.

Thanks!
Sharanrs21 wrote:Add one more backslash before the existing backslash or else put a single quote at the beginning and end of UserId like UserId:'DomainName\userid'..
sekaran12 wrote:Hi ,

My requirement is to transfer file from one server to another server.

Script is:
ftp -v -n -i $pHost <<EOD
user $pUserId $pPassword
$pFTPFormat
put $pSrcFilePath $pTgtFilePath
EOD

Example :
Paramters:
pHost : xxxxx.com
UserId:DomainName\userid
pPassword:**********
pFTPFormat:ascii
pSrcFilePath:\opt\datastage\ftpout\nte.txt
pTgtFilePath:\home\nte.txt

When i try to excute this script, it skips the "" in userid. so it shows the error, login failed.I don't know why the ftp command removes "" in UserId.

output:
Connected to xxxxx.com.

220 Microsoft FTP Service

331 Password required for DomainNameuserid. ------> "" skipped

530 User DomainNameuserid cannot log in.

Login failed.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

530 Please login with USER and PASS.

221 Good-Bye



Please tell me the solution how to include "" in the FTP command.

Thanks,
Raj

Posted: Mon Dec 08, 2008 7:44 am
by chulett
Try changing the "\" to "%5C":

DomainName%5Cuserid

Posted: Mon Dec 08, 2008 10:16 am
by dslisa
Hi, don't know how your variables are set up but try separating the domain and user in 2 variable instead of 1. For example

ftp -i -n -d ${HOST} << EOF

user ${DOMAIN}"\"${USER} ${PWD}

cd FOLDER_NAME
put ${SRCFILE} ${TGTFILE}

quit

EOF

Also, I am assuming you tried this multiple times and based on your security setting your FTP username/password might be locked. Please check on that also. Also, your parameter is missing a 'p' on UserID.