Locked Myself Out Of VirtualMin

SYSTEM INFORMATION
OS type and version Ubuntu Server 24.04.4 LTS
Webmin version 2.621
Virtualmin version 8.1.0 GPL
Webserver version 2.4.58

Hi,

I’ve very stupidly managed to lock myself out of administrative access to VirtualMin by unticking the ‘allow root access to sudoers’ (not the exact wording) option in Webmin Users > Configure Unix User Authentication module.

Can I update this setting on the server itself using the VirtualMin API to regain access for the Unix admin account, perhaps?

I’m still able to login to the server via SSH or locally, and the account remains in the sudoers file.

I combed thought the Webmin-related config files, and found a sudo= option in /etc/webmin/miniserv.conf.

Setting that to 1 and restarting the Webmin service seems to have re-enabled access for my admin account.

But unfortunately, it looks like I accidentally enabled 2-factor authentication, at the same time, and now I can’t get in because I didn’t properly register the site in my OTP authentication app.

I’m going to have a poke around in the same conference file to see if I can disable 2-factor authentication now.

1 Like

Yes, you can manually edit the sudo= directive and set it to 1 in /etc/webmin/miniserv.conf and then restart Webmin with:

systemctl restart webmin

Our messages crossed @Ilia!

Now I’m wondering if the 2-factor authentication option can be disabled in the some config file.

If you have etckeeper installed, you can review configuration changes using the git diff command in /etc directory or using more complete the virtualmin list-config-backups CLI.

Yes, it can be done easily if you have root access via SSH. See the diff for the disabled/enabled 2FA state for the Webmin user:

diff --git a/webmin/miniserv.users b/webmin/miniserv.users
index dbda4cc..9a9af92 100644
--- a/webmin/miniserv.users
+++ b/webmin/miniserv.users
@@ -1,4 +1,4 @@
-root:x::::::::0:::::
+root:x::::::::0:0:totp:6ITIBSQ35NWNKRPJ::

I don’t think I do, but I will if not.

I see an twofactor_provider option in the config. Seems to have a current value of “totp”.

Aaaand I’m back in! Thank you so much for your assistance @Ilia !

1 Like

See my previous comment.

And, you should have etckeeper installed if you used our installation script to install Virtualmin.

1 Like

I did install via the installation script from the VirtualMin site.

I get an "unrecognised option ‘–git’ " error when I attempt to run the diff command as above, oddly.

I mean the git diff command, which should be run in the /etc directory.

1 Like

Cool, thanks very much once again!

This topic was automatically closed 8 days after the last reply. New replies are no longer allowed.