How to reset password for web GUI
Hi,
I forgot my password of Web GUI but i can connect container. How can i reset password/username?
Here's an obscure way to do this:
- Connect to the database
- Run:
UPDATE user SET is_deleted=1; - Restart nginx proxy manager, this will create a new Admin user with the following credentials:
- [email protected]
- Password:
changeme
- Run:
UPDATE user SET is_deleted=0; - Log in as the new user and reset your other user's password
- Log in as your main user, delete the new example user
If you are inexperienced with docker and MySQL, this comment provides more detailed instructions on how to perform these steps.
Thank you! It is done
Paid a friend to set this up via Hyper-V Manager VM. Been working for months. Had to restore my OS to previous image. After re-image no reverse proxies setup on this server work from the 3 day old image(502 bad gateway error given).
All reverse proxies setup on other server on the network work fine. On top of that I somehow have wrong web login password saved to Dashlane and can't access GUI. How do I reset my password?? Once I can login I can try to troubleshoot the "502 Bad Gateway" more for the half of them that don't load...
I think the docker logs for nginx proxy manager might be helpful, if you've lost access to your previous account then the restored image might not be using a pre-existing database and created a new one. It's a hard one to debug through just these comments.
You can follow the steps above to reset your password, assuming the default [email protected]:changeme doesn't work.
I assume you'd need to access your VM and connect to the database from there. As we don't know what your friend did to set up the vm we can't help, and supporting docker hosts is not in our scope.
Here's an obscure way to do this:
- Connect to the database
- Run:
UPDATE user SET is_deleted=1;- Restart nginx proxy manager, this will create a new Admin user with the following credentials:
- [email protected]
- Password:
changeme
- Run:
UPDATE user SET is_deleted=0;- Log in as the new user and reset your other user's password
- Log in as your main user, delete the new example user
Im running your docker-compose.yaml way, but how do i access the mariadb from cli to reset the default user again?
I try to run:
sudo docker exec -it 5dd2bb6cb8cc bash
But the get:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown
Im running your docker-compose.yaml way, but how do i access the mariadb from cli to reset the default user again?
I try to run:
sudo docker exec -it 5dd2bb6cb8cc bashBut the get:
OCI runtime exec failed: exec failed: container_linux.go:349: starting container process caused "exec: \"bash\": executable file not found in $PATH": unknown
1: the error says it doesn't find bash (some containers only have 'sh' or 'ash') Note: I looked trough his DockerFile for his mariaDB and it uses alpine so 'sh' or 'ash'.
sudo docker exec -it [id or name] sh
2: you also can login to mysql directly using :
sudo docker exec -it [id or name] mysql -u [username] -p'
For me works that: sudo docker exec -it [database container id or name] sh mysql connect npm UPDATE user SET is_deleted=1; sudo docker restart [nmp container id or name] (start second ssh connection to do that) UPDATE user SET is_deleted=0; Login with: Login: [email protected] Password: changeme
Should this be added to the docs as an alternative method for resetting an account password? This just prevented me from being locked out, where the instructions currently linked on the npm website did not work.
I'm unable to connect to the MySQL Database. Whenever I run the set of commands described above by @PCbIX, it just says "Command not Found" when I attempt to run "mysql".
Edit: I figured it out, but now I have a new problem, when I attempt to execute UPDATE user SET is_deleted=1;, It outputs ERROR 1046 (3D000): No database selected.
2. UPDATE user SET is_deleted=1;
Hello, could you be more specific?
docker exec -it nginxproxymanager_db_1 sh
mysql -u npm
MariaDB [(none)]> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
+--------------------+
1 row in set (0.002 sec)
MariaDB [(none)]> UPDATE user SET is_deleted=1;
ERROR 1046 (3D000): No database selected
USE information_schema
My DB: DB_MYSQL_NAME: "npm"
something is wrong, the npm bank was supposed to appear, right?
I have the password saved on google, and I went to connect said it is invalid, I did not change the password.
Hey i have same problem. do you find a solution plz ?
It seems that some people do not have the patience to explain or assume that everyone already knows how to do it, but in the end I found out and documented it.
Step 1
Run these commands on the machine running the docker container containing the database:
docker exec -it nginxproxymanager_db_1 sh
mysql -u root -p
You will have to enter the root password of your database. You have set it in your docker-compose file through the MYSQL_ROOT_PASSWORD variable. Then continue entering the following commands:
USE npm;
UPDATE user SET is_deleted=1;
quit
exit
Step 2
If your NPM container has been running, restart it. If it has not been running, start it now.
Step 3
Access your NPM in the browser and log in with this data:
login: [email protected]
pass: changeme
Step 4
You have now created an admin user you can login with. You can now either just use this user, or you can re-enable the old account and use the new account to change the password of the old one. To re-enable it, once again execute the following commands:
docker exec -it nginxproxymanager_db_1 sh
mysql -u root -p
Enter the root password again, as in step 1.
USE npm;
UPDATE user SET is_deleted=0;
quit
exit
thnaks bro you save my day
I improved it to make it easier to understand ;-)
Hi. Sorry, I forgot to respond to this. I just decided to uninstall and reinstall it because I thought my install was broken. (turns out I was just doing something wrong.) Thanks for the help though. I'll be sure to keep this in mind for when I will inevitably forget my password again lol.
Hi,
I followed the instructions, however after setting is_deleted back to is_deleted=0 and restarting the containers, I wasn't able to login because of an incorrect password. How can I fix this?
EDIT: after the 4th try its working now
Today I had to do it again....
For those not wanting a new admin account, but instead to just set the password of a specific account you can do the following:
Connect to the database as before and go into the table named
authand update thesecretcolumn where theuser_idis the user id you want. (You can see the users in theuserstable, and see the id associated with an email address.Change the secret to
$2b$13$C9mJYK7Gf7sVgCCYw84HhOvOIpnyhkdGqwIp0PPj/s9.q0bxkoMZeThis will result in the password being
changeme.
For those who are not able to log in with your new password after logging out, maybe you are experiencing issue https://github.com/jc21/nginx-proxy-manager/issues/1120. Change your password to a password which does not contain a #-symbol until this is fixed.
If you are using the jlesage image (jlesage/nginx-proxy-manager) and not the official docker image, you can also do it like this:
Get into the container:
docker exec -it nginx-proxy-manager sh
And now use the dedicarted program to reset it:
/opt/nginx-proxy-manager/bin/reset-password [email protected] newpassword
Maybe this is a new feature at the time of writing this, idk. Hope it helps to the other people searching for this issue. I found this program of pure luck while browsing the container in search of MySQL since it wasn't in the path.
Following up on this. My account was deleted out of no where and the default came back. Weird thing is all data is now missing no proxies, redirects, anything but the logs are still reporting proxy requests working and are still trying to update my expired ssl certificates. Any idea?
@rourke750 This has nothing to do with resetting the password. It sounds like somehow your database was wiped, so the only data left is the generated nginx config files. That is why the hosts keep working and the ssl certificates as well, but npms knowlege about these hosts and certificates has been deleted.
/opt/nginx-proxy-manager/bin/reset-password [email protected] newpassword
I am getting following error white entering above command..
sh: 1: /opt/nginx-proxy-manager/bin/reset-password: not found
@itsKV then you don't have the jlesage image, but the official one. Reset it like described in this comment instead.
For me works that: sudo docker exec -it [database container id or name] sh mysql connect npm UPDATE user SET is_deleted=1; sudo docker restart [nmp container id or name] (start second ssh connection to do that) UPDATE user SET is_deleted=0; Login with: Login: [email protected] Password: changeme
In the step 1, for second command mysql is giving error sh: 1: mysql: not found as I am not using mysql. My setup's docker-compose is as follows...
version: "3" services: app: image: 'jc21/nginx-proxy-manager:latest' restart: unless-stopped ports: # These ports are in format
: - '80:80' # Public HTTP Port - '443:443' # Public HTTPS Port - '81:81' # Admin Web Port # Add any other Stream port you want to expose # - '21:21' # FTP # Uncomment the next line if you uncomment anything in the section # environment: # Uncomment this if you want to change the location of # the SQLite DB file within the container # DB_SQLITE_FILE: "/data/database.sqlite" # Uncomment this if IPv6 is not enabled on your host # DISABLE_IPV6: 'true' volumes: - ./data:/data - ./letsencrypt:/etc/letsencrypt
How can I reset the web ui password?
See https://github.com/jc21/nginx-proxy-manager/discussions/1634
See #1634
This worked like a charm.. 👍
I had to do this also and in case you do not find the password for the db and run portainer, just click the container for the nginx database (in my case it is nginx_d) and you will find the login information including the db password. when you connected to the db you can also run SELECT * FROM user; and it will reveal the username. here are my steps: sudo docker exec -it nginx_db_1 sh mysql -u root -p enter the db password USE npm; show tables; SELECT * FROM user; you will see the username and the e-mail address. this might be enough to trigger your memory for what password you have set. If not you can continue with the steps,
UPDATE user SET is_disabled=1; quit exit
restart the nginx db AND the nginx app
login with the [email protected] and changeme password. change the username information and the password
and run
sudo docker exec -it nginx_db_1 sh mysql -u root -p enter the db password USE npm; UPDATE user SET is_disabled=0; quit exit
If you are using the jlesage image (
jlesage/nginx-proxy-manager) and not the official docker image, you can also do it like this: Get into the container:docker exec -it nginx-proxy-manager shAnd now use the dedicarted program to reset it:/opt/nginx-proxy-manager/bin/reset-password [email protected] newpasswordMaybe this is a new feature at the time of writing this, idk. Hope it helps to the other people searching for this issue. I found this program of pure luck while browsing the container in search of MySQL since it wasn't in the path.
this works with Docker' Thanks
Referring to this https://github.com/NginxProxyManager/nginx-proxy-manager/issues/230#issuecomment-550565639 my password reset flow looked like this today:
sudo docker ps-> searchmariadband take container idsudo docker exec -it <container-id> shmysql -u root -puse nginxproxymanager;(this step is missing everywhere, you should use a table)UPDATE user SET is_deleted=1;- restart Nginx click on the button through addons UI or restart the container
- login with default creds:
[email protected] / changeme - In MySQL terminal:
UPDATE user SET is_deleted=0;