| Summary: | During filesystem construction add a method to add/modify users and groups settings | ||
|---|---|---|---|
| Product: | [Build System, Metadata & Runtime] OE-Core | Reporter: | Mark Hatle <mark.hatle> |
| Component: | deployment | Assignee: | Chen Qi <Qi.Chen> |
| Status: | VERIFIED FIXED | QA Contact: | |
| Severity: | enhancement | ||
| Priority: | Medium | CC: | liezhi.yang, Qi.Chen, sgw, venkatarg, yi.zhao |
| Version: | unspecified | ||
| Target Milestone: | 1.5 M3 | ||
| Hardware: | x86 | ||
| OS: | Multiple | ||
| Whiteboard: | |||
| OS type for building Yocto: | --- | Type of Regression: | --- |
| Verified: | Documentation change: | --- | |
| Bug Depends on: | |||
| Bug Blocks: | 1577, 4106 | ||
|
Description
Mark Hatle
2013-03-21 15:01:23 UTC
Hi Mark, These days, I've been thinking about this problem from time to time. I thought about several ways to accomplish this task, but at last I came to the conclusion that the consistent way to achieve image level user/group setting still falls into the useradd.bbclass solution. Let's consider two possible scenarios. 1) I want to add a user/group which doesn't logically belong to a specific package. In this case, I think a dedicated package should be created in the corresponding layer, which inherits useradd class. Say, we have a layer, meta-product, and we want to add two users 'developer' and 'tester' to the image. A recipe dedicated for creating these two users will do the job for us, and in my opinion, in a consistent and manageable way, considering the possibility of the package upgrade. 2) I want to modify the user/group setting in some packages. In this case, I think using a bbappend file and overriding the some variable like USERADD_PARAM would be sufficient. Any thoughts on this? Best Regards, Chen Qi *** Bug 4729 has been marked as a duplicate of this bug. *** >>1) I want to add a user/group which doesn't logically belong to a specific package. This method can be safely implemented by adding "adduser" config command using binary configuration feature. Please refer to https://wiki.yoctoproject.org/wiki/Binary_configuration_support >>2) I want to modify the user/group setting in some packages. Yes, Poky supports using existing useradd.bbclass. merged into poky/master: 6d42c2718373a13b67986627b4c7a91719194c4b http://git.openembedded.org/?p=openembedded-core.git&a=commit;h=4b6deb521183b728d9a1c651d4805fe635e6cb50 Test Cases Steps: 1. Download the poky source and set the environment 2. Add the following lines in conf/local.conf INHERIT += "extrausers" EXTRA_USERS_PARAMS = "\ useradd -p '' tester1; \ useradd -p 'vz4kBbiMF9z6E' tester2; \ groupadd developers; \ userdel games; \ groupdel -g video; \ groupmod -g 1020 developers; \ usermod -s /bin/sh tester1; \ usermod -g users -G developers,sys tester2; \ " The above settings do the following things: a. Add a user tester1 with empty password b. Add a user tester2 with password 123456 c. Add a group developers d. Delete user games e. Delete group video f. Set the gid of developers to 1020 g. For tester1, set the login shell to /bin/sh h. For tester2, set the initial group to users. Set the supplementary groups to developers and sys. 3. Build the image Expected Results: 1. No errors when building the image. 2. The image can boot up. The /etc/group, /etc/passwd, and /etc/shadow should no errors. 3. Login with tester1 and tester2 without problems. Run "id" command to check the user status. Verified with master/9de0ad47462c13ac4a2d73e12e92be6c1b4e0415 |