Thorn Tech Marketing Ad
Skip to main content
Version: Next

Web Admin Password Reset

TLDR

Purpose: Create a new admin user from the command line when you've forgotten the admin UI credentials

Requirements: SSH access to the StorageLink VM (port 22) and root privileges

Quick Steps:

  1. SSH into the VM and run sudo su
  2. Download: wget https://thorntech-products.s3.amazonaws.com/storagelink/create-admin-user-script/New-Admin-Storagelink.sh
  3. Make it executable: chmod +x New-Admin-Storagelink.sh
  4. Run: ./New-Admin-Storagelink.sh -u <username> -p <password>

Result: The script prints the new account's details as JSON; refresh the browser and sign in with the new credentials

Product: StorageLink by Thorn Technologies — cloud storage gateway for secure file sharing

Overview​

On first launch, you will configure a username and password for a Web Admin user in order to sign into the Web Interface. If you forget these credentials, you will need to create a new Web Admin.

This article goes over how to create a new Web Admin in StorageLink via the command line.

Create a new Web Admin user​

Step 1. SSH into the VM on port 22, and elevate your privileges to root:

sudo su

Step 2. Download the New-Admin-Storagelink.sh script onto your machine:

wget https://thorntech-products.s3.amazonaws.com/storagelink/create-admin-user-script/New-Admin-Storagelink.sh

Step 3. Give the script execute permissions:

chmod +x New-Admin-Storagelink.sh

Step 4. Run the script (-u is for username, -p is for password):

./New-Admin-Storagelink.sh -u My-Admin -p MyPass678910$

If the script completes successfully you'll see a large output of JSON starting with "createdDate", which contains the details of your new Web Admin account.

Step 5. Refresh your browser, and on the Sign In page, you can sign in with your newly created Web Admin credentials.

Script contents​

For reference, here are the contents of the New-Admin-Storagelink.sh script:

#!/bin/bash

while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-u|--username)
USERNAME="$2"
shift
shift
;;
-p|--password)
PASSWORD="$2"
shift
shift
;;
*)
break
;;
esac
done

sudo -u postgres psql -d swiftgw -c "BEGIN; \
UPDATE authorities SET authority = 'ROLE_ADMIN_TEMP' WHERE authority = 'ROLE_ADMIN'; \
END;" >/dev/null

JSON='{"username":"'"$USERNAME"'","password":"'"$PASSWORD"'"}'

curl --silent --insecure --location --request POST 'http://127.0.0.1:8080/1.0.0/admin/config' --header 'Content-Type: application/json' --data-raw $JSON

sudo -u postgres psql -d swiftgw -c "BEGIN; \
UPDATE authorities SET authority = 'ROLE_ADMIN' WHERE authority = 'ROLE_ADMIN_TEMP'; \
END;" >/dev/null