Wednesday, May 1, 2019

Sync files using rsync with sudo privileges

Problem

Need to copy files from one Linux VM to another (Ubuntu 18). Root account is not available, have accounts with sudo privileges.

Solution

Sample command listed below:

sudo rsync -e "ssh" --rsync-path="sudo rsync" -Pav remoteuser@<remote server>:/mnt/disk01/folder_to_sync/ /mnt/disk01/folder_to_sync/


When executing, the system will ask you for password to existing user and then password for remoteuser.

Note, that remoteuser should be able to execute sudo command without prompting to type password.

Refer to https://sk.solutionmentors.com/2019/05/run-commands-with-sudo-without-having.html for instructions.

No comments:

Post a Comment