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.
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.