Web Admin Password Reset
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 SFTP Gateway via the command line.
Create a new Web Admin user
Step 1. SSH into the VM on port 2222
, and elevate your privileges to root:
sudo su
Step 2. Download the New-Admin.sh
script onto your machine:
wget https://thorntech-products.s3.amazonaws.com/sftpgateway/create-admin-user-script/New-Admin.sh
Step 3. Give the script execute permissions:
chmod +x New-Admin.sh
Step 4. Run the script (-u
is for username, -p
is for password):
./New-Admin.sh -u My-Admin -p MyPass678$
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.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 sftpgw -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/3.0.0/admin/config' --header 'Content-Type: application/json' --data-raw $JSON
sudo -u postgres psql -d sftpgw -c "BEGIN; \
UPDATE authorities SET authority = 'ROLE_ADMIN' WHERE authority = 'ROLE_ADMIN_TEMP'; \
END;" >/dev/null