Posts

Showing posts with the label sshpass

Passing password to the rsync command with sshpass

In some cases, when writing a bash shell script like running the rsync command multiple times, and you want to avoid entering username and password over and over again, you may find sshpass useful. $ sudo apt-get install sshpass Example script: #! /bin/bash for oldblogid in `cat $1` do         media=/var/www/wp-content/blogs.dir/$oldblogid           echo "=== Checking the existance of $media directory..."                                                                                                if [ -d "$media" ]          then                 echo "    Existed! Copying $media..."           ...