[Pkg-shadow-devel] feature request: add option (--prefix $PREFIX)

James Le Cuirot chewi at aura-online.co.uk
Sat Aug 23 09:17:43 UTC 2014


Tjernlund <tjernlund at ...> writes:

> 
> --prefix is similar to --root but without the actual chroot.
> --prefix is useful when cross compiling and you have your corss
> root FS under a subdir such as /usr/powerpc-tm-linux-gnu then
> groupadd --prefix /usr/powerpc-tm-linux-gnu would prefix all
> /etc/x accesses with /usr/powerpc-tm-linux-gnu/etc/x
> 
> Also, any PAM processing should be skipped if --system is specified too
> 

Are you sure this would be sufficient? I have faced this problem like many 
others but I think the solution is slightly more complicated than that. If 
you add the user foo to your root but it doesn't exist in /, when you 
subsequently issue "chown foo bar" then you'll get "chown: invalid user: 
foo". Similarly, if foo does exist in / but with a different UID or GID, 
when you chown and then chroot, bar will have the wrong IDs.

I believe what is needed is some way to intelligently sync the accounts 
between / and the root. If a user or group already exists in / then use the 
same ID in the root. If it doesn't already exist then create it in / first, 
ensuring that the new ID doesn't clash with one already in the root. If 
there is an unresolvable ID clash then error out.

I'd be up for the challenge but I have limited time and this isn't a 
priority for me at the moment.




More information about the Pkg-shadow-devel mailing list