On 24/08/23 07:22, Khem Raj wrote:
On Wed, Aug 23, 2023 at 10:11 PM Jeffrey Simons
<jeffrey.sim...@boonedam.com> wrote:

On Wed, Aug 23, 2023 at 03:50 PM, Crane wrote:


On Wed, Aug 23, 2023 at 03:45 AM, Mauro wrote:


You can put the encrypted password (the result of the "openssl passwd -6
root" command) directly in the variable, taking care to put a "\" before
the three "$" contained in the string. Something like this:

EXTRA_USERS_PARAMS=" usermod -p

'\$6\$CEM0hANiVS9VXN8N\$Q9XK1KTpq2faq2fNbSRLNeeA4mmQsl8g1Gwl3QnTPlRPb5ljCAa./bbhffcthXxUen4jSFL6HKGQPlHZNQkfA/'
root; useradd -p

'\$6\$5wVybJkbuowR0iMi\$tnEJEEbXbcRfksKRSt7rjlY1hRERrjqFOlCaa0s1ivISxAHT7MFdcnZvVbRHgkqRSYzA1oLUxtR0LuvDTMPR5/'
crane; "

Tried as well. And a \ is added automatically in front of $, so no need to add
it. But still not working.
There must be something else missing. Anyway to debug in this case?


 From testing I have observed that the extrausers does not work from a recipe, 
while useradd works correctly from a recipe.
The extrausers should work as expected from within the distribution 
description, so you might want to try that.

For debugging you could print the bitbake variables to screen (-e) and grep on 
the EXTRA_USERS_PARAMS.


See this

https://github.com/YoeDistro/yoe-distro/blob/master/conf/projects/rpi4-64/config.conf#L57-L66

you might try something like that in config metadata e.g. local.conf

Hope this is will help you solving the issue.

--
With kind regards,

Jeffrey Simons

Software Engineer
Royal Boon Edam International B.V.


Hi all,

I did some tests on a Yocto Kirkstone using qemux86-64.

I can confirm that:

- using extrausers class in local.conf (as pointed out by Khem) works properly

  INHERIT += "extrausers"
  EXTRA_USERS_PARAMS = "useradd -p '$(openssl passwd -6 crane)' crane;"

  OR (escaped cyphered password)

  INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "useradd -p '\$6\$z6vHqLrwnkHbcf5n\$0Fod3ijjV0XcGLYJm.EcomRXsL63p3ntbmznEjp7FHQq4sDtd/YFcAbw5Dg4/iQAsAyee7YG5/LNTe4nCwxzg1' crane;"

- using extrausers class in image recipe works properly

  inherit extrausers
  EXTRA_USERS_PARAMS = "useradd -p '$(openssl passwd -6 crane)' crane;"

  OR (escaped cyphered password)

  inherit extrausers
MY_PASSWORD = "$6$jAB6jLC45xV7v9yY$nZS7WymiLb1152aV51mYDc0RNctmYi9M0xS9bkXUCIafCGQ/EyIp76.kltVKWt5U4YjHkTOGymP7OJ6p9DVpN."
  EXTRA_USERS_PARAMS = "useradd -p '${MY_PASSWORD}' crane;"

- using useradd class in a recipe works

  inherit useradd
  DEPENDS += "openssl-native"
USERADD_PARAM:${PN}-user3 = "-u 1202 -d /home/user3 -r -s /bin/sh -p '$(openssl passwd -6 user3)' user3"

  OR (escaped cyphered password)

  inherit useradd
USERADD_PARAM:${PN}-user3 = "-u 1202 -d /home/user3 -r -s /bin/sh -p '\$6\$bblNDDxePa6LNBbE\$3P5MkG2pUFY1TI1A2Y9CXjA83gvnrO7UMQkcWOEOO7MN4ESJHG7wqfiYWOeHPGZSEKM5/3bcMHDsDBfxpZKRv1' user3"

The only thing to pay attention to is to add

  DEPENDS += "openssl-native"

in the recipe in case the openssl form is used.

To Crane: please try to build the image and test it, don't stop at Yocto variables analysis step.

regards

[1] https://docs.yoctoproject.org/ref-manual/classes.html?highlight=useradd#extrausers

--
Mauro Salvini | KOAN sas | Bergamo - Italia
embedded software engineering
http://KoanSoftware.com

-=-=-=-=-=-=-=-=-=-=-=-
Links: You receive all messages sent to this group.
View/Reply Online (#60877): https://lists.yoctoproject.org/g/yocto/message/60877
Mute This Topic: https://lists.yoctoproject.org/mt/100887124/21656
Group Owner: yocto+ow...@lists.yoctoproject.org
Unsubscribe: https://lists.yoctoproject.org/g/yocto/unsub 
[arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to