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

Quentin Schulz <[email protected]>
Newsgroups org.yoctoproject.lists.poky
Message-ID <[email protected]>

On 3/4/25 4:26 PM, Alexander Kanavin via lists.yoctoproject.org wrote:
> You probably need to study the logs for the recipe (in
> ${WORKDIR}/temp) to see what useradd command line actually looks like.
> Possibly something gets mangled?
> 
> You can also experiment with this on the target (e.g add more users
> and see if you can login as them).
> 
> Alex
> 
> On Sat, 1 Mar 2025 at 22:42, 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} \

It's single quoted in the meta-skeleton recipe, so maybe consider doing 
that as well?

>>                          -U newguy \
>>                        "
>>
>> I can't login to the board using the password I created using the command:
>>
>> mkpasswd -m sha512crypt <yeah right... nice try>
>>

We do document how to generate the password in the docs:

printf "%q" $(mkpasswd -m sha256crypt <your-pass>)

With <your-pass> being replaced with the actual string you want to use 
as password.

I don't know if sha512crypt is supported (maybe, but I don't know :) ).

Cheers,
Quentin
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.