I am setting root password for my linux using the following in local.conf
file:
INHERIT += "extrausers"
EXTRA_USERS_PARAMS = "usermod -p '\$6\$...'"
This works correctly, as expected.
But now, I found that in linux 5.10, to authenticate a user, I cannot check /etc/shadow
, instead I need to use the libpam
module. So, I did the following to add libpam to my linux image:
libpam
to PACKAGE_INSTALL
.pam
in DISTRO_FEATURES_append
Now, when I flash this new image, the root
user does not have any password. Adding libpam is somehow removing the password set using extrausers
...
Is there a way to set the password in the image using libpam? Or is there something I am doing wrong when using extrausers and adding libpam to my image?
Since I couldn't get an answer here and on github issues of libpam
I gave up trying to make libpam work for me.
I decided to use the /etc/shadow
file. I removed extrausers
and instead set the password manually into the shadow file using the following:
ROOTFS_POSTINSTALL_COMMAND += "set_root_password;"
set_root_password () {
sed -e "s/root::/root:\$6\$...:/" -i ${IMAGE_ROOTFS}/etc/shadow
}
Now I don't need to use libpam
and can keep authenticating users to my redfish server using the shadow file.