There may be times when a developer or a new store manager will need access to your Magento 2 store. Instead of sharing your username and password, you can create a new admin account for them.
There are two ways to create a new admin user in Magento – via the admin panel and command line. This guide demonstrates both methods.
We’re using Magento 2.4.1 for this tutorial, but the steps are the same for other Magento versions.
Prerequisites
Before creating a new admin user, you’ll need to assign a role to the new admin user. This user can have full or limited access to the backend.
An administrator has unrestricted access to the backend. If you want to create a new user with limited authorizations, you can create a separate user role by following these steps:
- Go to Systems > Permissions > User Roles.
- Click on Add New Role.
- Add the role name to the Role Name text area.
- The admin will need to insert their password in the “Current User Identity Verification” section to confirm the new User Role.
- In the “Roles Resources” section, let the “Resource Access” field option be Custom as you want to customize your permissions settings.
- In the “Resources” section, tick the checkboxes next to the resources you’d like the new user to access.
- Click on the orange Save Role button on the top right.
Tip: Disable access to the “Permission” resource when assigning resources to a new user role to prevent the new user from modifying their permissions.
How to Create a New Admin User in Magento 2 via Admin Panel
Configure User Information
- Log in to the Magento admin panel and navigate to System > Permissions > All Users.
- Click on Add New User on the “Users” page, where all existing users are listed.
- Fill in the following details in the User Info > Account Information section:
User Name: Enter a user name. Avoid using the user’s name as the user name for security reasons.
First Name: Add the first name of the user.
Last Name: Add the last name of the user.
Email: Insert a unique email address. The admin user will receive an email to configure two-factor authentication on their email address.
Password: Enter a strong password.
Password Confirmation: Confirm the password.
Interface Locale: If you have a multi-language Magento store, you can assign a language for the new user’s admin interface here. The default language is set to English (US).
This account is: Choose Active to activate the account and Inactive if you want to activate the user at a later date. - Enter your own admin password in the “Current User Identity Verification” text area.
Assign User Role
- Click on the User Role tab in the left navigation menu.
- Assign a role to the new user from the grid list. Over here, we’ll select the “Administrator” user role as we want to give complete access to the new admin user.
- Click the orange Save User button on the top right.
Confirm New User
- Go to System > Tools > Cache Management and select the invalidated cache types.
- Refresh the Magento cache by clicking the Submit button.
How to Create a New Admin User in Magento 2 via Command Line
Creating a new admin user in Magento 2 via the command line takes less time than the admin panel method, as you don’t have to fill out multiple fields.
You can add a new admin user using five simple steps:
- Log in to your Magento server over SSH and navigate to the root directory of your Magento 2 store.
- Run the following command:
php bin/magento admin:user:create
- You’ll then be prompted to fill in the following details one by one:
Admin user: jane_doe Admin password: ************* Admin email: [email protected] Admin first name: jane Admin last name: doe
- You’ll now see the following output after successfully creating a new admin user:
Created Magento administrator user named j.doe
- Go to the Magento admin panel and log in to System > Permissions > All Users to check if the new user has been created.