How can I disable the Two-factor Authentication module using command-line ?
8 Answers
please run below command in terminal Magento root path :
bin/magento module:disable Magento_TwoFactorAuth
bin/magento cache:flush
-
i would not recommend to force disable the module, rather use new module which extend the configuration so there should always be an option to control the configurations from admin panel. Aug 14, 2020 at 4:02
-
@ZeeshanKhuwaja it's useful to disable this in development to avoid having to perform 2FA on your development machine when logging into admin. I wouldn't disable in production as it's a useful security feature. Sep 5, 2020 at 19:50
-
2Yes, this feature enabled by default is a pain for localhost installation. I would prefer to login without it and then enable this feature from the Admin panel. Oct 8, 2020 at 19:52
-
2
-
2This is the result of running bin/magento module:disable Magento_TwoFactorAuth The following modules have been disabled: - Magento_TwoFactorAuth Cache cleared successfully. Generated classes cleared successfully. Please run the 'setup:di:compile' command to generate classes. Info: Some modules might require static view files to be cleared. To do this, run 'module:disable' with the --clear-static-content option to clear them. So the proper answer would be to run bin/magento module:disable Magento_TwoFactorAuth bin/magento setup:di:compile Not bin/magento cache:flush Jun 22, 2022 at 13:46
Mark Shust created a module for this purpose which is developer-friendly while keeping secure defaults in place; ref his comments about it
-
Definitely the better option to use this module than to generally disable 2FA.– codedgeSep 12, 2020 at 16:55
-
1Thanks @benmarks, the module works really great except the part that it does not work on the REST APIs interface. Seems the patch only works on the admin area not on all areas. Nov 9, 2020 at 6:59
For magento 2.4.6 to disable Two Factor Authentication module
php bin/magento module:disable {Magento_AdminAdobeImsTwoFactorAuth,Magento_TwoFactorAuth}
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy -f
php bin/magento indexer:reindex
php bin/magento cache:flush
I found a way, by adding a system configuration to Enable/Disable it. I made a module, you can download it with composer:
composer require wolfsellers/module-enabledisabletfa
Or check it at: https://github.com/wolfsellers/module-enabledisabletfa
-
2You have copied same answer to two questions, please do some changes at content to make two answers are different– Amit Bera ♦Aug 6, 2020 at 9:08
It would help
bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth
From Magento 2.4.5 to disable Two Factor Authentication in magento 2.4
php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth
You need first disable
bin/magento module:disable Magento_TwoFactorAuth
bin/magento module:disable Magento_TwoFactorAuth
bin/magento cache:flush
grep
command...this worksphp bin/magento module:disable Magento_TwoFactorAuth
well....