Using SSHPASS with RSYNC
One issue I am having with rsync is passwords. If I run my scripts with the normal user, then the sync does work, but while I get all the files, the folder permissions are lost.
If I run the rsync as sudo, then I get asked for a password each time, which is not good for automation.
You can send the password in clear text with the rsync command, from a security perspective this is definitely NOT recommended, but as my backup device is not connected to the internet as a rule (except for updates) and it has no users, this should be fairly safe.
First we need to install sshpass:
sudo apt-get install sshpass
No we can do the following:
sudo sshpass -p "your_password_here" rsync -switches email@example.com:/FolderToBak /Destination