Knowledgebase

Question About Servers

How to Change or Reset Your Odoo Admin Password? Print

  • 12

This guide explains how to change your Odoo Admin Password from the graphical interface, as well as using the command line of your Linux server.

 

Odoo Admin Password

This is the password of the user with the ‘Administrator’ privileges. You specified it for your Admin user when you first accessed the Odoo graphical interface after a fresh installation. 

 

In this article, we will be changing the Odoo Admin Password. Click here to learn how to change your Master Password instead. Alternatively, to change your Database Password, follow this link

 

Changing Your Admin Password

If you simply want to change the password to a different one (say, for extra security), then you can do it through the Admin Panel. It’s a simple process, but you have to know the old password.

The second scenario is when you don’t remember your password and can’t log in at all. Because you can’t change the password from the graphical interface, you will need to do it manually - from your Odoo server’s command line.

 

1. Change Your Odoo Admin Password From the Admin Panel

First of all, go to your Odoo Admin Panel and log in. Then, proceed to the ‘Preferences’ menu.

 

In the window that appears, click on the ‘Change password’ button. (On Odoo 14, you need to first switch to the "Account Security" tab)

 

You will see three input fields. Type in your old password, and then provide a new one (twice). Click on ‘Change password’ when you’re done.

 

That’s it. Now your Admin password is changed.

 

2. Change Your Odoo Admin Password From the Command Line

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 straightforward. 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 hashing 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):

source /opt/odoo/odoo13-venv/bin/activate

 

Enter the Python shell:

python3

 

Import the necessary hashing module:

from passlib.context import CryptContext

 

Encrypt the new password using the PBKDF2 SHA512 scheme and show the result:

print(CryptContext(schemes=['pbkdf2_sha512']).encrypt('your_new_password'))

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: 

$pbkdf2-sha512$10001$0dr7v7eWUmptrfW.9z6HkA$w9j9AMVmKAP17OosCqDxDv2hjsvzlLpF8Rra8I7p/b5746rghZ8WrgEjDpvXG5hLz1UeNLzgFa81Dr/bx.2b7hg

Copy (or write down) your unique text string. You will need it later.

 

When you’re done, exit the Python shell.

exit()

 

Deactivate the virtual environment.

deactivate

 

Exit the odoo user:

exit

 

Switch to the postgres Linux user:

sudo su - postgres

 

Connect to the PostgreSQL (Odoo’s database) shell to modify the database.

psql

 

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. 

\l

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:

\c test

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_hashed_password' where login = '[email protected]';

Note: change [email protected] to your actual email value. Change new_hashed_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:

\q

 

Congratulations! You will now be able to log in to your Admin account with the new password. 

 

  

If you are a SolaDrive customer and use one of our Odoo VPS Hosting services, you can simply ask our expert Odoo specialists to change your Admin Password for you. We are available 24/7 via chat or ticket and will take care of your request immediately.


Was this answer helpful?

« Back

Enterprise-Grade Hardware

  • Samsung
  • Juniper
  • Western Digital
  • Supermicro
  • LSI
  • Intel
  • R1Soft Backups
  • cPanel
  • MySQL
  • Parallels
  • HP Partner