Re: Yocto build to add root password


Mauro
 

On 27/11/19 12:06, Andy Pont wrote:
I tried this out on a build that I am working on for which I needed to add a root password and to create a non-root user with a password.
If I use:
EXTRA_USERS_PARAMS += "usermod -p `openssl passwd -6 ${ROOT_PASSWORD}` root;”
When I try to login to the device it rejects the password that was defined as ROOT_PASSWORD.  If I remove the “-6” from the openssl command and rebuild/deploy the image then I can login to the target as expected.  Is there something else that needs to be defined/included in the Yocto configuration in order for the “-6” option to work?
-Andy.
Actually I'm using:

EXTRA_USERS_PARAMS = " usermod -p '$(openssl passwd -6 myrootpassword)' root;"

with success on warrior.

Sorry, I forgot to mention that with password algorithms like the -6 we need the two ' ' around the openssl command, because the generated hash contains the "$" character, that is resolved as a bash variable somewhere in the process.

But at this point I'm not sure if ${ROOT_PASSWORD} works (I'm using the password wrote on the command, not passed by variable).

Regards

--
Mauro

Join {yocto@lists.yoctoproject.org to automatically receive all group messages.