63

How can I disable the Two-factor Authentication module using command-line ?

3
  • 7
    just found the module with the help of grep command...this works php bin/magento module:disable Magento_TwoFactorAuth well....
    – Softec
    Jul 31, 2020 at 1:45
  • please post this comment as answer
    – Amit Bera
    Jul 31, 2020 at 4:12
  • Does this answer your question? Magento 2.4 - Two factor authentication
    – robsch
    Sep 8, 2020 at 7:52

8 Answers 8

183

please run below command in terminal Magento root path :

bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth 
Magento_TwoFactorAuth
bin/magento cache:flush 
8
  • 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
  • 2
    Yes, 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
    For me, I needed to run "bin/magento setup:di:compile" also Oct 8, 2020 at 19:56
  • 2
    This 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
    – Martin J.
    Jun 22, 2022 at 13:46
19

Mark Shust created a module for this purpose which is developer-friendly while keeping secure defaults in place; ref his comments about it

2
  • Definitely the better option to use this module than to generally disable 2FA.
    – codedge
    Sep 12, 2020 at 16:55
  • 1
    Thanks @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
15

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
2

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

1
  • 2
    You 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
2

It would help

bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth
1

From Magento 2.4.5 to disable Two Factor Authentication in magento 2.4

php bin/magento module:disable Magento_AdminAdobeImsTwoFactorAuth Magento_TwoFactorAuth

1

Change value of Magento_TwoFactorAuth to 0 in app/etc/config.php.

0

You need first disable

bin/magento module:disable Magento_TwoFactorAuth
bin/magento module:disable Magento_TwoFactorAuth
bin/magento cache:flush 

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