If you’ve lost access to your Nginx Proxy Manager admin account and cannot reset the password through the usual interface, you can directly update the password in the database. Here’s a step-by-step guide to help you regain access.
Step 1: Access the SQLite Database
Nginx Proxy Manager stores its user and authentication data in a SQLite database. To begin:
- Open a terminal and locate the SQLite database file. By default, it’s in the
/data
directory. - Access the database using the SQLite CLI:
sqlite3 /data/database.sqlite
Step 2: Locate the User ID
- Check the
user
table to identify the admin account and note theid
of the admin account you want to reset. This will be used in the next steps.
SELECT * FROM user WHERE roles LIKE '%admin%';
Step 3: Inspect the auth Table
Passwords in Nginx Proxy Manager are stored in the auth
table under the secret
column. First, inspect the table to understand its structure:
PRAGMA table_info(auth);
Key columns:
user_id
: Links the authentication entry to the user.secret
: Likely stores the hashed password.
Query the auth
table for the specific user:
SELECT * FROM auth WHERE user_id=<user_id>;
Replace <user_id>
with the id
you retrieved earlier.
Step 4: Generate a New Password Hash
Passwords in Nginx Proxy Manager are hashed using bcrypt. You’ll need to generate a new hash for the replacement password:
- Use Python to create the bcrypt hash: Replace
newpassword
with your desired password. - Copy the output, which will look something like:
$2b$10$examplehashedpassword...
python3 -c "import bcrypt; print(bcrypt.hashpw(b'newpassword', bcrypt.gensalt()).decode())"
Step 5: Update the Password
Update the auth
table with the new password hash:
UPDATE auth SET secret='$2b$10$examplehashedpassword...' WHERE user_id=<user_id>;
Replace:
$2b$10$examplehashedpassword...
with the hash you generated.<user_id>
with the user’s ID.
Verify the update:
SELECT * FROM auth WHERE user_id=<user_id>;
Step 6: Restart Nginx Proxy Manager
After updating the database, restart the Docker container to apply the changes:
docker restart <container_name>
Replace <container_name>
with the name of your Nginx Proxy Manager container.
Step 7: Log In with the New Password
You should now be able to log in to your Nginx Proxy Manager admin account using the new password you set.