How to reset a locked Admin account in Magento 2

Drive 20-40% of your revenue with
email, SMS marketing
avada email marketing

It’s a common way that hacker can abuse your security wall by attempting many easy-to-guess passwords consecutively. Consequently, your admin backend is locked due to many failed attempts and Magento 2 core will prevent admin users from continuing login.


All login actions will be blocked for a certain period of time. If you’re using this Security extension, there will be a warning message sent to your email.

Related Topics

It’s not good news for both parties, unfortunately. To ensure the process of managing your backend timely, you can take advantage of launching some command lines which allows safe admin accounts to be able to log in back to the configuration as soon as possible. In order to have the authority performing Linux command-line operations, you must have the SSH access connecting to your server securely. This step requires permission from the server manager directly so this will be the end game for hackers, they can’t run command lines under your nose obviously.

Move forward to check out how to reset locked admin users, and bookmark them when you need this tutorial in a blink of an eye.

Reset a locked Admin account in Magento 2

Store owner can choose one of listed methods

Solution #1. Unlock in the backend

On the assumption that you’re managing several of admin account but only one or two is locked, this will be the most simple way can be accomplished right in the backend.

Follow System > Locked Users to check all current locked users, choose the specific admin account you want to open the lock.


Solution #2. Reset using command lines

  • Step 1: Open your Magento 2 dir
  • Step 2: Running command lines.
  • Step 3: Check the result

Step 1: Open your Magento 2 dir

First, open your Magento 2 dir, this is the general format to reset an admin user. Note that you just can unlock one by one account manually.

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

Step 2: Running command lines.

To unlock a specific admin account, insert the name of that admin into the {username} variable , for example with an admin named sam, type this command line:

php bin/magento admin:user:unlock sam

Step 3: Check the result

A success message will be delivered at the interface if the entered data is valid.


  • If there was a mistake in typing the name of the admin, this message will inform:
    Couldn't find the user account "sam"

    You should check and retype that command line from Step 1 along with the precise admin name again.

  • In case the account is not locked from the start or it can’t be unlocked, this following message will appear


To be amazed how protective and supportive your store can be guarded, you can try out to use this Security Solution. It can prevent unwelcomed violate attacks right from the log in steps at the backend, send warning emails timely, archive all login actions and give you a proper checklist which outlines possible harmful factors for your security issues. To prevent email to spam box, enable SMTP here

Increase sales,
not your workload

Simple, powerful tools to grow your business. Easy to use, quick to master and all at an affordable price.

Get Started
avada marketing automation

Explore Our Products:

People also searched for


Stay in the know

Get special offers on the latest news from Mageplaza.

Earn $10 in reward now!

Earn $10 in reward now!

go up