Disable Virtualmin Two-factor Authentication

Virtualmin is constantly being developed and gaining ever useful features, and for a while now has featured two-factor authentication which is great, although what happens if you get locked out of your system? As long as you have SSH or console access then you can follow the steps below to easily get back in.

Disabling two-factor authentication for a single user

Get root SSH or console access

Edit the file /etc/webmin/miniserv.users, comment out the current line for the user then create a fresh copy above it

Remove any mention of “totp” and the long string of characters near the end and save, for example your file should now look like the following: