Patchwork [V5,0/3] Add a method for image level user/group configuration

login
register
mail settings
Submitter Qi.Chen@windriver.com
Date July 16, 2013, 6:27 a.m.
Message ID <cover.1373953711.git.Qi.Chen@windriver.com>
Download mbox
Permalink /patch/53737/
State New
Headers show

Pull-request

git://git.pokylinux.org/poky-contrib ChenQi/extrausers

Comments

Qi.Chen@windriver.com - July 16, 2013, 6:27 a.m.
From: Chen Qi <Qi.Chen@windriver.com>

Changes from V4:
1. Take into consideration the possibility of whitespaces in /etc/passwd and /etc/group
2. Change bbfatal in perform_usermod and perform_groupmod to bbwarn. Please see detailed reason below.

PackageA pulls in userA.
Now we want userA to map to a fixed user ID without having to worry whether PackageA is installed.
We can now use the following configuration to achieve this requirement.
EXTRA_USERS_PARAMS += "
usermod, -u 2013 userA; \
"
After this configuration, if PacakgeA is installed in our image, the user ID is modified to 2013;
otherwise, there's no change in /etc/passwd, i.e., userA will not be added to /etc/passwd silently.

Hope this information will be useful.

//Chen Qi


The following changes since commit a63229917a5708de2d161aba0d67168ce0da6365:

  meta-yocto-bsp: update reference board SRCREVs (2013-07-10 09:45:51 +0100)

are available in the git repository at:

  git://git.pokylinux.org/poky-contrib ChenQi/extrausers
  http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/extrausers

Chen Qi (3):
  useradd_base.bbclass: add a new bbclass
  useradd.bbclass: code refactor
  extrausers.bbclass: add a new bbclass

 meta/classes/extrausers.bbclass   |   61 ++++++++++
 meta/classes/useradd.bbclass      |   99 ++--------------
 meta/classes/useradd_base.bbclass |  230 +++++++++++++++++++++++++++++++++++++
 3 files changed, 299 insertions(+), 91 deletions(-)
 create mode 100644 meta/classes/extrausers.bbclass
 create mode 100644 meta/classes/useradd_base.bbclass
Saul Wold - July 16, 2013, 9:40 p.m.
On 07/15/2013 11:27 PM, Qi.Chen@windriver.com wrote:
> From: Chen Qi <Qi.Chen@windriver.com>
>
> Changes from V4:
> 1. Take into consideration the possibility of whitespaces in /etc/passwd and /etc/group
> 2. Change bbfatal in perform_usermod and perform_groupmod to bbwarn. Please see detailed reason below.
>
> PackageA pulls in userA.
> Now we want userA to map to a fixed user ID without having to worry whether PackageA is installed.
> We can now use the following configuration to achieve this requirement.
> EXTRA_USERS_PARAMS += "
> usermod, -u 2013 userA; \
> "

What happens files that userA might have already created outside the 
home directory? I know that usermod will fixup the home directory and 
some mail related files.

Sau!


> After this configuration, if PacakgeA is installed in our image, the user ID is modified to 2013;
> otherwise, there's no change in /etc/passwd, i.e., userA will not be added to /etc/passwd silently.
>
> Hope this information will be useful.
>
> //Chen Qi
>
>
> The following changes since commit a63229917a5708de2d161aba0d67168ce0da6365:
>
>    meta-yocto-bsp: update reference board SRCREVs (2013-07-10 09:45:51 +0100)
>
> are available in the git repository at:
>
>    git://git.pokylinux.org/poky-contrib ChenQi/extrausers
>    http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/extrausers
>
> Chen Qi (3):
>    useradd_base.bbclass: add a new bbclass
>    useradd.bbclass: code refactor
>    extrausers.bbclass: add a new bbclass
>
>   meta/classes/extrausers.bbclass   |   61 ++++++++++
>   meta/classes/useradd.bbclass      |   99 ++--------------
>   meta/classes/useradd_base.bbclass |  230 +++++++++++++++++++++++++++++++++++++
>   3 files changed, 299 insertions(+), 91 deletions(-)
>   create mode 100644 meta/classes/extrausers.bbclass
>   create mode 100644 meta/classes/useradd_base.bbclass
>
Qi.Chen@windriver.com - July 17, 2013, 5:27 a.m.
On 07/17/2013 05:40 AM, Saul Wold wrote:
> On 07/15/2013 11:27 PM, Qi.Chen@windriver.com wrote:
>> From: Chen Qi <Qi.Chen@windriver.com>
>>
>> Changes from V4:
>> 1. Take into consideration the possibility of whitespaces in 
>> /etc/passwd and /etc/group
>> 2. Change bbfatal in perform_usermod and perform_groupmod to bbwarn. 
>> Please see detailed reason below.
>>
>> PackageA pulls in userA.
>> Now we want userA to map to a fixed user ID without having to worry 
>> whether PackageA is installed.
>> We can now use the following configuration to achieve this requirement.
>> EXTRA_USERS_PARAMS += "
>> usermod, -u 2013 userA; \
>> "
>
> What happens files that userA might have already created outside the 
> home directory? I know that usermod will fixup the home directory and 
> some mail related files.
>
> Sau!
>
According to the manual, how the home directory is handled is controlled 
by the options.

'''
If the -m option is given, the contents of the current home directory 
will be moved to the new home directory, which is created if it does not 
already exist.

-m, --move-home
    Move the content of the user's home directory to the new location.
'''

Best Regards,
Chen Qi

>> After this configuration, if PacakgeA is installed in our image, the 
>> user ID is modified to 2013;
>> otherwise, there's no change in /etc/passwd, i.e., userA will not be 
>> added to /etc/passwd silently.
>>
>> Hope this information will be useful.
>>
>> //Chen Qi
>>
>>
>> The following changes since commit 
>> a63229917a5708de2d161aba0d67168ce0da6365:
>>
>>    meta-yocto-bsp: update reference board SRCREVs (2013-07-10 
>> 09:45:51 +0100)
>>
>> are available in the git repository at:
>>
>>    git://git.pokylinux.org/poky-contrib ChenQi/extrausers
>> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/extrausers
>>
>> Chen Qi (3):
>>    useradd_base.bbclass: add a new bbclass
>>    useradd.bbclass: code refactor
>>    extrausers.bbclass: add a new bbclass
>>
>>   meta/classes/extrausers.bbclass   |   61 ++++++++++
>>   meta/classes/useradd.bbclass      |   99 ++--------------
>>   meta/classes/useradd_base.bbclass |  230 
>> +++++++++++++++++++++++++++++++++++++
>>   3 files changed, 299 insertions(+), 91 deletions(-)
>>   create mode 100644 meta/classes/extrausers.bbclass
>>   create mode 100644 meta/classes/useradd_base.bbclass
>>
>
>
Qi.Chen@windriver.com - July 17, 2013, 5:41 a.m.
On 07/17/2013 01:27 PM, ChenQi wrote:
> On 07/17/2013 05:40 AM, Saul Wold wrote:
>> On 07/15/2013 11:27 PM, Qi.Chen@windriver.com wrote:
>>> From: Chen Qi <Qi.Chen@windriver.com>
>>>
>>> Changes from V4:
>>> 1. Take into consideration the possibility of whitespaces in 
>>> /etc/passwd and /etc/group
>>> 2. Change bbfatal in perform_usermod and perform_groupmod to bbwarn. 
>>> Please see detailed reason below.
>>>
>>> PackageA pulls in userA.
>>> Now we want userA to map to a fixed user ID without having to worry 
>>> whether PackageA is installed.
>>> We can now use the following configuration to achieve this requirement.
>>> EXTRA_USERS_PARAMS += "
>>> usermod, -u 2013 userA; \
>>> "
>>
>> What happens files that userA might have already created outside the 
>> home directory? I know that usermod will fixup the home directory and 
>> some mail related files.
>>
>> Sau!
>>
OK... I misunderstood you comments ..

Here's what manual says about this situation.
'''
-u, --uid UID
            The new numerical value of the user's ID.

            This value must be unique, unless the -o option is used. The 
value must be non-negative. Values between 0 and 999 are typically 
reserved for system accounts.

            The user's mailbox, and any files which the user owns and 
which are located in the user's home directory will have the file user 
ID changed automatically.

            The ownership of files outside of the user's home directory 
must be fixed manually.
'''

If the usermod command is not going to change the ownership of the files 
outside the user's home directory, I guess we don't have enough reason 
to do that. Besides, searching files in rootfs is a very time consuming 
process.

Best Regards,
Chen Qi



> According to the manual, how the home directory is handled is 
> controlled by the options.
>
> '''
> If the -m option is given, the contents of the current home directory 
> will be moved to the new home directory, which is created if it does 
> not already exist.
>
> -m, --move-home
>    Move the content of the user's home directory to the new location.
> '''
>
> Best Regards,
> Chen Qi
>
>>> After this configuration, if PacakgeA is installed in our image, the 
>>> user ID is modified to 2013;
>>> otherwise, there's no change in /etc/passwd, i.e., userA will not be 
>>> added to /etc/passwd silently.
>>>
>>> Hope this information will be useful.
>>>
>>> //Chen Qi
>>>
>>>
>>> The following changes since commit 
>>> a63229917a5708de2d161aba0d67168ce0da6365:
>>>
>>>    meta-yocto-bsp: update reference board SRCREVs (2013-07-10 
>>> 09:45:51 +0100)
>>>
>>> are available in the git repository at:
>>>
>>>    git://git.pokylinux.org/poky-contrib ChenQi/extrausers
>>> http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=ChenQi/extrausers
>>>
>>> Chen Qi (3):
>>>    useradd_base.bbclass: add a new bbclass
>>>    useradd.bbclass: code refactor
>>>    extrausers.bbclass: add a new bbclass
>>>
>>>   meta/classes/extrausers.bbclass   |   61 ++++++++++
>>>   meta/classes/useradd.bbclass      |   99 ++--------------
>>>   meta/classes/useradd_base.bbclass |  230 
>>> +++++++++++++++++++++++++++++++++++++
>>>   3 files changed, 299 insertions(+), 91 deletions(-)
>>>   create mode 100644 meta/classes/extrausers.bbclass
>>>   create mode 100644 meta/classes/useradd_base.bbclass
>>>
>>
>>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core@lists.openembedded.org
> http://lists.openembedded.org/mailman/listinfo/openembedded-core
>
>