User Tools

Site Tools


using_sshpass_with_rsync

This is an old revision of the document!


Using SSHPASS with RSYNC

2016



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 pi@10.1.1.100:/FolderToBak /Destination



using_sshpass_with_rsync.1485712893.txt.gz · Last modified: 2023/03/09 22:35 (external edit)