Saving ownership as non-root

Paul Slootman paul at debian.org
Wed Aug 16 14:24:57 GMT 2006


On Wed 16 Aug 2006, Robert Siemer wrote:
> 
> Out of curiosity: What (backup) solutions do you use to let rsync store
> device files and ownership permissions without root privileges?
> 
> I found out about "fakeroot" so far. Is there actually a practical use
> for the "--super" option? I didn't find anything as fakeroot doesn't
> need it...

fakeroot is pretty debian-specific I believe; at least it originated
there. At least, I suspect it will only work under glibc systems.

Additionally, it is exactly as it says: fake.

paul at c32125:/tmp$ fakeroot sh
sh-3.1# id
uid=0(root) gid=0(root) groups=3(sys),4(adm),29(audio),50(staff)
sh-3.1# mknod bla b 1 2
sh-3.1# ls -l bla
brw-r--r-- 1 root root 1, 2 Aug 16 16:16 bla

meanwhile, in another shell:
paul at c32125:~$ ls -l /tmp/bla
-rw-r--r-- 1 paul staff 0 Aug 16 16:16 /tmp/bla

With fakeroot you start a "daemon" that tracks everything you do under
it, and remembers things that are done that can only be done by root;
later accesses are faked with the fake information so that it seems you
can actually create device nodes etc.  This is very useful when building
packages so that the owenerships, permissions, devices etc. inside the
package are correct even though the package is built as a normal user;
this in fact is its intended purpose under Debian.

It would be a pretty bad security hole if you actually could perform
privileged operations via fakeroot.

Hence although it would look like you could use rsync to backup device
nodes and so on via fakeroot, as soon as the fakeroot session is ended,
the information is gone. There is some support for persistent storage of
the fake info, but that's not perfect; I wouldn't rely on it for _my_
backups.


> Additionally it would be a nice idea to refer to "fakeroot" from the
> rsync manual. - It took me a day to find that out. And am still looking
> for alternatives... Anyone?

the mention in the manual would have to be pretty explicit about the
caveats.


Paul Slootman


More information about the rsync mailing list