Unlock an Admin User Account

Several incorrect login attempts in Magento Admin and your account is locked? No worries! Let's see how you can easily unlock an admin user account.

As is well know, Magento 2 comes with a built-in Symfony-like command-line interface (CLI). This command-line interface gives you the possibility to perform multiple tasks like, Installing Magento, Clearing the cache, Managing indexes and many more. One other task is to unlock an account of an admin user that is locked. Usually an admin user account can be locked because of several incorrect login attempts. To use the command-line interface (CLI) of Magento 2, you must have SSH access to your server. After connecting to your server you would be able to run commands from your Magento install dir.

With the following command you can unlock a locked admin user account.

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

For example to unlock an admin user with username demo, the command will be:

php bin/magento admin:user:unlock demo

A successful unlock will give you back the following message:

The user account "demo" has been unlocked

If the account is either not unlocked or if there was a problem, will give you back the following message:

The user account "demo" was not locked or could not be unlocked

If the account doesn’t exist, will give you back the following message:

Couldn't find the user account "demo"

In Magento admin and under  System → Locked Users you will be able to have an overview of all locked admin user accounts.

Additional information about the Magento 2 command-line interface (CLI) can be found here.

Feel free to share this post and ask your questions in the comments below.

Till next time!