Closed Louson closed 1 year ago
Good idea, but this will not work: with -p
the passwords have to be hashed. One way to hash a password (for instance root
) is:
$ openssl passwd -5 root
$5$1xX2pq0QkWc.hul1$fm3yN7Y.7BL26NoAoWPmz7cUHHPg658Ag.lHsCXc0TD
Then insert it with double-backslashes preceding the $
(three times):
"EXTRA_USERS_PARAMS_append = 'usermod -p \\$5\\$1xX2pq0QkWc.hul1\\$fm3yN7Y.7BL26NoAoWPmz7cUHHPg658Ag.lHsCXc0TD root;' ",
Not really intuitive...
This is true :/ Then it's maybe easier to remove those lines ?
For some reason, openssl does not give the right hash. The yocto page recommands mkpasswd:
$ mkpasswd -m sha256crypt root
$5$7H4iA1OMpawpxVRG$RoH57a3WzrrMU.enSqM5.SRPamRhT97swGurEZZunw6
https://docs.yoctoproject.org/singleindex.html#term-EXTRA_USERS_PARAMS
It's strange, I use openssl
very often (yesterday for example) during Yocto training courses.
I've inserted the hashed passwords in the above patch.
Can you test on your side, I can't make it work on my qemu, I can't explain
You're right, it doesn't work as is. To put a password in a menu, we have to use this:
"# `root` password: `linux` ",
"EXTRA_USERS_PARAMS:append = \"usermod -p '\\$5\\$oWODdN2qVYVBB5Nl\\$NrH9rY/8gxTkbdEbNzBK9Iu5KLlSppkOhooF8sP2mo/' root;\" ",
Kind of weird, no ?
I propose to keep one such example of password configuration (usermod
and useradd
) in a single menu, and remove all the extra-user
lines from the other menus.
Are you OK with that?
yes, it's fine for me
I have not made any test except the automatic tests
Fix an error in the
usermod
command. For some reason it did not fail while the-P
option did not exist. On recent shadow version,-P
is for--prefix
and the build fails.