Howto reset login and password of main UI

Login and password do not work no more for the main UI of openhab. I need to reset them.

Searching on the web openhab main UI password and login reset, there is some propositions:
https://github.com/openhab/openhab-webui/issues/332#issuecomment-694259506
…a reminder on how you can change your password from the Karaf console. This involves deleting and re-creating your user in JAAS… … (your password will be masked with # characters while you’re typing it)
:

openhab> jaas:realm-manage --realm openhab
openhab> jaas:user-delete <your-user-id>
openhab> jaas:user-add <your-user-id> ####
openhab> jaas:role-add <your-user-id> administrator
openhab> jaas:update

Karaf console defaults
https://www.openhab.org/docs/administration/console.html
username:openhab
password:habopen

To reach the console using SSH

ssh -p 8101 openhab@localhost

Any suggestion will be appreciated

Also any tokens are stored in users.json, so make sure you make a backup first.

I am on open 5 milestone 2, openhab docker installation on linux ubuntu.

I imagine that it should work on there too, is not?

Thanks.

Of course.

fl@Satellite-Z930:~/openhab/userdata/jsondb/backup$ ls
1745437633443--uicomponents_ui_page.json                       1747101371490--users.json
1745610911164--org.openhab.marketplace.json                    1747102723679--org.openhab.core.thing.Thing.json
1745680770442--org.openhab.marketplace.json                    1747102838954--users.json
1745777703950--org.openhab.core.transform.Transformation.json  1747104045156--users.json
1745777707672--org.openhab.core.transform.Transformation.json  1747107466076--users.json
1745860565584--thing_status_storage.json                       1747133958946--org.openhab.core.thing.Thing.json
1745860566653--thing_status_storage.json                       1747448031867--org.openhab.core.config.discovery.DiscoveryResult.json
1746801967337--org.openhab.core.thing.Thing.json               1747463104688--org.openhab.core.config.discovery.DiscoveryResult.json
1747068486327--org.openhab.core.thing.Thing.json               1747484382577--org.openhab.core.config.discovery.DiscoveryResult.json
1747099317636--users.json                                      1747487020967--org.openhab.core.config.discovery.DiscoveryResult.json
1747101339929--org.openhab.core.thing.Thing.json               1747505379973--org.openhab.core.config.discovery.DiscoveryResult.json
fl@Satellite-Z930:~/openhab/userdata/jsondb/backup$

I removed the only file related to users.json

Thanks

sihui solution works perfectly. : )

1 Like

Kudos goes to @ysc

1 Like