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
Problem in FTP unix script
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 34
- Joined: Mon May 05, 2008 1:31 am
-
- Participant
- Posts: 1
- Joined: Wed Sep 03, 2008 5:22 am
Re: Problem in FTP unix script
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
Hi,
I have tried in all ways include quote like 'DomainName\userid' and DomainName\\userid.But I got same output without any improvement.
Thanks!
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
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.
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.