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
- Log into WHM
- Click on Two-Factor Authentication
- Click on “Manage My Account”
- 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.