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 EC2 instance, and elevate your privileges to root:
Step 2. Change directories to
Step 3. Download the script file:
Step 4. Make the file executable:
chmod +x clear-admin-users.sh
Step 5. Run the script to remove all web admin users:
sudo /bin/su -c "/usr/local/bin/clear-admin-users.sh" - postgres
This bash command runs the downloaded script as the
This script deletes all web admin users (SFTP users are not affected).
If all goes well, you should see the word
Step 6. 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.
For reference, here are the contents of the
#!/bin/bash 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;"
This runs a postgres command that deletes all admin users.