How to Change or Reset Your Odoo15 Admin Password?
This blog explains how to change your Odoo Admin Password from the graphical interface, as well as using the command line of your Linux server.
In order to change the password from the command line, you will need to access your Odoo server first. Usually, the way to do that is to use SSH to connect to a remote server.
The process is fairly straight forward. We first need to generate a hashed (i.e. transformed and hard to read) version of the new password, and then change the user’s password value in the database.
Let’s begin by changing the new password. We will do it using the Python programming language in combination with the modules that are used in Odoo.
Once you’re in your server’s terminal, switch the current user to odoo:
sudo su odoo
After that, activate a virtual environment that Odoo is using (basically, we will be able to access the same modules as Odoo):
Enter the Python shell:
Import the necessary hashing module:
from passlib.context import CryptContext
Encrypt the new password using the PBKDF2 SHA512 scheme and show the result:
Note: change your_new_password to whatever you want your new password to be. The value should remain wrapped in single quotation marks.
You should see a long string of text that looks similar to this one:
Copy (or write down) your unique text string. You will need it later.
When you’re done, exit the Python shell.
Exit the odoo user:
Switch to the postgres Linux user:
sudo su - postgres
Connect to the PostgreSQL (Odoo’s database) shell to modify the database.
If you don't remember the name of your Odoo database (you set it when you created your Admin user), use the following command to list all the databases and accociated users.
Search for the odoo user and the associated database name. The latter is the name you need.
Once you know the database name, connect to the Odoo database:
Note: change test to the actual name of your Odoo database.
Now we need to change the password of the Admin user. If you don’t remember the user’s email value (which is used as the login), execute the following command to get a list of all user logins.
select login from res_users;
Find your email in that list.
Finally, change the password value of the Admin user to the newly generated one:
update res_users set password = 'new_password' where login = 'email@example.com';
Note: change firstname.lastname@example.org to your actual email value. Change new__password to that long string of text that you copied/wrote down earlier. Both values should remain wrapped in single quotation marks.
Exit the database:
Congratulations! You will now be able to log in to your Admin account with the new password.
For quick help related to odoo call +91-9170963131 or mail us at email@example.com