I'm doing quite a bit of development using Yocto to target an embedded system.
As its final output, Yocto generates a tarball of the filesystem, which I then untar onto an ext4 partition of an SD card, which becomes the root filesystem of the embedded system.
In order to set all the permissions correctly on the SD card ext4 partition, I'm currently untarring the file using sudo, which means repeated operations deleting files and so on with root privileges - it's only a matter of time before I accidentally delete some system files due to an erroneous / or something.
Clearly I only need root with respect to the embedded filesystem, not my own machine.
Is there some way to untar the file as a normal user and end up with the correct UIDs on the resultant filesystem? It would be fine to change the way the device is mounted if that solves the problem. Or perhaps some chroot trick?