2023-10-16 05:36 AM
Hi all.
I am adding a new user to my Linux image. After generating the image I verify the `/etc/passwd` on the rootfs and the new user is not present. When I try to login to this new user on the running image itself, it doesn't work. As I am using the "read-only-rootfs" feature, I think some extra setup is required to fix this issue.
In order to build my recipe, I followed the instructions from useradd-example.bb .
How to add a new user properly with the read only rootfs feature?
PS. I am setting another partition on the /home. So this folder is writable.
Thanks
2023-11-07 07:46 AM
Hi @vfranchi ,
to add a new user, during a yocto training, we were using the following, but I'm far to be an expert:
# create password hash using openssl
openssl passwd -5 MY_PASSWORD
# you get a hash string in a form of $5$nnn...nnn$nnn...nnn
# add hash in my-image (prefix each $ by \)
gedit ../../layers/meta-my-layer/recipes-core/images/my-image.bb
inherit core-image extrausers
EXTRA_USERS_PARAMS += "useradd -p '\$5\$nnn...nnn\$nnn...nnn' MY_USERNAME;"
Hope this helps.
Regards.
2023-11-07 11:06 AM
Hi @PatrickF
Thank you for your reply.
I tried the `EXTRA_USERS_PARAMS` before, but it does not work due the read-only-rootfs option. I guess it is because Yocto adds the users after the rootfs recipe is done and then due the immutability it does not work. If I remove the read-only then it works just fine.
Regarding the `core-image` inherit from your example, do you know if it causes the users to be added at another moment on the build?
Thank you.