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:
... root:x::::::::0:0::: #root:x::::::::0:0:totp:ZZZZZZZZZZZZZZZZ: ...
- Restart Webmin and log back in normally
Disabling two-factor authentication entirely
- Get root SSH or console access
- Edit the file /etc/webmin/miniserv.conf and find the line “twofactor_provider=totp” and replace with “twofactor_provider=” and save
- Edit the /etc/webmin/miniserv.users as mentioned above
- Restart Webmin and log back in normally
Notes
- I’ve had success with this on Webmin 1.760 running on CentOS 7.0