Re: [poky] Creating a hash of a password for my recipe to add a user

Khem Raj <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <CAMKF1so0mv6XRO8oU15LVmFW4=oOi7mCQMgcO2NFS0kskeHO6g@mail.gmail.com>
see

https://github.com/YoeDistro/yoe-distro/blob/master/sources/meta-yoe/recipes-core/images/yoe-simple-image.bb#L37-L50

On Sat, Mar 1, 2025 at 4:42 PM John via lists.yoctoproject.org
<[email protected]> wrote:
>
> I tried the extrausers class and I didn't get any errors but I also got no joy. Nothing was created on the target and I moved onto using the adduser example from the meta-skeleton directories. I have joy now, the additional user is created and I can see the user's home directory various entries required in all of the relevant files. yay!
>
> However I have this line in my recipe (ignore the underline):
>
>
> NEWGUY_PASSWORD = "\$6\$zap5cUSDzKQyKfmL\$g8RRKqDw8U9BlmQFO2GLDPvcGe5mWSnwhMtYbDeKpPEDULJ2yLUhI6oHP4xq/p7fbE2SftFy4bvPd.ZsHVS55."
>
>
> I then have this to set the parameters for the added user:
>
>
> USERADD_PARAM:${PN} = " -d /home/newguy \
>                         -m \
>                         -G tty,audio \
>                         -p ${NEWGUY_PASSWORD} \
>                         -U newguy \
>                       "
>
> I can't login to the board using the password I created using the command:
>
> mkpasswd -m sha512crypt <yeah right... nice try>
>
>
> I escaped the character '$' as you can see and cut & pasted it to my recipe file. When I boot the board, I can't login using those credentials (login via ssh). I then login via the root account and here is what I find in the "/etc/shadow" file:
>
> newguy:/p7fbE2SftFy4bvPd.ZsHVS55.:15069:0:99999:7:::
>
>
> Now I presume the actual hash is the part that I've underlined and I guess the rest is the SALT(?). Is there some other thing I have to do to the hash to make it usable by the login application?
>
> Thanks in advance for any advice.
>
> Cheers!!
>
>
>
> -=-=-=-=-=-=-=-=-=-=-=-
> Links: You receive all messages sent to this group.
> View/Reply Online (#13548): https://lists.yoctoproject.org/g/poky/message/13548
> Mute This Topic: https://lists.yoctoproject.org/mt/111460955/1997914
> Group Owner: [email protected]
> Unsubscribe: https://lists.yoctoproject.org/g/poky/unsub [[email protected]]
> -=-=-=-=-=-=-=-=-=-=-=-
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.