mercredi 1 avril 2015

shell script prompting for password but not taking it while doing tar


Vote count:

0




In my shell script, I have following lines:



function tarIt() {
FILE_OWNER=$1
TAR_FILE_NAME=$2
FILE_NAME=$3

su - $FILE_OWNER -c "tar -cvzf $TAR_FILE_NAME $FILE_NAME > /dev/null 2>&1"
if [ ${?} -ne 0 ]; then
print_error "Failed to create backup.";
exit $E_FAILED_COMPRESS;
fi
}


While debugging, I am getting below lines:



+ su - ssrun -c 'tar -cvzf /tmp/backup/statusService/probe.properties.tar.gz /opt/mgtservices/probes/conf/probe.properties > /dev/null 2>&1'
Password: ssrun1
su: incorrect password
+ '[' 125 -ne 0 ']'
+ print_error 'Failed to create backup.'


I don't know while prompting for password, why my text is visible and password also it is not taking. The password is correct, when I copied the same line on command prompt, it executed without any error.



asked 39 secs ago







shell script prompting for password but not taking it while doing tar

Aucun commentaire:

Enregistrer un commentaire