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/ [email protected]:/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?

2 Answers 2

1

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/ [email protected]:/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.

0

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/ [email protected]:/opt/paru

becomes

rsync -avP /opt/paru/ [email protected]:opt/paru

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .