我有一個要求,在那裏我會做SFTP到不同的服務器,我想通過一個shell腳本星號 - 登錄失敗
要做到這一點,但密碼是具有星號(*)字符,所以無法登錄 腳本:
host=xxxxx
user=celcom_mnp
passwd='CjX3E$4Q&*B6L'
cd /home/mquser/unicaftp/CMS/batch/OBD/MNP/
test=`find . -maxdepth 1 -type f -name "*.csv" -mmin +1 | awk -F "/" '{print $NF}'`
lftp<<EOF
open sftp://$host
user $user $passwd
cd /MNP_Autoin
lcd /home/mquser/unicaftp/CMS/batch/OBD/MNP
mput `echo $test`
EOF
OUT=$?
if [ $OUT -eq 0 ];then
echo "$test Succesfully transferred" >> /home/mquser/CIFM_STORE/OBD/obdmnplog.txt
else
echo "Issue with sftp" >> /home/mquser/CIFM_STORE/CEP/PUSH/sftplog.txt
fi
mv $test /home/mquser/CIFM_STORE/OBD/TEMPMNP/
錯誤信息:
Unknown command `*B6L'.
cd: Login failed: Login incorrect
請幫助我。在此先感謝
請你的腳本中的相關部分添加到您的問題。 – Cyrus
@Cyrus:添加完整的腳本。謝謝 – Saibalu
@Cyrus:我無法用上面的密碼登錄,可能是因爲密碼中的特殊字符。你可以參考我上面提供的錯誤信息。謝謝 – Saibalu