Admin users can disable the Two-Factor Authentication (2FA) by using the command line methods from the Magento 2 root directory documented in this article.
Magento 2 Admin Login & Two-Factor Authentication (2FA)
What is Two-Factor Authentication (2FA)?
Two-Factor Authentication (2FA) is one category of Multi-Factor Authentication (MFA) that strengthens access security requirements by needing two authentication factors/methods to verify your identity.
Why Would You Want to Disable Two-Factor Authentication (2FA) in Magento 2.4 & Greater Versions?
Although earlier versions of Magento offered options to not install or to disable Two-Factor Authentication (2FA), Magento 2.4 and greater versions enable 2FA by default on every installation. The Magento admin user must disable 2FA using the command line.
While it is never recommended to disable 2FA in Magento 2.4 and greater versions, given its strength of security, there are a few scenarios in which you may want to disable it:
1. To enable the admin user to log into the Magento 2 Admin Panel Dashboard for the first time due to 2FA warning message.
2. When 2FA is not needed in a staging environment.
3. When 2FA is not needed in a testing environment.
4. When 2FA is not needed in a development environment.
Magento 2.4 & Two-Factor Authentication (2FA)
By default, Magento will enable Two-Factor Authentication (2FA) after Magento version 2.4. So, before logging into the Magento Admin Panel Dashboard, the admin users will need to configure their 2FA either through the user interface or a web API. The 2FA provides an additional layer of security to the Magento 2 Admin Panel, making it harder for suspicious users to log in to the Magento 2 Admin Panel Dashboard without authorization. It also helps decrease the chance of questionable access to the Magneto 2 Admin Panel Dashboard. So, we do not recommend that you disable 2FA authentication in your Magento 2 Admin Panel Dashboard for security reasons. If you still do not wish to use 2FA, you can disable 2FA for the development, testing, or staging, environment or store.
Once you install Magento 2 for your domain, you will receive the following warning message while trying to access the Magento Admin Panel Dashboard for the first time:
Due to this warning message, you will not be able to log in to the Magento 2 Admin Panel Dashboard. Unfortunately, Magento 2.4 and greater versions do not provide an option to disable Two-Factor Authentication (2FA). But you can disable the 2FA by following any of the command line methods from your Magento 2 root directory.
Command Line Method #1: Magento 2 Admin Login & Disabling 2FA Temporarily
The first command line method for disabling 2FA temporarily from your Magento 2 root directory is done by issuing the following command:
Command Line Method #2: Magento 2 Admin Login & Disabling 2FA Temporarily
The second command line method for disabling 2FA temporarily from your Magento 2 root directory is done by issuing the following command:
Command Line Method #3: Magento 2 Admin Login & Disabling 2FA Temporarily
The third command line method for disabling 2FA temporarily from your Magento 2 root directory is done by taking the following steps:
Open the app folder -> etc -> config.php using any of the text editors (for example the VI Text Editor) from your Magento 2 root directory:
vi <Magento 2 root directory>/app/etc/config.php
Find 'Magento_TwoFactorAuth' => 1, and replace with 'Magento_TwoFactorAuth' => 0,
Where you use a value of 0 for disabling 2FA and a value of 1 for enabling 2FA.
3. Clean the cache by the following command:
Now you will be able to log into the Magento Admin Panel Dashboard without using Two-Factor Authentication (2FA).
Installing Magento 2 via Composer or a ZIP/TAR Archive File
You can install Magento 2 either using Composer or downloading an archive file for the Magento-specific version in either ZIP or TAR archive file format. But please note that installing Magento from an archive lacks the advantages of using Composer, including reusing third-party libraries without wrapping them with source code, reducing extension conflicts and compatibility issues by using a component-based architecture with robust dependency management, etc. In addition, you should install Elasticsearch before installing Magento 2.4, and Magento does not support Elasticsearch versions 2.x, 5.x, and 6.x.
Installing Magento 2 via Composer
To install Magento 2 using Composer, you can follow the below steps.
Installing Magento 2 via Composer Step #1: Install Composer
You can run the following scripts in the terminal to install Composer in the current directory:
These installer scripts will check some php.ini settings, notify you if they are set incorrectly, and then download the latest composer.phar in the current directory.
If you want to put the composer.phar into a particular location as per your requirement, you can call composer from any location such as the following directory:
Issue the composer --help command to see available options for specific environments.
Installing Magento 2 via Composer Step #2: Install Magento 2.4.
To install Magento 2.4 via Composer, you can run the following commands in the current directory:
You can choose the Magento version in the command shown above as per your requirement by replacing the 2.4.0 with the version you wish to install.
You can run the following commands in the Magento root directory to set file permissions:
Issue the bin/magento list command to display a complete list of commands. Issue the bin/magento help <command> to get help for a particular command.
Magento 2.4 Requirements
- Mail Server: Mail Transfer Agent (MTA) or an SMTP Server.
- Operating Systems (Linux x86-64): Linux distributions, such as RedHat Enterprise Linux (RHEL), CentOS, Ubuntu, and Debian. Magento is not supported on Microsoft Windows and macOS.
- PHP Extensions: ext-bcmath,ext-ctype, ext-curl, ext-dom, ext-fileinfo, ext-gd, ext-hash, ext-iconv, ext-intl, ext-json, ext-libxml, ext-mbstring, ext-openssl, ext-pcre, ext-pdo_mysql, ext-simplexml, ext-soap , ext-sockets, ext-sodium, ext-xmlwriter, ext-xsl, ext-zip, lib-libxml, lib-openssl.
- PHP OPcache: The OPcache is enabled in many PHP distributions and is recommended for performance reasons.
- PHPUnit: PHPUnit (as a command-line tool) 9.0.0
- RAM: Magento applications and extensions upgrade requires up to 2GB of RAM. If the system has less than 2GB of RAM, you will need to create a swap file to avoid upgrade failure.
- System Dependencies: bash, gzip, lsof, mysql , mysqldump, nice, php, sed, tar.
- SSL: A valid security certificate is required for HTTPS.
If you are looking for a suitable Magento hosting plan for your website, you are in the right place. At Nexcess, we offer optimized ecommerce hosting solution built for speed, security, and scale. You can find the available Fully Managed Magento Hosting plan on the Nexcess website. We also install Magento 2 for our customers as per their requirements using our own customized nkmagento2 command from our side. In addition, our skilled team provides 24/7/365 support and monitoring services so that you can focus on your websites. Contact our team today to learn more.
Not a Nexcess Customer Yet?
Nexcess Managed Hosting offers you many benefits from security and performance scanning, automated maintenance, and updates to beautiful, customizable designs and 24/7/365 support. Furthermore, Nexcess offers three flagship managed platforms to choose from:
Managed WordPress Hosting with automatic plugin and platform updates.
Managed WooCommerce Hosting with built-in image compression and the acclaimed StoreBuilder interface.
- Managed Magento Hosting containing Elasticsearch, the ability to add-on server clusters, and PCI compliance.
Partner with us by letting us help you implement one of our many excellent, fully managed hosting solutions. Have more questions? Our experts are here to help!
Managed Magento Hosting Plans
Before we get started, you may refer to the Managed Magento Hosting page to get an idea of our plans if you are in the market for a web hosting provider.
Consider Hosting with Nexcess
Hosting optimized for the industry's leading platforms, including Managed WordPress Hosting, Managed WooCommerce Hosting, and Managed Magento Hosting.
Read more about the Fully Managed Magento Hosting and its benefits for your business.
Optimized Ecommerce Hosting for Speed, Security and Scale
It’s hosting optimized for WordPress. That means a faster, more secure and scalable website. Smart monitoring tools are built-in to help you keep it that way.
It’s why WordPress Users Trust Nexcess Hosting.
We also have a variety of Nexcess support articles about Magento 2. Our range of hosting plans caters to any business scale. We do all the heavy lifting for you to focus on growing your business. In addition, we automatically update ore components and plugins to the latest version and ensure your hosting environment is properly optimized, secured, and updated.
Nexcess infrastructure was specially designed to keep up the best speed and performance in the industry. No traffic surge can threaten your website to go down thanks to our autoscaling technology which adds more resources to your server to handle the load. In addition, we offer always-on security monitoring and support from web hosting experts 24/7/365 and a built-in CDN with 22 locations and advanced caching for ultra-fast loading.
All hosting plans include The Nexcess 30-Day Web Hosting Money Back Guarantee.
Need a No-Code Website Building Solution?
Are you on an accelerated schedule and already ready to move forward? If you need to get started with your Nexcess StoreBuilder Solution sooner rather than later, check out these resources:
Next Steps with a Nexcess Cloud Hosting Solution?
Read more about the Fully Managed Cloud Environment by Nexcess and its benefits for your business.
A Cloud Hosting Solution That Lets You Do Business Your Way
We believe in the promise of cloud: scalability, security, performance, and ease of use. Together with our team, clients, and partners, we’ve built something better.
Choose From Multiple Applications
Whether you’re a small business or a high-traffic eCommerce store, our cloud hosting solutions are designed around your needs: auto scaling, PCI compliance, and comprehensive development tools provide you with maximum dynamic flexibility in a fully managed cloud environment.
We make applications easy with environment optimizations for:
And there are many more!
We also have a variety of Nexcess support articles about how best to implement our product offerings housed in the Nexcess Knowledge Base, including how to get your site going with a number of different configuration options.
If you need any assistance with the above-mentioned, don't hesitate to reach out. For 24-hour assistance any day of the year, Nexcess customers can contact our support team by email or through your Client Portal.
Why Choose Nexcess?
Because we're different! Chris Lema captures "the why" in his passionate and stirring recount of a Nexcess support-related story.
Useful YouTube > Nexcess Channel Links
- Nexcess on YouTube - Home
- Nexcess on YouTube - Welcome to Your Nexcess Portal
- Nexcess on YouTube - Featured Videos
- Nexcess on YouTube - All Videos
- Nexcess on YouTube - All Playlists
Resources for More Information
Need more help? The Applications > Magento 2 and Magento 1 sections within the Nexcess Knowledge Base are important resources for those seeking additional knowledge.
The Applications section also contains valuable insights for those seeking additional knowledge about our other various hosted applications and platforms. Check out our related video playlists and articles below:
- Managed WordPress by Nexcess - Video Playlist
- Managed WooCommerce by Nexcess - Video Playlist
- Managed Magento by Nexcess - Video Playlist
- Magento 2 Nexcess Knowlesge Base
- Magento 2 Hosting
- Nexcess Scope of Support - Magento 2
- The Ultimate Magento 2 Checklist for Performance
- Magento 2 Optimized - Ebook
- How to enable Elasticsearch for your Nexcess Cloud account
- How to configure Magento 2 to use Elasticsearch
- How to use Elasticsearch with ElasticPress
- Magento 2 Help