How-To Guides
Recover Admin Password

Recover Admin Password

Lost access to your Odoo admin account? This guide shows you how to reset the administrator password using OEC.sh.


Method 1: Using OEC.sh Terminal (Recommended)

The easiest way to reset your admin password is through the built-in terminal.

Open Terminal

  1. Go to Environments in the sidebar
  2. Click on your environment
  3. Click the Terminal button in the header

Connect to Odoo Container

The terminal opens directly in your Odoo container.

Reset Password Using Odoo Shell

Run this command to reset the admin password:

odoo shell -d YOUR_DATABASE_NAME << 'EOF'
env['res.users'].browse(2).write({'password': 'NewPassword123!'})
env.cr.commit()
print("Password reset successfully!")
EOF

Replace:

  • YOUR_DATABASE_NAME with your actual database name
  • NewPassword123! with your desired new password

Verify Access

  1. Go to your Odoo URL
  2. Log in with username admin and your new password
⚠️

Security Note: Choose a strong password with at least 12 characters, including uppercase, lowercase, numbers, and symbols.


Method 2: Using SQL (Direct Database Access)

If the Odoo shell method doesn't work, you can reset the password directly in PostgreSQL.

Open Terminal

Go to Environment → Terminal

Connect to PostgreSQL

psql -U odoo -d YOUR_DATABASE_NAME

Update Password

Odoo stores passwords as hashed values. Set a temporary password:

UPDATE res_users
SET password = 'temp_password_123'
WHERE id = 2;

Exit and Login

\q

Change Password in Odoo

  1. Log in with the temporary password
  2. Go to Settings → Users & Companies → Users
  3. Click on your admin user
  4. Set a new secure password

User ID 2 is typically the admin user created during database initialization. If you're unsure, query SELECT id, login FROM res_users WHERE login = 'admin';


Method 3: Using Odoo Configuration

For Odoo 12.0 and later, you can set an admin password via configuration.

Edit Odoo Configuration

In the terminal, edit the Odoo config:

nano /etc/odoo/odoo.conf

Add Admin Password Line

Add or modify this line:

admin_passwd = your_master_password

Restart Odoo

supervisorctl restart odoo

Access Database Manager

  1. Go to https://your-domain.com/web/database/manager
  2. Use the master password to access database management
  3. From there you can reset user passwords

Finding Your Database Name

If you don't know your database name:

From OEC.sh Dashboard

  1. Go to Environments
  2. Click on your environment
  3. The database name is shown in the Overview tab

From Terminal

psql -U odoo -c "SELECT datname FROM pg_database WHERE datistemplate = false;"

Common Issues

"User not found" Error

The admin user ID might not be 2. Find the correct ID:

SELECT id, login, active FROM res_users ORDER BY id;

"Permission denied" Error

Ensure you're connected as the correct database user:

psql -U odoo -d YOUR_DATABASE_NAME

Password Not Working After Reset

  1. Clear your browser cache and cookies
  2. Try an incognito/private window
  3. Check if 2FA is enabled on the account

Prevention: Best Practices

  1. Use a Password Manager - Store credentials securely
  2. Set Up Multiple Admins - Create backup admin accounts
  3. Document Credentials - Keep secure records of admin access
  4. Enable Password Recovery Email - Configure SMTP so Odoo can send password reset emails

Setting Up Password Recovery Email

To enable the "Forgot Password" feature in Odoo:

  1. Go to Settings → General Settings
  2. Configure Outgoing Mail Servers (SMTP)
  3. Ensure admin user has a valid email address
  4. Users can now use "Reset Password" on login page

With email configured, users can reset their own passwords without admin intervention.


Need Help?

If you're still unable to access your account:

  1. Check Logs - Go to Environment → Logs for error details
  2. Contact Support - Email support@oec.sh with your environment ID