Storing ownership / device nodes without root

Wesley W. Terpstra wesley at
Thu Oct 26 11:25:56 GMT 2006

Right now, if you want a faithful backup of a system, you must either  
have root access on the target machine (for chown, mknod, ...), or  
you have to arrange for fakeroot/pretendroot to wrap itself around  
the rsync server to catch all these permissions/etc and keep them in  
a database file. Also, the fakeroot approach isn't exactly reliable  
(premature exit -> all SAVED permission data is lost).

My problem (and I assume that of others) is that I don't have/want  
root access on my backup server.

What I am wondering: wouldn't it be better to store the backed up  
permissions/stat-info in an extended attribute? That way, copying the  
file around doesn't separate it from its meta-data (like in the  
fakeroot case). Also, fakeroot/etc only works on systems where you  
can do LD_PRELOAD tricks.

I was thinking of options like '--source-fake-root' and '--dest-fake- 
root'. The client turns '--dest-fake-root' into '--source-fake-root'  
on the remote rsync process. If either end has a '--source-fake- 
root', they wrap their use of stat/chown to grab/modify the uid/gid/ 
rdev/mode from/to xattrs of the form user.rsync.fake- 
{uid,gid,mode,rdev}. The EA code would also silently drop EAs of  
those names.

This seems to me like a pretty easy change that would be quite  
useful. do_mknod and do_lchown are already wrapppers. The hardest  
part would be tracking down all the uses of stat/fstat/etc and  
wrapping them.

What do others think?

If people like this, I'll write it. If people have a better  
suggestion, let me know, because I need to solve this!

More information about the rsync mailing list