Karaf Console - not possible to set password of user openhab

  • Platform information:
    • Hardware: Raspberry 3b
    • OS: Linux openHABianPi 4.19.66-v7+ #1253
    • openHAB version: 3.0
    • openHABian configuration tool version: [stable]v1.6.1-1021(01d4e59)

after I updated to openHAB 3.0 and the LogViewer is gone I am looking for an elegant way to get logging information.
But first of all a big praise to the maintainers. The release is incredible and the update worked smoothly. Good job :slight_smile:

My idea was to use VS-Code to connect to the Karaf-Console to see the logs. After doing the steps as described in “Bind Console to All Interfaces” (The Console | openHAB), I wanted to change the password of the user “openhab”. The described steps “Changing the Password” (The Console | openHAB) do not seem to work for me. I can still login with the default password “habopen”.
I have already tried the following variants:

  • Changing the password via the script sudo sed -i -e "s/openhab = .*,/openhab = securePassword,/g" /var/lib/openhab2/etc/users.properties
  • Manually changing the password with VI
    • manual changing with a plaintext password
    • manual changing with an encrypted password between {CRYPT} with echo -n SecurePassword | sha256sum
  • changing the password using the OpenHABian configuration tool - menu 30 (System settings) --> menu 34 (Change passwords) --> menu 2 (openHAB Console)

All of the above attempts resulted in me not being able to log in with my new password but still with the old password. The hash in /var/lib/openhab2/etc/users.properties is not regenerated after reboot and login.

What am I doing wrong? Can someone help me?

It’s not gone. There are a bunch of threads about it. Depending on how you updated it might be looking for the log files in the wrong place. LogViewer has always been a separate program completely separate from OH.

Apparently that’s one of the many places I expect that didn’t get updated in the docs. openHAB moved. It’s now /var/lib/openhab/etc/users.properties.

Without seeing exactly what you did in your other steps probably not. About all I can offer with the information provided is make sure you are editing the right file in the right folder.

Beyond that you’ll need to most far more details on what you’ve done.

Thank you for your reply. Regarding the LogViewer I’ll take a look at the threads.

I used the path suggested by you for setting the password. And lo and behold I can no longer log in with the old password. Now I have the problem that I can not log in even with the new password. Although I have restarted the system several times.
My password consists of 20 characters without numbers and special characters.
The /var/lib/openhab/etc/users.properties file now looks like this:

openhab = MyPassword,_g_:admingroup
_g_\:admingroup = group,admin,manager,viewer,systembundles

It looks like the password is not encrypted automatically.

When I try to log in I always get the following message

[11:08:23] openhabian@openHABianPi:~$ sudo openhab-cli console
[sudo] Passwort für openhabian:

Logging in as openhab
No more authentication methods available

Do I need to change anything else? Doesn’t the password of the “openhab” user have to be changed to in the operating system? What details do you need to help me?

I solved the problem. It seems that the hash is no longer automatically regenerated.
If I hash the password beforehand with ‘echo -n SecurePassword | sha256sum’ and pass the output value inside the {CRYPT} tag at the command it works.

Example with Password “Christmas”:

echo -n Christmas | sha256sum
a09948e8f60826341f088092969bdc3cef5820892945890434f80d3a92f8da4b  -
sed -i -e "s/openhab = .*,/openhab = {CRYPT}a09948e8f60826341f088092969bdc3cef5820892945890434f80d3a92f8da4b{CRYPT},/g" /var/lib/openhab/etc/users.properties