That is a fairly decent howto for rsync+sudo but it is missing a piece...
The option requiretty must not be set in the sudoers file. The article does mention a workaround for it being enabled but it is much easier to just make sure it isn't present in the file.

OTOH, the even easier method is just to use ssh key authentication and ssh as root.

On 4/13/26 09:44, RolandK via rsync wrote:
you can use rsync via sudo

https://askubuntu.com/questions/719439/using-rsync-with-sudo-on-the- destination-machine



Am 13.04.26 um 13:44 schrieb H via rsync:
Running rsync 3.2.5 on Rocky Linux 9. I am a long-time vanilla user of rsync to 
transfer files between servers and local computers. Now, however, I have a need 
that is more complex and I could use some help figuring out how to do.

I need to transfer directories/files owned by multiple users from a server to 
another machine in preparation for a switch-over. I am the administrator of 
both machines and I have configured them to only allow access using ssh using 
my key, in other words, no password logins, nor can root access the machines 
using ssh.

I am hoping I - using a bash script - can log in, elevate my privileges to root 
and then (somehow) transfer the files from the server to another machine.

I should add that this server is running rsync 3.1.2 on CentOS 7.

Can I do this given the constraints I have above? If so, what should the 
command look like?

Many thanks in advance!






--
Please use reply-all for most replies to avoid omitting the mailing list.
To unsubscribe or change options: https://lists.samba.org/mailman/listinfo/rsync
Before posting, read: http://www.catb.org/~esr/faqs/smart-questions.html

Reply via email to