All of a sudden, when I am trying to sudo a command, I am told my user account doesn’t belong to the sudoers group.
I lost all sudo privileges and have no idea how this was possible since I have not issued any commands that would take me away from this group.
The little I can do on the machine right now to investigate what could possible have gone wrong, doesn’t help much. I am still listed on /etc/passwd as a 1000:1000 UID/GID user. So that’s ok. I can also see in /etc/group my user group. So nothing out of the ordinary here. On the Panel, under System > Administration > Users and Groups, I can click the Manage Groups button and when I scroll down to the sudo group and hit Properties, I can see my user name, but it is not checked.
I cannot login as root, and all dialog boxes asking me for authentication for privilege escalation fail.
What can I do? What happened? Is the sudoers file corrupt? What? Please don’t tell me I have to reinstall the operating system! I just don’t have the internet to do it. At 60 USD for 2GB over here in Angola, having to reinstall Ubuntu is impossible at this point.
I tried Recovery mode from the GRUB menu, but my USB keyboard apparently doesn’t work after I get to the Recovery Mode main menu. It’s weird. I can’t cycle through the options, or choose anything, despite the keyboard working fine earlier in the grub menu.
I’ll have to write down that webpage (I don’t have a printer) and will see what I can do.
Ok. The live cd recovery mode helped and I was able to add my user account back to the sudoers group. Thank you @anon42388993.
And thank you also @Dave_Barnes; your post helped me understand what went wrong.
As part of my study of bash scripting I am following the Linux Command Line and Scripting Bible, 3rd Edition, by Richard Blum et al, from WILEY. Early this morning (some 12 hours ago) I was going through chapter 7 and the book has a major, major error: it tells you that to add a user to a group you can do $ usermod -G group name. Which I did in good faith, while testing it with a new group I had created.
Looking at the documentation now I can see it in fact requires -a or else my entire group list is replaced.
So it was not just sudo. I got removed from every other group I was previously a member off. I added myself already also to postgres. But the others I just don’t know which groups I should belong. So if anyone could help me pick them apart…
Thank you @anon42388993, You folks are fantastic!
That will set me right. I believe I will also have to add myself to vboxusers in addition to what I can see in your list.