How to Unlock Magento 2 Admin User Account?

How to Unlock Magento 2 Admin User Account?

Magento 2 admin account can be locked due to many reasons. One such case is when users attempt to log in with the wrong username or lost the Admin password.

Magento website also locks the user account after six failed attempts to log in. The Admin panel gets locked from trying multiple failed requests.

A locked Admin account will be temporarily disabled. Magento will display the following message:

“You did not sign in correctly or your account is temporarily disabled”.

Locked Magento 2 Admin Account

You will not be able to access the account even with the correct login credentials.

After some time, the Magento store will automatically allow log-in for the account. To unlock your account instantly you choose one of the listed methods below.

How to Unlock Magento 2 Admin User Account?

1. Unlock on Admin account

A locked user account appears in the Locked Users grid. An account can be unlocked by another user with full administrator permissions.

This can be followed by the assumption that you’re managing multiple Admin accounts. Follow the steps to unlock your account from Magento 2 Admin page:

Step 1: On the Magento Admin interface, go to System > Permissions > Locked Users Step 2: In the grid, select the checkbox of the locked account. Step 3: In the upper-left corner, set Unlock from the Actions dropdown. Step 4: Click Submit to unlock the account.

Locked Users - Magento 2

2. Unlock using command lines

There is a command available in Magento 2 to unlock Admin backend accounts.

Step 1: Open Magento 2 root directory

Connect to your server through SSH. First login to SSH panel and navigate to Magento 2 setup root.

Windows users can run a command prompt to reach the document root directory.

Step 2: Run command lines

Run the below command to unlock Admin user:

$ bin/magento admin:user:unlock {username}

Note: Specify the username of the locked Admin account.

Example: $ bin/magento admin:user:unlock bob

How to log into Magento? Once the command is implemented it will unlock the account. The User will be able to log in to the Admin account with any error.

The user account "bob" has been unlocked.

If the account is either not unlocked or the process failed, the following message displays:

The user account "bob" was not locked or could not be unlocked.

In such case:

  • Verify the user is a Magento admin.
  • Ensure the user account is active.
  • Verify the account is currently locked in Locked Users.

If the account doesn’t exist, the following message displays:

Couldn't find the user account "bob".

Final Note

Magento lets you strengthen the backend security to prevent unauthorized log-in attacks. You can set the number of login attempts that can be made before the Admin account is locked.

Configure security settings from the Admin account. Go to Magento Admin Panel > System > Configuration

Make the following settings and save the configuration:

  • Maximum Login Failures to Lockout Account: Determines the number of consecutive failed login attempts to lock the account. If you do not want to enable the lockout feature, leave this field blank.

  • Lockout Time (minutes): Determines the duration for which the account will be locked after the failed logins.

Find more insightful Magento tutorials on MGT-Commerce.

Shraddha S.
Shraddha S.
Head of Content

Shraddha Singh has a lot of thoughts about Technology and the Cloud Services Industry. An Indian native and a professional Technical writer, she gets her management skills from IIT-B.

Get the fastest Magento Hosting! Get Started