Translating user id when creating image

view full story

http://unix.stackexchange.com – 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 /home/user/rootfs Create an ext3 img on a file loop mount the empty img (as user or root) in /somewhere/loopmount 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 chown and chgrp (HowTos)