Console Password Hash Type?

Hi,
[Update] Figured out, openHAB encrypts the password while rebooting. So this works fine. And yes, it is written in the docs but as it is at the end I did not read it… sorry :blush:

Check this chapter about changing the password. By default the password “habopen” is printed there encrypted and marked by {CRYPT}. The documentation to change the password only shows how to replace the default password with an unencrypted one (including the sed command)…

I do not want to write an unencrypted password here. But the crypting algorithms I tried all print a different password than I see currently.

root@openhab:/var/lib/openhab2/etc# openssl passwd -6  habopen
$6$xHTywKriS1nJc42G$cBiEL98uKhlp6dtIZ2r915RE16Eh3D81tZUTy/szVxr5UiAT81f092W988r6dVwrFE.RTsDSkQS4FMMIGMbRW0
root@openhab:/var/lib/openhab2/etc# openssl passwd -5  habopen
$5$LfIfPzRdJU2H9TLZ$6LgcUG5GvS4C4bhs.beNM4K3.Vl2BXvbi/pwOJErsT1
root@openhab:/var/lib/openhab2/etc# openssl passwd -1  habopen
$1$XG3arHag$5Vindyh4QFOHhuo72SeMr1

So none is the one which is currently stored.

How can I generate an exncrypted password for this file?

Thanks!

/KNEBB

You may want to search the Internet about the Apache Karaf password. That should provide your answers. OH uses Karaf for the console.

instead of this

try

echo -n habopen | sha256sum | tr "[a-z]" "[A-Z]" | cut -d" " -f1

Explanation:
the hash algorithm that is being used is SHA256. tr part of the command translates lowercase to uppercase letters. The cut command extracts just the hash and throws away the remaining part of the output.

1 Like

Yes indeed, your suggesion is correct. Password habopen translates to same hash as default hash specified