How to Create a New Admin User in Magento 2

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:

  1. Go to Systems > Permissions > User Roles.

    User Roles in Magento admin sidebar
    Go to Systems > Permissions > User Roles in the Magento admin sidebar.

  2. Click on Add New Role.

    Add New Role button on Roles page
    Click on Add New Role on the “Roles” page

  3. Add the role name to the Role Name text area.

    Role Information and Current User Identity Verification
    Add the role name to “Role Name” and insert password in the “Current User Identity Verification” section

  4. The admin will need to insert their password in the “Current User Identity Verification” section to confirm the new User Role.
  5. In the “Roles Resources” section, let the “Resource Access” field option be Custom as you want to customize your permissions settings.

    Role Resources in New Role page
    Select Custom in Resource Access, tick the checkboxes next to the Resources and click on Save Role.

  6. In the “Resources” section, tick the checkboxes next to the resources you’d like the new user to access.
  7. 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

  1. Log in to the Magento admin panel and navigate to System > Permissions > All Users.

    All Users in Magento admin sidebar
    Go to Systems > Permissions > All Users in the Magento admin sidebar.

  2. Click on Add New User on the “Users” page, where all existing users are listed.

    Add new user button on Users page
    Click on Add New User on the “Users” page.

  3. 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.

    Account Information section on New User page
    Add Account Information in New User > User Info > Account Information section

  4. Enter your own admin password in the “Current User Identity Verification” text area.

Assign User Role

  1. Click on the User Role tab in the left navigation menu.

    User Role tab in User Information
    Click on the User Role tab, assign a role to the new user, and click the Save User button

  2. 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.
  3. Click the orange Save User button on the top right.

Confirm New User

  1. Go to System > Tools > Cache Management and select the invalidated cache types.

    Cache Management in Magento admin sidebar
    Cache Management in Magento admin sidebar

  2. Refresh the Magento cache by clicking the Submit button.

    Cache Management page
    Refresh the Magento cache on the Cache Management page

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:

  1. Log in to your Magento server over SSH and navigate to the root directory of your Magento 2 store.
  2. Run the following command:
    php bin/magento admin:user:create
  3. 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
  4. You’ll now see the following output after successfully creating a new admin user:
    Created Magento administrator user named j.doe
  5. Go to the Magento admin panel and log in to System > Permissions > All Users to check if the new user has been created.

Liam is a marketing specialist at StartMarketing.net. Based in Dublin, he graduated from Trinity College Dublin in 2020 with a degree in Computer Science (Intelligent Systems). He has since 2021 worked for Google as a Sales and Marketing specialist, within their Dublin headquarters. Liam has over 4 years of experience in e-commerce sales, digital marketing and branding.

Leave a Comment