[GH-ISSUE #3081] There is no way to reset password in docker version #2065

Closed
opened 2026-10-31 20:22:58 +07:00 by bsakaguchi · 4 comments
Owner

Originally created by @vgdh on GitHub (Jun 9, 2025).
Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3081

Describe the bug

in previous versions you can do that:

# install sqlite3
apt update -y && apt install -y sqlite3
# open it
sqlite3 ./x-ui.db
select * from users;

But in vesion v2.6.0 this method doesnt work, panel doesn't accept this password.
And x-ui tool inside the container does't work at all (throws error on each menu command)

How to repeat the problem?

Use docker version of the app. Try to reset the password.

Expected action

Reset the password

Received action

Erorrs

3x-ui Version

2.6

Xray-core Version

25.5.16

Checklist

  • This bug report is written entirely in English.
  • This bug report is new and no one has reported it before me.
Originally created by @vgdh on GitHub (Jun 9, 2025). Original GitHub issue: https://github.com/MHSanaei/3x-ui/issues/3081 ### Describe the bug in previous versions you can do that: ``` # install sqlite3 apt update -y && apt install -y sqlite3 # open it sqlite3 ./x-ui.db select * from users; ``` But in vesion v2.6.0 this method doesnt work, panel doesn't accept this password. And `x-ui` tool inside the container does't work at all (throws error on each menu command) ### How to repeat the problem? Use docker version of the app. Try to reset the password. ### Expected action Reset the password ### Received action Erorrs ### 3x-ui Version 2.6 ### Xray-core Version 25.5.16 ### Checklist - [x] This bug report is written entirely in English. - [x] This bug report is new and no one has reported it before me.
bsakaguchi 2026-10-31 20:22:58 +07:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@vkorobov commented on GitHub (Jun 10, 2025):

Starting from version 2.6, 3x-ui uses bcrypt hashed passwords instead of storing them in plain text.
More details in issue #2944.

If you need to manually reset the admin password, follow these steps:

  1. Generate a bcrypt hash for your new password. For example:
htpasswd -bnBC 10 "" newpassword | tr -d ':\n'
  1. Open the x-ui.db SQLite database and update the password:
sqlite3 ./db/x-ui.db
  1. Then run the following SQL command (replace newhashpassword with the generated hash):
UPDATE users
SET username = 'admin',
    password = 'newhashpassword'
WHERE id = 1;
.quit

If the user record was modified or deleted, verify that id = 1 refers to the correct user.

<!-- gh-comment-id:2958952910 --> @vkorobov commented on GitHub (Jun 10, 2025): Starting from version 2.6, [3x-ui](https://github.com/MHSanaei/3x-ui) uses bcrypt hashed passwords instead of storing them in plain text. More details in issue [#2944](https://github.com/MHSanaei/3x-ui/issues/2944). If you need to manually reset the admin password, follow these steps: 1. Generate a bcrypt hash for your new password. For example: ```shell htpasswd -bnBC 10 "" newpassword | tr -d ':\n' ``` 2. Open the x-ui.db SQLite database and update the password: ```shell sqlite3 ./db/x-ui.db ``` 3. Then run the following SQL command (replace newhashpassword with the generated hash): ```sql UPDATE users SET username = 'admin', password = 'newhashpassword' WHERE id = 1; .quit ``` If the user record was modified or deleted, verify that id = 1 refers to the correct user.
Author
Owner

@obervinov commented on GitHub (Jul 10, 2025):

Starting from version 2.6, 3x-ui uses bcrypt hashed passwords instead of storing them in plain text. More details in issue #2944.

If you need to manually reset the admin password, follow these steps:

  1. Generate a bcrypt hash for your new password. For example:

htpasswd -bnBC 10 "" newpassword | tr -d ':\n'
2. Open the x-ui.db SQLite database and update the password:

sqlite3 ./db/x-ui.db
3. Then run the following SQL command (replace newhashpassword with the generated hash):

UPDATE users
SET username = 'admin',
password = 'newhashpassword'
WHERE id = 1;
.quit
If the user record was modified or deleted, verify that id = 1 refers to the correct user.

It's not working for me Invalid username or password or two-factor code.
Also, the same behavior when I change my password in the admin panel.
It seems like the password hash that is written to the database doesn't match the password hash generated from the input.

<!-- gh-comment-id:3055713452 --> @obervinov commented on GitHub (Jul 10, 2025): > Starting from version 2.6, [3x-ui](https://github.com/MHSanaei/3x-ui) uses bcrypt hashed passwords instead of storing them in plain text. More details in issue [#2944](https://github.com/MHSanaei/3x-ui/issues/2944). > > If you need to manually reset the admin password, follow these steps: > > 1. Generate a bcrypt hash for your new password. For example: > > htpasswd -bnBC 10 "" newpassword | tr -d ':\n' > 2. Open the x-ui.db SQLite database and update the password: > > sqlite3 ./db/x-ui.db > 3. Then run the following SQL command (replace newhashpassword with the generated hash): > > UPDATE users > SET username = 'admin', > password = 'newhashpassword' > WHERE id = 1; > .quit > If the user record was modified or deleted, verify that id = 1 refers to the correct user. It's not working for me `Invalid username or password or two-factor code.` Also, the same behavior when I change my password in the admin panel. It seems like the password hash that is written to the database doesn't match the password hash generated from the input.
Author
Owner

@vgdh commented on GitHub (Jul 10, 2025):

@obervinov Thy this for hash generation.

# Prepare environment
sudo apt install python3.8-venv
python3.8 -m venv .venv      
source .venv/bin/activate
pip install bcrypt
# generate hash
python3 -c "import bcrypt; print(bcrypt.hashpw(b'NewPassword', bcrypt.gensalt(rounds=10)).decode())"
<!-- gh-comment-id:3056036762 --> @vgdh commented on GitHub (Jul 10, 2025): @obervinov Thy this for hash generation. ``` # Prepare environment sudo apt install python3.8-venv python3.8 -m venv .venv source .venv/bin/activate pip install bcrypt # generate hash python3 -c "import bcrypt; print(bcrypt.hashpw(b'NewPassword', bcrypt.gensalt(rounds=10)).decode())" ```
Author
Owner

@obervinov commented on GitHub (Jul 10, 2025):

@vgdh thanks! It's working for me.
I had the conflict between internal x-ui.db file in the docker container and the file mounted from the host OS path through the docker volumes. As a result, I ended up with two different DB files with different data. I'm not sure when it happened, but it seems to be an issue specific to my environment.

<!-- gh-comment-id:3056545806 --> @obervinov commented on GitHub (Jul 10, 2025): @vgdh thanks! It's working for me. I had the conflict between internal `x-ui.db` file in the docker container and the file mounted from the host OS path through the docker volumes. As a result, I ended up with two different DB files with different data. I'm not sure when it happened, but it seems to be an issue specific to my environment.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
MHSanaei/3x-ui#2065
No description provided.