I have created a admin user by below command.

php bin/magento admin:user:create --admin-user="admin1" --admin-password="admin@123" --admin-email="[email protected]" --admin-firstname="fname" --admin-lastname="lname"

Now, Admin is login successfully but I do not have permission for anything in admin. Below is the Error.

Sorry, you need permissions to view this content. Please help me how can I solve this.

9 Answers 9


Magento 2.4.0 has the 2FA ACL incorrectly configured, so you must allocate both the following ACL to all non Admin "All" roles:

System > Permissions > Two Factor Auth
Stores > Settings > Configuration > Two Factor Auth 

With these ACL's in place user can set their own 2FA and will not be met with the "Sorry, you need permissions to view this content" error.". This is a M 2.4.0 bug and fixed in later versions.

Note users with "Stores > Settings > Configuration > Two Factor Auth" ACL can disabled 2FA for all users once logged in.


Check your module's acl.xml file for error & then do setup upgrade. If issue still persists then comment code in acl.xml file & then do setup upgrade. Hope this will help!


this issue is related to admin created user access. it is occurs if user try to access unauthorised resources i suggest you to do the following two things

1) check your acl.xml file and provide access to the resource from backend using administrator credencials navigate to system>>user roles>>resources and checked the recource option

2) remove/comment the _isAllowed() method body from controller file. like below.

protected function _isAllowed()
    return $this->_authorization->isAllowed('Vendor_ModuleName::Resource');

There are some other things that you can have to do to have access again.

As far as I know, if you do not have access to the back-office, you will not be able to change permission for the new user.

In that case, you will need to do plain sql modifications as explained in this post : Reset roles for Magento 2

If you have access with another user to the back-office, go to Magento documentation about admin users and follow instructions for the user with restricted access. It will unlock the permission for the other user.

  • Thanks @Christophe I have try with your suggested URL(Reset roles for Magento 2) but it's not working for me. Dec 13, 2018 at 8:56
  • Can you please provide me with the queries you've made ? Update your question for more clarity. Dec 13, 2018 at 9:39

If you have recently done your Magento setup and facing this issue,

Clear all the cache and generated folder. Please let me know if this works, thank you!

rm -rf var/* generated/*

There is no code to check if the 2FA is enabled or not. In Magento2.4.2 it is allowed by default. To correct this I have done some changes and these are working for me.

  1. Magento\TwoFactorAuth\Observer\ControllerActionPredispatch.php

Add below code in execute() method

public function execute(Observer $observer)

           if (!$this->tfa->isEnabled()) {
  1. Magento\TwoFactorAuth\Model\Tfa.php


public function isEnabled(): bool
       return true;


public function isEnabled(): bool
       return !!$this->scopeConfig->getValue(TfaInterface::XML_PATH_ENABLED);
  1. Added in file vendor\magento\module-two-factor-auth\Api\TfaInterface.php

const XML_PATH_ENABLED = 'twofactorauth/general/enabled';

After these changes, if you disable the 2FA then it will bypass this


1.In your phpmyadmin,update the AUTHORIZATION_RULE table.It will show "deny" text in all the Permissions column. 2. In that table,Run this query to solve the issue. UPDATE authorization_rule SET permission='allow'

3.Do the Cache flush in magento root directory and check your admin panel.


Setting Developer to Production Mode fixed my issue


I got same problem but with wrong ACL in a custom module.

How it was:

<section id="mysectionname>
    <label>My Section Name</label>

Issue: <resource> must contain the underscore character (MyVendor_MyModuleName)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.