Are you looking to unlock Magento 2 admin user account?
Magento admin accounts can get locked due to multiple reasons. The most common cause is entering the wrong username and password many times. Also, someone else logged in with admin access can lock the account.
Sometimes the Magento website shows signs of infection; hence, hosting companies lock the login to the store. No one can log in, and the company can prevent the spread of infection and clean the store.
In this quick tutorial, we will learn to unblock admin user accounts in Magento 2.
How to unlock Magento 2 Admin User Account?
There are two ways to unlock Magento 2 admin user account:
#1 Using another admin account
Another admin can unlock the locked Magento 2 admin account. That is one reason to have multiple Magento 2 admin accounts.
You can view all the locked accounts under the Locked Users grid. If you have access to the store through many admin accounts, you can use anyone to unlock the original admin account.
Follow the steps to unlock the account:
- Open the Magento admin panel
- Navigate to the System > Permission > Locked Users
- Find the locked account in the Table
- Select Unlock from the dropdown options
Finally, press the Submit button to unlock the account.
#2 Unlock Admin Account using CLI
Follow the steps to run the CLI command to unlock the admin account:
- Connect the server through SSH
- Navigate to the Magento root directory
- Run the following command:
$ bin/magento admin:user:unlock {username}
Replace the {username} with the locked admin username. The account will be unlocked, and you will see a success message.
But if the message says that the account was not locked and cannot be unlocked, you have to check whether the {username} is on Magento 2.
If the user does not exist, the Magento message will tell you. Verify the account exists and is active before unlocking the account.
Wrap Up
Magento is a powerful ecommerce platform. There are many security features, and one such feature is locking an admin account when it suspects unauthorized activities.
Besides locking the admin account, you can also set up the number of failed login attempts before Magento locks the admin account. You can add the captcha or security question to the login page.
In this tutorial, we learned to unlock the Magento 2 admin user account. If you encounter any issues while implementing the solution, please leave them in the comment section.