Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm running Linux Mint 11 and I lost the privilege to use sudo, apparently the result of accidentally removing myself from the admin group.

When I use the groups command to list the groups I'm in, it only shows my user ID and vboxusers. I think I mistakenly used usermod instead of useradd to put my ID in the vboxusers group, so I got removed from all other groups.

Solutions I found on the web (like this: describe choosing recovery mode in the GRUB menu, getting a root prompt and using that to add my user back to the group. But when I do that it asks for the root password, which I don't know because Linux Mint and other Ubuntu-based distributions don't allow you to see or set the root password during installation.

I have Linux live CDs so I can gain root privileges that way, but that won't enable me to manipulate users in the Mint installation via the command line. However, I can use that to edit any file, so which file should I edit and how should I edit it so I can regain admin (and consequently sudo) privileges?

My ID is still in the sudoers file, as shown with cat /media/mint/etc/sudoers when running the live CD.

share|improve this question
up vote 1 down vote accepted

You'll have to boot into recovery mode to gain root (system-wide) access in order to repair

If you have a single-boot (Ubuntu is the only operating system on your computer), to get the boot menu to show, you have to hold down the Shift key during bootup.

From the boot menu, select recovery mode

After you select recovery mode and wait for all the boot-up processes to finish, you'll be presented with a few options. In this case, you want the Drop to root shell prompt option.

/etc/group is the file that defines the groups on the system

You can then use adduser username admin to readd your user to the admin group.

Alternatively you can use the vigr command to edit the /etc/group file safely

format example;

share|improve this answer
As I mentioned above, the "Drop to root shell" doesn't work because it asks for the root password. But I'll try to edit the /etc/group as you described. – Mike Rowave Jan 21 '12 at 12:37
Thermionix - after selecting the root prompt option on that menu, it says Enter root password or press Ctrl-D to continue. Ctrl-D simply returns to the same menu. Without knowing the root password, the recovery mode won't let me do anything. – Mike Rowave Jan 21 '12 at 15:15
Using the live CD to edit /etc/group worked. – Mike Rowave Jan 21 '12 at 23:26

Similar, or possible the same issue: For some reason, creating a USB live mint (in my case mate+cinnamon) does not allow you to sudo (and therefore you cannot install).

What is crazy is that you CAN su in a non-graphical console!

To solve this:

  • open a terminal and type passwd
  • give a password for the mint
  • press Ctrl+Alt+F1 to go to a non-graphical console
  • login as mint with your password
  • type su to become root
  • type echo "mint ALL=(ALL:ALL) ALL" >> /etc/sudoers (with the quotes)
share|improve this answer
I would recommend editing sudoers with visudo instead. – slhck May 15 '12 at 7:53
@slhck in that case it doesn't matter. It is important not to use sudo when editing sudoers. Echo will edit it instantly. – enedil Mar 4 '14 at 18:54
Good points. For details why:… – ntg Mar 31 at 13:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .