[yocto] Antwort: Re: Problems with do_rootfs when changing the user password

Rudolf J Streif rudolf.streif at gmail.com
Thu Jun 9 10:28:53 PDT 2016


Hi,

> 
> How are the steps to (re)set the root password?

I am using something like this to set passwords:

inherit extrausers

# set image root password
ROOT_PASSWORD = "secret"
DEV_PASSWORD = "hackme"

EXTRA_USERS_PARAMS = "\
    groupadd developers; \
    useradd -p `openssl passwd ${DEV_PASSWORD}` developer; \
    useradd -g developers developer; \
    usermod -p `openssl passwd ${ROOT_PASSWORD}` root; \
"
 

> 
> If you like I would prefer to solve this question like a tutorial.
> 

Shameless plug here, please excuse: I am explaining this and more in my book "Embedded Linux Systems with the Yocto Project".

> The starting point is a own layer ("myLayer") and a password 
> ("myNewPassword1234").
> 

Using your own layer for your custom distro/image configuration is the way to go. Just put the code above into your image recipe like this:

SUMMARY = "Custom image recipe from scratch"
DESCRIPTION = "Directly assign IMAGE_INSTALL and IMAGE_FEATURES for \
               for direct control over image contents."

LICENSE = "MIT"

# We are using the assignment operator (=) below to purposely overwrite
# the default from the core-image class.
IMAGE_INSTALL = "packagegroup-core-boot packagegroup-base-extended \
                 ${CORE_IMAGE_EXTRA_INSTALL}"

inherit core-image
inherit extrausers

# set image root password
ROOT_PASSWORD = "secret"
DEV_PASSWORD = "hackme"

EXTRA_USERS_PARAMS = "\
   groupadd developers; \
   useradd -p `openssl passwd ${DEV_PASSWORD}` developer; \
   useradd -g developers developer; \
   usermod -p `openssl passwd ${ROOT_PASSWORD}` root; \
   "

Best regards,
Rudi


More information about the yocto mailing list