I do a lot of development in "desktop" linux (x86) where I need to make a filesystem distribution for an embedded linux filesystem.

Normally you would just do:

   mkdir /tmp/embeddedFileSystemRoot
   cp <files I want> /tmp/embeddedFileSystemRoot
   cd /tmp; tar zcvf embeddedFileSystemRoot.tgz embeddedFileSystemRoot
   ... copy to embedded filesystem ...

Here's my issue: I want to be able to specify users for the embedded File system programs for security purposes. However, if I try to chown/chgrp a file in /tmp/embeddedFileSystemRoot it will fail as I would be using the desktop's users and not the embedded system's users.

I could use sudo but that seems risky plus I might set a file into a state such that the non-root user couldn't read it.

Is there a better way to make my own 'virtual directory' or other file system in user space so that I can set uid/gids for my target system and have them propogate in the tar file? I.E.

    mkfilesystem /tmp/mySpecialFileSystem
    cp file1 file2 file3 /tmp/mySpecialFileSystem
    cd /tmp/mySpecialFileSystem
    chown 0:0 file1
    chown 1:1 file2 
    chown 1001:1001 file3 
    chmod 600 * 
    cd /tmp
    tar zcvf myEmbeddedFileSystem.tgz mySpecialFileSystem  

(letting me read everything and preserving the uids/gids)

New contributor
RDP is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

RDP is a new contributor. Be nice, and check out our Code of Conduct.

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.