[Solved] Turn off 2FA on WHM with SSH Command Line

July 14, 2016

This morning I tried logging into one of my WHM servers with 2FA and it was not working.

(BTW: If you don’t have 2FA setup on your WHM login page then you are missing a great security feature on your Cpanel server).

I checked the Cpanel forums and found a page here showing how to turn off 2FA on WHM for a user using the API through command line, BUT IT DID NOT WORK.

 –user=root TwoFactorAuth remove_user_configuration

disable-2fa-with-ssh

THE SOLUTION
After a quick chat with Cpanel Support Team they told me that running the command below through SSH will disable 2FA on the WHM server.

mv -v /var/cpanel/authn/twofactor_auth/tfa_userdata.json{,.bak}; echo ‘{}’ >> /var/cpanel/authn/twofactor_auth/tfa_userdata.json

After running the command above I was able to log back into WHM without being prompted for 2FA credentials, then set up 2FA again and was back in business.

Phew! Panic Over.