[yocto] passwd fails for other users than root

Arno Steffens star at gmx.li
Wed Mar 14 00:19:54 PDT 2018



> Gesendet: Montag, 12. März 2018 um 09:21 Uhr
> Von: "Maxin B. John" <maxin.john at intel.com>
> An: "Arno Steffens" <star at gmx.li>
> Cc: yocto at yoctoproject.org
> Betreff: Re: [yocto] passwd fails for other users than root
>
> Hi Arno,
> 
> On Fri, Mar 09, 2018 at 07:19:06AM +0100, Arno Steffens wrote:
> > I have 2 extra users (added with useradd_example.bb). Login works for all 3 parties.
> > 
> > While login works, passwd (to change it) doesn't work for the extra users. They will asked for the old one - which fails.
> > Root is not to be asked for old password. That's way root can change password for all. 
> > 
> > The strange issue is, that after root changes password for users, they can do it by themselves.
> > Seems that login and passwd use different algos!?!?
> > 
> > Same password, but different hashes:
> > before (created by yocto)
> > user:$6$bk.Az/8KVV$v3TyAlroQeBZA3faJ.DxCVsCUBZaSAvB4FkuNkLDdsIchrmz6OnUGRnQI5BOgOjQ3mvj9QL3US6Amf2VWr0.j/:17598:0:99999:7:::
> > behind (changed by root):
> > user:$1$d3Uo1g82$Il2kYQj8qadzQvkwUU4Ia.:17598:0:99999:7:::
> > 
> > Edit: After a few further test I found that this has an effect:
> > I used EXTRA_IMAGE_FEATURES += "read-only-rootfs" to create a read-only-rootf (by default). 
> > But of course I did make the partition writeable before attempting to change the password.
> > But for some strange reasons this is not same. What might be the reason?
> 
> Can you please share the version details and the useradd_example.bb that was mentioned here ?
> or even better, file a bug in Yocto's bugzilla (https://bugzilla.yoctoproject.org) ?
> 
> Best Regards,
> Maxin
>

I have been using the Yocto 2.3.3 version.
It is mainly unchanged useradd_example. The according line is

# USERADD_PARAM specifies command line options to pass to the
# useradd command. Multiple users can be created by separating
# the commands with a semicolon. Here we'll create two users,
# user1 and user2:
USERADD_PARAM_${PN} = "-u 1200 -d /home/user -r -s /bin/sh -P '' user; -u 1201 -d /home/guest -r -s /bin/sh -P '' guest"

and in the image-recipe I added:

EXTRA_IMAGE_FEATURES += "read-only-rootfs"

CORE_IMAGE_EXTRA_INSTALL += "useradd-example"
inherit extrausers
EXTRA_USERS_PARAMS = "usermod -P root root; usermod -P user user; usermod -P guest guest"


...

But I also tried to leave the usermod command and add the password here:
USERADD_PARAM_${PN} = "-u 1200 -d /home/user -r -s /bin/sh -P 'user' user; -u 1201 -d /home/guest -r -s /bin/sh -P 'guest' guest"

...

The "read-only-rootfs" seems to make the difference, but I don't understand why. 



More information about the yocto mailing list