How to reset the knimeadmin password from the CLI

#1

Hi there,

how can I reset the knimeadmin password from the CLI. I cannot use the webinterface because I don’t know the current password. However, I have CLI access to the machine the server runs on.

My auth config is as follows:

<Realm className=“org.apache.catalina.realm.DataSourceRealm” dataSourceName=“H2UserDatabase” roleNameCol=“ROLE_NAME” userCredCol=“USER_PASS” userNameCol=“USER_NAME” userRoleTable=“USER_ROLES” userTable=“USERS”>

<CredentialHandler algorithm=“SHA-256” className=“org.apache.catalina.realm.MessageDigestCredentialHandler”/>

</Realm>

KR Andreas

0 Likes

#2

Hi Andreas,

It’s possible to manually reset the database. Under Linux you can run a script something like. Note that you’ll need to edit the script to reflect the correct locations (and the new password) in your case:

#!/bin/bash

set -x

# Location of this script.
location="/opt"

# tomcat home directory
tomcat_home="/opt/apache-tomee-plus-7.0.3"

# db parameters
dburl="jdbc:h2:$tomcat_home/conf/userconf"

# construct db query
newpassword=enteryournewpasswordhere
newpassword=$($tomcat_home/bin/digest.sh -a sha-256 $newpassword)
newpassword=${newpassword#*:}

echo "update users set user_pass='$newpassword' where user_name='knimeadmin';" > $location/dbscript

chown knime:knime $location/dbscript

# manipulate db
java -cp $tomcat_home/lib/h2*.jar org.h2.tools.RunScript -url $dburl -script $location/dbscript

# delete script file
rm dbscript

exit 0
0 Likes