[meta-freescale] default root password or password request

Matthias.Heise at atlas-elektronik.com Matthias.Heise at atlas-elektronik.com
Tue Nov 18 01:23:19 PST 2014


Hi Joe,

thank you very much, the part with the root password is working, also with a different password copied from shadow into the sed-line.
The new user however isn't even added to the users list, any idea what might be wrong/missing here ? 
The same line as in EXTRA_USER_PARAMS copied into the console works btw. so it must be something with the recipe ... 
The recipe looks like this now :


SUMMARY = "A small image just capable of allowing a device to boot."
#IMAGE_INSTALL = "packagegroup-core-boot packagegroup-core-ssh-openssh nano apt ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_INSTALL = "packagegroup-core-boot ${ROOTFS_PKGMANAGE_BOOTSTRAP} ${CORE_IMAGE_EXTRA_INSTALL}"
IMAGE_INSTALL += " packagegroup-core-ssh-openssh nano"

IMAGE_LINGUAS = " "

LICENSE = "MIT"

inherit core-image

IMAGE_ROOTFS_SIZE ?= "8192"

inherit extrausers
EXTRA_USER_PARAMS = "useradd -p \$6\$53uYm/0Fnll\$Nc0RbHSvqRrd63Tw98TO3V1n25ORK9oR4QHqRIriXzLy0il/7.LIacX7mz7RJ1tdPIWiCJLNyQa7dKBNURqEg1 fstuser;"
ROOTFS_POSTPROCESS_COMMAND += "set_root_password;"
#'passwd'
set_root_password(){
	sed 's%^root:[^:]*:%root:\$6\$eNiHN/Tv8Cjy\$KT/csSqGxk6skJaaE.oThNgBZN5sYXfwk6Wsc36nxye/rZJoObZBJcDe/0D4xBSm0oQLURk.1JeqQiUY/S4Xk1:%'\
	<${IMAGE_ROOTFS}/etc/shadow \
	>${IMAGE_ROOTFS}/etc/shadow.new;
	mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow;
}


-----Ursprüngliche Nachricht-----
Von: Uhl, Joe [mailto:juhl at gai-tronics.com] 
Gesendet: Montag, 17. November 2014 14:16
An: Heise, Matthias; meta-freescale at yoctoproject.org
Betreff: RE: [meta-freescale] default root password or password request

-----Original Message-----
From: meta-freescale-bounces at yoctoproject.org [mailto:meta-freescale-bounces at yoctoproject.org] On Behalf Of Matthias.Heise at atlas-elektronik.com
Sent: Monday, November 17, 2014 6:06 AM
To: meta-freescale at yoctoproject.org
Subject: Re: [meta-freescale] default root password or password request

Did actually no one ever want to add a root password (or a new user WITH password) via recipe ?
Btw the command  "useradd -p password tester;" does not work on the console either so why should it in the .conf or recipe ;-) Although I read something like above in the examples, (with clear-text password) somewhere I also read that the password parameter expects the crypted password.
I tried setting one and then copied it from the /etc/shadow into the .conf but it didn't work either. Or is that the problem, that shadow is used here ?


>>>>>
These links might be of help:
http://www.linuxquestions.org/questions/linux-newbie-8/useradd-p-encrypted-password-520847/
https://wiki.yoctoproject.org/wiki/FAQ:How_do_I_set_or_change_the_root_password

The below example (placed at bottom of image recipe) will add a new user and set an encrypted password as well as add a password to root (which is root).  See the link above on how to get the encrypted password.  Be sure to escape the $'s.

inherit extrausers
EXTRA_USERS_PARAMS = "useradd -p 'encrypted password for newuser' newuser;"
ROOTFS_POSTPROCESS_COMMAND += "set_root_passwd;"
set_root_passwd() {
	sed 's%^root:[^:]*:%root:wYNffsf6sozwE:%' \
	< ${IMAGE_ROOTFS}/etc/shadow \
	> ${IMAGE_ROOTFS}/etc/shadow.new;
	mv ${IMAGE_ROOTFS}/etc/shadow.new ${IMAGE_ROOTFS}/etc/shadow ;
}	



---------------------------------------------------------------------------------------------------------------------------- 
Confidentiality Requirement: This communication, including any attachment(s), may contain confidential information and is for the sole use of the intended recipient(s). If you are not the intended recipient, you are hereby notified that you have received this communication in error and any unauthorized review, use, disclosure, dissemination, distribution or copying of it or its contents is strictly prohibited.  If you have received this communication in error, please notify the sender immediately by telephone or e-mail and destroy all copies of this communication and any attachments.



More information about the meta-freescale mailing list