This might seem like a problem that should have been covered millions of times but I am running into issues that after days of scouring the net, I still can fix.
I have a remote server that I want to backup in its entirety. I am running rsync from a local machine with a user seb that has access to the server over ssh with a public rsa key. The remote has two users, seb and git each with its own folder. User seb is sudoer on the remote.
The command that I have been running from the localhost
sudo rsync -av --rsync-path="sudo /usr/bin/rsync" seb@remote:/ /path/to/backup/
This runs fine in terms of authentication and permissions. I have to run remotely as root with sudo, because otherwise I get a permission denied on stuff owned by root and git.
I run locally as root with sudo because
rsync manual states that in order to preserve group and owner settings as is done with the
-a flag, the receiving user should be root.
rsync is finished the group and owner for the git owned files are changed to
bluetooth respectively. Now I presume that it only fails for git user and not for root and seb since the latter two users exist on both machines.
Is there a way to keep the group and owner settings without creating the user git on the local machine?
p.s. for full disclosure, since I am not sure if it would matter, but I don't expect so, I am running
rsync over a non standard port with
-e "ssh -p PORT"