Restoring from backup, preserving uids

Matt McCutchen matt at
Sat Aug 2 14:15:07 GMT 2008

On Sat, 2008-08-02 at 08:26 -0500, Neil Gunton wrote:
> I think rsync could match up the "old" uids from 
> the backup with the "current" uids in the system if it had access to the 
> old /etc/passwd file, which maps the uids to usernames. So would it be a 
> good option to add to rsync to give it a path to the "old" passwd file, 
> in order to match up the uids in the source dir to the ones in the 
> destination? Destination would be assumed to use the current passwd, of 
> course. This would help map the old uids to the new ones.

That's the right idea, but rsync relies on the getpw* functions of the C
library rather than reading /etc/passwd directly, so the fix wouldn't be
as simple as adding an option to use a different path to /etc/passwd.
What you can do that works right now is pull from an rsync daemon
configured to chroot into the backup so that the daemon's calls to
getpw* access the /etc/passwd file inside the chroot.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url :

More information about the rsync mailing list