I want to create an image (for example ext3 image) from a given directory hierarchy. This directory hierarchy is owned by a given user. But on the final image, I want the files to be owned by superuser. Is there a solution for tranlating the user uid / gid to 0 ?
Here is a pseudo workflow :
Create file hierarchy, as user in
Create an ext3 img on a file
loop mount the empty img (as user or root) in
cp -R --magic_uid_options 500=0 /home/user/rootfs /somewhere/loopmount
Or step 4 could be a normal copy and step 5 a clever find that would
chgrp recursively. Is there well known solution to this kind of problem ?