问题
I am working on the Dora branch (Poky 1.2) of Yocto and need to work on this branch only.
I need to change the blank root password to some other value in order to prevent a security hole in the image during development.
How do I set the root password?
I would like to use the local.conf file.
The method described here does not work: How to set root password on Yocto / Poky image?
回答1:
Add the below line in your build/conf/local.conf
or go to your meta-dir
and add the below line for taking git patch.
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "useradd admin; \
usermod -p $(openssl passwd abc123) admin; \
usermod -p $(openssl passwd knockknock) root; \
"
回答2:
I found that the early version of poky does not accept the -P switch for the usermod in the local.conf file. (Maybe this is because I use Linux kernel 3.0)
In order to change the root password I needed to do the following: (I also added an admin user)
In my poky/build/conf/local.conf file I added the following lines:
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "useradd admin; \
usermod -p $(openssl passwd abc123) admin; \
usermod -p $(openssl passwd knockknock) root; \
"
The password for admin is 'abc123' and the password for root is 'knockknock'.
I also added a recipe for the openssl to the image from poky/meta/recipes-connectivity/openssl/openssl_1.0.1p.bb
来源:https://stackoverflow.com/questions/47850368/how-do-i-change-the-root-password-in-the-yocto-dora-bitbake-system