Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

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

Recently, I accidently lowered my privledges on Ubuntu. I was trying to add vboxusers group to my account, and quickly googled to fund out I can add groups by sudo usermod -G vboxusers USER

Unaware this would remove all my groups, I used this command and now I can't use SUDO to change back because I am not an admin.

I already tried logging in as root. it didn't work

This is the only user account on the machine. I need admin privledges. What do I do?

share|improve this question
up vote 4 down vote accepted

During boot press SHIFT to get into the GRUB menu, then select boot into recovery mode, "Drop to the root shell" and the just re-add yourself to the admin group with usermod including the -a option to append the groups to the current ones:

usermod -a -G admin USER

Check for more details for a different case.

share|improve this answer

Important files like the user and group information are backed up. Once you've gained root privileges (by booting into recovery mode for example), compare the current groups file with the backed up one:

diff -u /var/backup/group.bak /etc/group

If the only differences are the mistake, overwrite the contents with:

tee /etc/group < /var/backup/group.bak

Otherwise, manually add yourself to the groups again with:

usermod -a -G admin,group1,group2,... USER
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.