I have written a script which will run a script for a backup before:
# cat backup-before-shutdown
#Scritp to take backup before shutdown
#Author Ashish Karpe
echo "Taking backup to s3"
su ubuntu /bin/sh /home/ubuntu/backup.sh
/bin/sh /home/ubuntu/backup-to-s3.sh
Normally when I switch the user from root
to ubuntu
it doesn't ask password as its switching from root
to ubuntu
but it's asking while running the script. So what should I do to avoid the password in my script?