1

How can I change the user permissions so that the user will be able to rsync between two systems as a root.

I added the user in visudo.

paru ALL = NOPASSWD: /usr/bin/rsync

then I typed the rsync command in 1 system to push data from one server to another

rsync -avP /opt/paru/ paru@105.1.167.412:/opt/paru

when I rsync, it gives me the following error:

sending incremental file list rsync: mkdir "/opt/paru" failed: Permission denied (13) rsync error: error in file IO (code 11) at main.c(576) [receiver=3.0.6] rsync: connection unexpectedly closed (9 bytes received so far) [sender] rsync error: error in rsync protocol data stream (code 12) at io.c(600) [sender=3.0.6]

What should I do so that user paru can rsync between the two systems as a root?

1

I just had this problem trying to backup to rsync.net. They told me that the last part, after the colon ":", should be a local pathname.

rsync -avP /opt/paru/ paru@105.1.167.412:/opt/paru

becomes

rsync -avP /opt/paru/ paru@105.1.167.412:opt/paru

0

One way is to actually connect to the remote system as root.

Don't use password-authentication for that, so make sure the sshd_config on the target machine is set to PermitRootLogin without-password. Then, on the remote system add an ssh key to root's authorized_keys file. Load that ssh-key into the local user's ssh-agent.

Then you can simply rsync like this:

rsync -avP /opt/paru/ root@105.1.167.412:/opt/paru

There's no security benefit to your using sudo over the root account, since the paru user on the remote system can easily exploit their sudo permissions to elevate to root anyway.

Another method, that does use sudo is described here. I've always preferred the above method though, for simplicity.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.