Unable to change karaf console login password

  • Platform information:
    • Hardware: R-Pi2
    • OS: Rasperian 8
    • Java Runtime Environment: Oracle Java 8 build 151
    • openHAB version: 2.2.0-1
  • Issue of the topic: Unable to change karat console password and login
  1. Stop the openhab server
  2. Edit /var/lib/openhab2/etc/users.properties
  3. Replace openhab={CRYPT} etc with openhab=SecurePassword
  4. Restart openhab server

After waiting for the start, I connect to the console via

ssh -p 8101 openhab@localhost

But the password isn’t accepted…

root@piman-202:/var/lib/openhab2/etc#  ssh -p 8101 openhab@localhost
Password authentication
Password: 
Password authentication
Password: 
Password authentication
Password: 
openhab@localhost's password: 
Permission denied, please try again.
openhab@localhost's password: 
Permission denied, please try again.
openhab@localhost's password: 
Permission denied (keyboard-interactive,password,publickey).
root@piman-202:/var/lib/openhab2/etc#

I can’t see anywhere that the procedure has changed. Karaf appears to be updating the file and replacing the clear-text password with the hashed one… And the crypt matches the password ‘SecurePassword’

root@piman-202:/var/lib/openhab2/etc# cat users.properties 
openhab = {CRYPT}c89bbbf01fa7840fdbf194a621ef899258e9210d6c77b6f033b6ebfa15f7230d{CRYPT},
root@piman-202:/var/lib/openhab2/etc# 

Not sure what I’m doing wrong here…

Please change the line exactly to

openhab = yourpassword,_g_:admingroup

where yourpassword is your password

No change…

root@piman-202:/var/lib/openhab2/etc# cat users.properties
openhab = {CRYPT}78635493C01FAD877DAE26F1CE681CFAFABE0C9F27950D1EDE6C9D55B616A5D2{CRYPT},_g_:admingroup
root@piman-202:/var/lib/openhab2/etc# vi users.properties
root@piman-202:/var/lib/openhab2/etc#  ssh -p 8101 openhab@localhost
Password authentication
Password:
Password authentication
Password:
Password authentication
Password:
openhab@localhost's password:
Permission denied, please try again.
openhab@localhost's password:

Err… but you didn’t kill the rest of this file, did you? The complete file users.properties should be

################################################################################
#
#    Licensed to the Apache Software Foundation (ASF) under one or more
#    contributor license agreements.  See the NOTICE file distributed with
#    this work for additional information regarding copyright ownership.
#    The ASF licenses this file to You under the Apache License, Version 2.0
#    (the "License"); you may not use this file except in compliance with
#    the License.  You may obtain a copy of the License at
#
#       http://www.apache.org/licenses/LICENSE-2.0
#
#    Unless required by applicable law or agreed to in writing, software
#    distributed under the License is distributed on an "AS IS" BASIS,
#    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#    See the License for the specific language governing permissions and
#    limitations under the License.
#
################################################################################

#
# This file contains the users, groups, and roles.
# Each line has to be of the format:
#
# USER=PASSWORD,ROLE1,ROLE2,...
# USER=PASSWORD,_g_:GROUP,...
# _g_\:GROUP=ROLE1,ROLE2,...
#
# All users, groups, and roles entered in this file are available after Karaf startup
# and modifiable via the JAAS command group. These users reside in a JAAS domain
# with the name "karaf".
#
openhab = {CRYPT}78635493C01FAD877DAE26F1CE681CFAFABE0C9F27950D1EDE6C9D55B616A5D2CRYPT},_g_:admingroup
_g_\:admingroup = group,admin,manager,viewer,systembundles

where openHAB itself will encrypt the password when it was changed to another (not yet encrypted) password.

Originally there was no users.properties file (I think that was when I was using 2.1.0-2). I simply added the file with the entry documented in the openHab docs.

Note that with 2.1.0-1 it was working with just

openhab = {CRYPT}shar256sum{CRYPT}

I haven’t needed console since then, until trying to debug all the issues I have with 2.2.0-1…

I’ll that that complete entry you show.

H

Thanks @Udo_Hartmann. That second line did the trick.

I don’t know what part of the system should have been responsible for creating the users.properties, but perhaps the rest of it could be documented somewhere?

Now on to try & get the zWave debugging working…