How to Reset the Nginx Proxy Manager Password on Docker

Reset Nginx Proxy Manager password - feature image

Sometimes it just happens - you forget a password that earlier that day you used to log in, however resetting your password in Nginx Proxy Manager (NPM) can be a bit tricky.

Let me show you, how in just few easy steps, you can change your password.

#1. Log into the NPM container

Firstly, you should log into docker container that is running on your machine.

docker -exec -it {{container-name or id}} sh

If you can't remember your container name or id, just use docker ps to list all active containers.

#2. Install sqlite3 on running container

As default, NPM stores its data such as user data in local sqlite database. To alter those data we need to have sqlite3 installed.

Once you are in your container terminal run each command in order to install sqlite3 application. We will use it to connect to NPM database and modify user data.

apt update
apt install sqlite3 -y

#3. Open database file and modify users table

Now that we have active installation of sqlite3 in our container, let's reset our login data. To do that, run the following commands:

sqlite3 /data/database.sqlite

UPDATE user SET is_deleted=1;
.exit

exit

#4. Restart the container

After performing that change, now it is time to restart the container. Simply run command

docker restart {{container-name or id}}

#5. Log in to NPM and change password

Time to set up new password!

Go to your NPM and when prompted provide the same credentials as in the initial setup, which are:

login: [email protected] and password: changeme

In the next window, you will be able to set up your email address that was used as the login previously and the new password.

#6. Revert changes made in database file

It's time to do some cleanup. Don't be surprised if you cannot see any previous Proxy Hosts entries. After applying the commands from step #3 again with a minor change (is_deleted=0), we will be able to see all our proxies.

sqlite3 /data/database.sqlite

UPDATE user SET is_deleted=0;
.exit

exit

Note that this time there is no need to restart the container. Just refresh the page in the browser.

Summary

In this short guide I've shown you how easily you can change Nginx Proxy Manager password with just a few steps.

If you found this article helpful, consider buying me a coffee. This helps me continue writing these articles for you!

Buy Me A Coffee

Reference: https://github.com/NginxProxyManager/nginx-proxy-manager/issues/230