I followed bad instructions and left the -a out of:

usermod -a -G wireshark ak

Now all of my groups have been lost, including sudo permissions:

$ groups
ak wireshark

If I understand correctly, I should be able to fix this by booting to the recovery option in GRUB, but I'm not sure what groups need to be added back.

Where can I check to find out what groups I used to be in?

  • mine shows adm dialout cdrom plugdev lpadmin admin sambashare. It might be a start to get it fixed.
    – Rinzwind
    Jul 24, 2011 at 17:39
  • 1
    once you are in the admin group you can add any other groups you need - look like this guy here had the same issue - ccollins.wordpress.com/2007/07/02/restore-default-ubuntu-groups
    – fossfreedom
    Jul 24, 2011 at 17:45
  • put it in as an answer @fossfreedom and we can vote on it ;)
    – Rinzwind
    Jul 24, 2011 at 17:55

2 Answers 2


In a standard Ubuntu installation there's a groups config backup file in /var/backups/group.bak. So (from a root recovery console) you could do something like

grep <your_username> /var/backups/group.bak

to list all groups you used to be in.

EDIT: as Lekensteyn rightly pointed out, it would be better to use the /etc/group- backup file, not the /var/backups/group.bak one.

  • 2
    The previous version is stored in /etc/group-. On my system, /var/backups/group.bak is the same as /etc/group which indicates that /var/backups/group.bak is really a backup of /etc/group.
    – Lekensteyn
    Jul 24, 2011 at 20:37
  • @Lekensteyn: You're right. group.bak is (after a cron.daily job is run) the backup of /etc/group. The /etc/group- is a better option. I suggest you make your comment an answer.
    – arrange
    Jul 24, 2011 at 20:56
  • your answer is nearly complete and remembered me on the existence of /etc/group-. Feel free to include my comment in your answer ;)
    – Lekensteyn
    Jul 24, 2011 at 21:03

To recover you will need to boot from a live CD.

Mount the root partition (/).

e.g. if your root partition is on /dev/sda1

sudo mount /dev/sda1 /mnt
sudo chroot /mnt

Then edit the /etc/group file and add the admin group to yourself

cd /mnt/etc/
sudo nano group

find the admin group and add your user-id e.g. for me it would look like admin:x:121:fossfreedom

Save and Reboot. You should be able to use sudo and su again. You can then use Users and Groups to add in any groups you require:


  • This doesn't answer my question of where I can check to find out what groups I used to be in.
    – ændrük
    Jul 25, 2011 at 15:47
  • @fossfreedom Excellent. Thanks, you just saved me a lot of time and headache. Due to my own stupidity I removed myself from admin group. Your solution above saved the day, and I learned quite a few things in the process.
    – bioShark
    Feb 9, 2012 at 23:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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