yoctotutor.com
yoctotutor.com

Reputation: 5521

How to set a default password for root in yocto fido

*I have read the previous answers like below

INHERIT += "extrausers"  
EXTRA_USERS_PARAMS = "usermod -P p@ssw0rd root;"

if I add the above line in my local.conf I cannot create a patch.

So I need guidance to set a default password to root. I found a path in poky below ,which file I need to change. and what can I change.

/home/..../sources/poky/meta/recipes-extended/shadow*

Upvotes: 2

Views: 3388

Answers (2)

LPs
LPs

Reputation: 16243

I used to modify shadow file manually

ROOTFS_POSTPROCESS_COMMAND += "change_root_psw;"
change_root_psw() {
   sed 's%^root:[^:]*:%root:<encrypted_password_goes_here>:%' \
       < ${IMAGE_ROOTFS}/etc/shadow \
       > ${IMAGE_ROOTFS}/etc/shadow.new;
   mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow ;
}

Encrypted password can be retrieved directly from shadow file.

Upvotes: 0

PierreOlivier
PierreOlivier

Reputation: 1556

I think it is not a good idea to modify the default meta files. To add users you can modify your image recipe and simply add:

inherit extrausers
EXTRA_USERS_PARAMS += "usermod -P p@ssw0rd root;"

The location of your image recipe depends on your setup, it will probably be in your custom meta.

Upvotes: 3

Related Questions