Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the exact difference between extrauser and useradd

Tags:

yocto

In one recipe i can see the following but it is not creating any extra user or group, that i confirmed while inspecting rpm file.

inherit extrausers
EXTRA_USERS_PARAMS = "\
        useradd -p '' example; \
        groupadd example; \
        "

So I added the following in the recipe which created a user and group for me.

inherit useradd
USERADD_PACKAGES = "${PN}"
GROUPADD_PARAM_${PN} = "--system example"
USERADD_PARAM_${PN} = "--system -M -d /var/lib/example -s /bin/false -g example example"

What is the exact difference between useradd and extrausers in yocto. Why extrausers cannot able to create user and group.

like image 434
Mohammed Harris Avatar asked Oct 28 '25 01:10

Mohammed Harris


1 Answers

extrausers add user/group at image level and cannot be tied to a specific recipe, and that's the role of useradd class, it can be used on a recipe.

Read the note here:

Note

The user and group operations added using the extrausers class are not tied to a specific recipe outside of the recipe for the image. Thus, the operations can be performed across the image as a whole. Use the useradd class to add user and group configuration to a specific recipe.

And here is the note for useradd:

The useradd* classes support the addition of users or groups for usage by the package on the target. For example, if you have packages that contain system services that should be run under their own user or group, you can use these classes to enable creation of the user or group.

like image 106
Talel BELHAJSALEM Avatar answered Oct 29 '25 17:10

Talel BELHAJSALEM



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!