I accidentally removed myself from the admin group when editing the user. Now I can no longer use sudo
. The error says: ber is not in the sudoers file. This incident will be reported.
I booted up in rescue mode, but, when going into root prompt, it asks me for the root password. I don't have one, and providing with my own (first and only ubuntu-user) password, it won't allow entrance.
My harddisk is encrypted, but only the /home/user part, not the entire disk, afaik.
What can I do?
Best Answer
Hmm well you've covered what I would have suggested first. Seems annoying that Rescue mode would hassle you for a password if the entire disk weren't encrypted (I don't know, that might be standard protocol).
I'd personally jump into a live environment (via Live CD or Live USB), mount the filesystem (assuming it isn't encrypted) and edit its
etc/group
file and add yourself back in. The resulting line should look something like this (though the GID may be different):Or on Ubuntu 12.04, find the line for the
sudo
group instead of theadmin
group.Alternatively, you can probably
chroot
from the LiveCD to run commands. (sudo password for the LiveCD is a blank password, just press return when prompted)For Ubuntu 12.04 and later, add the user to the
sudo
group instead of theadmin
group:chroot
drops you off at a root shell inside your filesystem so should let you do fancy things like adding users to groups. It's most useful for fixing boot issues but it can do a lot of gubbins.