Problem in FTP unix script

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
sekaran12
Participant
Posts: 20
Joined: Tue Sep 26, 2006 7:08 am
Location: Chennai

Problem in FTP unix script

Post 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
Raj
hemanthakumar
Participant
Posts: 34
Joined: Mon May 05, 2008 1:31 am

Post by hemanthakumar »

Hi,
To transfer file from one server to another server use coreftp software,this is userfriendly.For this software download from google.
Sharanrs21
Participant
Posts: 1
Joined: Wed Sep 03, 2008 5:22 am

Re: Problem in FTP unix script

Post 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
sekaran12
Participant
Posts: 20
Joined: Tue Sep 26, 2006 7:08 am
Location: Chennai

Re: Problem in FTP unix script

Post 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
Raj
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Try changing the "\" to "%5C":

DomainName%5Cuserid
-craig

"You can never have too many knives" -- Logan Nine Fingers
dslisa
Participant
Posts: 24
Joined: Mon Oct 27, 2008 6:48 pm

Post 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.
Post Reply