# Rsync root files with no root user



## akshin (Oct 25, 2019)

Hi!
How can I Rsync root files with no root user.
Im working with user akshin.
This from sudoers:

```
##
## User privilege specification
##
root ALL=(ALL) ALL
akshin ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
%sudo   ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
# Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Uncomment to show on password prompt which users' password is being expected
# Defaults passprompt="%p's password:"

## Read drop-in files from /usr/local/etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /usr/local/etc/sudoers.d
```

I want to copy file with rsync from my server to another server with the same akshin user.

```
akshin@freebsd:/usr/local/etc % sudo groups akshin
akshin wheel
```


```
akshin@freebsd:/ % sudo rsync -avvHA /pool/COPYRIGHT akshin@192.168.211.134:/pool/COPYRIGHT
```

Im getting this error


```
sending incremental file list
delta-transmission enabled
COPYRIGHT
rsync: mkstemp "/pool/.COPYRIGHT.UdEigu" failed: Permission denied (13)
total: matches=0  hash_hits=0  false_alarms=0 data=6177
sent 6,268 bytes  received 142 bytes  1,424.44 bytes/sec
total size is 6,177  speedup is 0.96
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1211) [sender=3.1.3]
```

pool is drwxrxrx root:wheel
COPYRIGHT is rw.rw.rw. root:wheel

Please help me


----------



## SirDice (Oct 25, 2019)

Add `--rsync-path="/usr/local/bin/sudo /usr/local/bin/rsync"` and make sure your user is allowed to sudo (without password) on the destination.

The 'problem' is that the akshin user on the destination is not allowed to chown root:wheel files, thus it can never create those files and it gives you a "permission denied". Not because of the permissions but because it tries to change the ownership. 

And please, undo this:

```
pool is drwxrxrx root:wheel
COPYRIGHT is rw.rw.rw. root:wheel
```


----------



## akshin (Oct 25, 2019)

Thank you. Its working


----------

