Cannot login after restart KNIME server

So, while I still don’t know how this happened, i found a solution.

I was able to connect to the H2 database and saw that indeed no user was inside the users table.
With the following script I managed to create a user manually via cli:

#!/bin/bash

set -x

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

# tomcat home directory
tomcat_home="/opt/knime/4.15.2.0130/apache-tomcat-9.0.58"

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

# construct db query
read -p 'Username: ' user
read -p 'Password: ' pw

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

echo "insert into users values('$user', '$newpassword');" > $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

The idea is taken from this post: How to reset the knimeadmin password from the CLI - KNIME Server - KNIME Community Forum. However I did update the script to let user pass username and password instead of changing password of existing user.

Just wanted to share that :wink:

3 Likes