Web Admin Password Reset
Overview
On first launch, you create a web admin user in the web admin portal. If you forget these credentials, you will need to reset them via the command line.
This article goes over how to reset your web admin credentials in SFTP Gateway. This involves deleting all web admin users in the database. This re-triggers the first-launch experience, where you can create a new web admin user.
Delete all web admin users in the database
Step 1. SSH into the VM, and elevate your privileges to root:
sudo su
Step 2. Change directories to /usr/local/bin/
:
cd /usr/local/bin/
Step 3. Run the script to remove all web admin users:
./clear-admin-users.sh
If all goes well, you should see the word COMMIT
.
Step 4. Refresh your browser, and the web admin portal should take you back to the first launch screen where you can create a new admin user.
Script contents
For reference, here are the contents of the clear-admin-users.sh
script:
#!/bin/bash
sudo -u postgres psql -d sftpgw -c "BEGIN; \
DELETE \
FROM authorities \
WHERE user_id IN (select id from users where user_type = 'ADMIN'); \
DELETE FROM users \
WHERE user_type = 'ADMIN'; \
END;"
echo "Admins have been cleared. Visit the admin web interface in your browser to create a new admin."
This runs a postgres command that deletes all admin users.