How to disable 2 factor authentication via command line on a cPanel server

If you have enabled Two-Factor Authentication on your WHM, but have lost access to get your codes, you can disable it via SSH command line.

To disable it via command line, ssh to the server and run this command:

whmapi1 twofactorauth_disable_policy

This turns two-factor auth off.  However, it does not delete the current two-factor setups.  So before you turn two-factor back on, you need to disable the two-factor code from your account

  1. Log into WHM
  2. Click on Two-Factor Authentication
  3. Click on “Manage My Account”
  4. Click on Remove Two-factor Authentication

This will remove the current two-factor code from the root user, allowing you to setup a new one.

Server Sitters is an Outsourced Hosting Support provider. We provide outsourced hosting support and specialize in hosting support for web hosting companies that require Helpdesk Support, Telephone Support Services or want to Outsource Chat Support.
Switch to desktop version