Skip to contentSkip to conversation

How to set the password Hashing Algorithm for root user to SHA256 or SHA512

OE-core Khem Raj 2 participants 2 messages Dec 20, 2020 – Dec 21, 2020 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Khem Raj

author
#1 lore raw
Quoted 10 lines · Sourabh Banerjee

[Edited Message Follows]

The image I generated seems to use MD5 for root password hashing.
I understood this from the /etc/shadow file in the image., the file has following line:

    root:$1$b7X30f8f$au21weqL.9.ExM4N84AtA0:18614:0:99999:7:::

Is there an OE config I can change to change password hashing from MD5 to SHA256?

somewhere you must be setting the password something like this in local.conf

EXTRA_USERS_PARAMS += "\
    useradd admin; \
    usermod -p 'XXXXXX' admin; \

"

Now how you generate the password could be done separately via

something like ( for setting password to me 'test' )

python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA256)))'

Replace XXXXXX with the output of the above cmd

aside from this its perhaps better to use sha512 than sha256

Quoted 8 lines

I am using Thud version.

--
Regards,
Sourabh

#2 lore raw
Quoted 22 lines · Khem Raj
Quoted 10 lines · Sourabh Banerjee

[Edited Message Follows]

The image I generated seems to use MD5 for root password hashing.
I understood this from the /etc/shadow file in the image., the file has following line:

    root:$1$b7X30f8f$au21weqL.9.ExM4N84AtA0:18614:0:99999:7:::

Is there an OE config I can change to change password hashing from MD5 to SHA256?

somewhere you must be setting the password something like this in local.conf

EXTRA_USERS_PARAMS += "\
    useradd admin; \
    usermod -p 'XXXXXX' admin; \

"

Now how you generate the password could be done separately via

Quoted 17 lines

something like ( for setting password to me 'test' )

python3 -c 'import crypt; print(crypt.crypt("test", crypt.mksalt(crypt.METHOD_SHA256)))'

Replace XXXXXX with the output of the above cmd

aside from this its perhaps better to use sha512 than sha256

Quoted 8 lines

I am using Thud version.

--
Regards,
Sourabh

Thanks Khem! I will try this and get back.

Signature · 2 lines
Regards,
Sourabh