I got a bash script to synchronize data between two computers. It works fine but I have to type my password every time the rsync command is called.
#!/bin/bash
sourceIP="192.168.178.128"
sourceUser="user1"
destinationUser="user2"
function sync()
{
rsync --archive --progress -v -e "ssh -l $sourceUser " $sourceIP:/home/$sourceUser/$1/ /home/$destinationUser/$1
}
sync Pictures
sync Music
sync Videos
sync Documents
How to store the password (via prompt) in a variable and pass it to rsync/ssh?