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?


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.

| improve this answer | |
  • 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 '11 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 '11 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 '11 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:


| improve this answer | |
  • 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 '11 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 '12 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.