Suddenly I am no longer a sudoer!

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

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.

What about recovery mode or…

https://help.ubuntu.com/community/LiveCdRecovery

1 Like

Your user is no longer a member of group “sudo”. Verify by looking in /etc/group for sudo: “sudo:x:27:” should be “sudo:x:27:your_user_name”.

You can fix your problem by booting into recovery mode. See instructions here:

3 Likes

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.

Plug in a keyboard or maybe check your bios. There should be a option for it.

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

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…

$ ls /etc/group
root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:
floppy:x:25:
tape:x:26:
sudo:x:27:marfig
audio:x:29:pulse
dip:x:30:
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
systemd-journal:x:101:
systemd-timesync:x:102:
systemd-network:x:103:
systemd-resolve:x:104:
systemd-bus-proxy:x:105:
input:x:106:
crontab:x:107:
syslog:x:108:
netdev:x:109:
messagebus:x:110:
uuidd:x:111:
ssl-cert:x:112:postgres
lpadmin:x:113:
lightdm:x:114:
nopasswdlogin:x:115:
ntp:x:116:
whoopsie:x:117:
mlocate:x:118:
ssh:x:119:
avahi-autoipd:x:120:
avahi:x:121:
bluetooth:x:122:
scanner:x:123:saned
colord:x:124:
pulse:x:125:
pulse-access:x:126:
rtkit:x:127:
saned:x:128:
marfig:x:1000:
sambashare:x:129:
vboxusers:x:131:
postgres:x:132:marfig
nvidia-persistenced:x:130:
debian-spamd:x:133:
1 Like

Yours is basically the same as mine I think and I am the sole user.

root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:syslog,m16
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
dialout:x:20:
fax:x:21:
voice:x:22:
cdrom:x:24:m16
floppy:x:25:
tape:x:26:
sudo:x:27:m16
audio:x:29:pulse
dip:x:30:m16
www-data:x:33:
backup:x:34:
operator:x:37:
list:x:38:
irc:x:39:
src:x:40:
gnats:x:41:
shadow:x:42:
utmp:x:43:
video:x:44:
sasl:x:45:
plugdev:x:46:m16
staff:x:50:
games:x:60:
users:x:100:
nogroup:x:65534:
systemd-journal:x:101:
systemd-timesync:x:102:
systemd-network:x:103:
systemd-resolve:x:104:
systemd-bus-proxy:x:105:
input:x:106:
crontab:x:107:
syslog:x:108:
netdev:x:109:
messagebus:x:110:
uuidd:x:111:
ssl-cert:x:112:
lpadmin:x:113:m16
lightdm:x:114:
nopasswdlogin:x:115:
ntp:x:116:
whoopsie:x:117:
mlocate:x:118:
ssh:x:119:
avahi-autoipd:x:120:
avahi:x:121:
bluetooth:x:122:
scanner:x:123:saned
colord:x:124:
pulse:x:125:
pulse-access:x:126:
rtkit:x:127:
saned:x:128:
m16:x:1000:
sambashare:x:129:m16
vboxsf:x:130:
1 Like

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.

Cheers! :joy:

$ cat /etc/group | grep marfig
adm:x:4:syslog,marfig
cdrom:x:24:marfig
sudo:x:27:marfig
dip:x:30:marfig
plugdev:x:46:marfig
lpadmin:x:113:marfig
marfig:x:1000:
sambashare:x:129:marfig
vboxusers:x:131:marfig
postgres:x:132:marfig

Only if your running VirtualBox and want access to the Host.

Don’t forget to check the solve box :slight_smile: