I had started creating a shell script using scp to copy certain directories from one server to another. My question is... Is it possible for this shell script to type in passwords? For instance when you use SCP it asks for the password of the user you are using to connect to the remote server with.
See code below for an example of how I am using it. Now when this runs it prompts for the root password of that server. However I will be wanting to run this automatically as a cron job. So is there a way to make the script type in the root password? Maybe scp has a flag for the password?
Any help would be appreciated.
echo "Attempting back via SCP"
echo "Backing up /var/log"
scp -rqp /var/log firstname.lastname@example.org:/home/serverbackup/Mercury/var
echo "/var/log complete"