Robert Crida
2011-Feb-14 12:10 UTC
Trying to preserve UID and GID when backing up with rsync
Hi all
I am trying to use rsync as part of a backup solution for a machine with
multiple users. The intention is to run rsyncd on a different server with
typically different user IDs. I also intend to run rsync from the client as root
and essentially back up the following:
/etc/passwd
/etc/shadow
/etc/group
/home
In the event of a disaster we would reprovision the machine then restore the
user accounts etc with a single run of rsync by root. Ideally all the home
directories and their contents would be restored back to their original UIDs and
GIDs which would be fine because we would have provided the mapping by restoring
the passwd and group files too.
I am in early prototyping phase now and have the following rsyncd.conf file:
max connections = 4
[school10000]
path = /backup/school/./10000
read only = false
use chroot = true
I ran the following command (on the same machine as the server):
rsync -az ./.viminfo fw.school10000::school10000
The result on the server is:
root at fw.school10000:/etc# ls -nal /backup/school/10000/
total 12
drwxrwxrwx 2 0 0 4096 2011-02-14 14:08 .
drwxr-xr-x 3 0 0 4096 2011-02-14 11:30 ..
-rw------- 1 65534 65534 590 2011-02-14 10:52 .viminfo
The file has been saved as nobody:nogroup.
There appears to be a related bug
(https://bugzilla.samba.org/show_bug.cgi?id=7773) which has been marked as a
duplicate of https://bugzilla.samba.org/show_bug.cgi?id=3829.
Could someone please confirm whether what I am trying to do is possible or
whether I am bumping into the bug as noted above.
If there is a solution I would be keen to know. If it is the bug it would be
great to know if it is being worked on?
Thanks
Robert Crida
rcrida at clue.co.za
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
<http://lists.samba.org/pipermail/rsync/attachments/20110214/c96aa3dc/attachment.html>
Paul Slootman
2011-Feb-14 13:54 UTC
Trying to preserve UID and GID when backing up with rsync
On Mon 14 Feb 2011, Robert Crida wrote:> I am in early prototyping phase now and have the following rsyncd.conf file: > max connections = 4 > > [school10000] > path = /backup/school/./10000 > read only = false > use chroot = true > > I ran the following command (on the same machine as the server): > rsync -az ./.viminfo fw.school10000::school10000 > > The result on the server is: > root at fw.school10000:/etc# ls -nal /backup/school/10000/ > total 12 > drwxrwxrwx 2 0 0 4096 2011-02-14 14:08 . > drwxr-xr-x 3 0 0 4096 2011-02-14 11:30 .. > -rw------- 1 65534 65534 590 2011-02-14 10:52 .viminfoCheck the manual page for rsyncd.conf; you'll see that the default uid under which rsyncd runs for such modules is "nobody", which generally equates to 65534. Add a line "uid = 0" to enable the daemon to correctly set the owner and groups. Paul