How do I enable it for all account types in Magento 2?

Anyone, please help me with how to enable the Two-factor Authentication module using a command line.


7 Answers 7


You can also use this to disable using this command: php bin/magento config:set twofactorauth/general/enable 0 if you want disable complete module than try this php bin/magento module:disable Magento_TwoFactorAuth and at the end bin/magento cache:flush also clear browser cookies or try incognito browser.


first of all, check the module is disable or not by following command.

sudo bin/magento module:status

If, your module is not disable and you want to disable it, then deactivate it by following command.

sudo bin/magento module:disable Magento_TwoFactorAuth

clear cache.....

sudo bin/magento cache:flush

I hope it work perfectly!


enable/disable: bin/magento module:enable/disable Magento_TwoFactorAuth --clear-static-content &&

bin/magento setup:upgrade && bin/magento setup:di:compile


Try this module https://github.com/markshust/magento2-module-disabletwofactorauth. It disables it in developer mode and it easy to use.


You can enable module using below command.

php bin/magento module:enable MSP_TwoFactorAuth

After module enable run below command.

If you have set the developer mode for you website then only run below command.

php bin/magento setup:upgrade
php bin/magento cache:clean
php bin/magento cache:flush

If you store set production mode then run below command.

php bin/magento maintenance:enable
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento maintenance:disable
php bin/magento indexer:reindex
php bin/magento cache:flush

I hope it work perfectly!


If the mode is Developer you can run these commands:

sudo bin/magento module:disable Magento_TwoFactorAuth;#Disable
sudo bin/magento module:enable Magento_TwoFactorAuth;#Enable
sudo php bin/magento c:c;
sudo rm -rf generated;

Please run the below command in terminal:

bin/magento module:enable Magento_TwoFactorAuth

bin/magento cache:flush 

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.