2

I accidently removed my user name from most of the groups it belonged to. I indeed miswrote sudo usermod -aG agmenor agmenor by forgetting the -a option. I found this question to add myself back to the sudoers group, which I'll do at my next reboot.

But after that, what other groups should I also add my user to? I know it depends largely on the programs I have installed; for example I should belong to debian-tor if I have Vidalia installed. But what are, at least, the groups I should belong to as if I was on a fresh install?

For instance, on another machine, the command groups returns agmenor adm dialout cdrom plugdev lpadmin admin sambashare debian-tor.

Agmenor
  • 16,214

1 Answers1

2

This happened to me 2 weeks ago :)

That's what I get for groups command:

groups
myuser adm lpadmin admin sambashare vboxusers

Here is where I documented my rescue: Restore lost admin group membership

Short description of steps:

Boot up from the LiveCD, it doesn’t have to be the latest distribution, and open a terminal:

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

Note: instead of sda1 you should use the partition on which your root is mounted. If you are not sure about it, check in Disk Utility application (the default one on your liveCD.

Locate the groups:

cd /mnt/etc

The file which holds the groups is simply called groups. But because you have recently changed this file with the wrong command, you need to check the backup file in order to determine which were your old groups, so that you can add them back. The backup file is groups-.

Now, you have 2 options to go forward. The first one is to manually edit the groups file to add your user against the groups (take the back-up file as an example). The second option is to simply re-add the groups to your user with the usermod command. This way you learn the right format of the command:

usermod -aG group user

Cheers

Kevin Bowen
  • 19,615
  • 55
  • 79
  • 83
bioShark
  • 4,251