Ubuntu – Authentication failed with the correct password and now I cannot use sudo anymore

12.04authenticationusers

Recently I installed Ubuntu 12.04 (first time on Ubuntu).

I have my normal "administrator", and another Guest account.

I was experimenting today with the user accounts, and set my "administrator" account to "standard" in user account settings.

Now whenever something asks me for authentication, it gives me failed message.

I am using the same old password, didn't create new accounts, just changed privileges.
I'm sure that the password is correct, because I can still log in.

I tried logging in to root from Terminal, but it gave me that I'm not one of the sudoers.

Best Answer

The sudoers file works normally via group membership of a user.

As default, you have the following configuration in ubuntu:

 # Members of the sudo group may gain root privileges
 %sudo ALL=(ALL) ALL

As I understand your description, you have dropped the group membership for the sudo group.

Hopefully you have left over another account which is member in the sudo group. If this is true, you can use the following command to fix your user:

 sudo usermod -a -G sudo  USERNAME

If you have given your root user an explicit password (non standard in ubuntu), you can also invoke:

 su -c usermod -a -G sudo  USERNAME

If both isn't possible, you may do the following:

  1. boot your computer with a live/rescue cd (see also https://wiki.ubuntu.com/RecoveryMode)
  2. mount your root partition (aka /) to e.g. /mnt
  3. chroot /mnt usermod -a -G sudo USERNAME