3

Running Xubuntu 16.04

Made a newbie mistake; while I was adding my own account to the 'wireshark' group so I can start wireshark without using sudo, I've removed myself from all the other groups I was in, including sudo.

I used this command:

sudo usermod -G wireshark my_user_account

I'm thinking I forgot the -a before the -G?

Does anyone know how to view the history of a user as it relates to group membership. Or view a group history as it relates to user membership?

Just trying to get my user back into the groups it was in before I had a brainfart.

Zanna
  • 70,465

1 Answers1

1

I booted into single-user mode by editing Grub to:

  1. make the filesystem rw instead of ro, and
  2. adding init=/bin/bash at the end of the line.

After that I was able to add myself back into the sudo group using:

usermod -aG sudo my_user_account

I then rebooted back into "normal" mode. Ran sudo grep group /var/log/auth.log and was able to see the command I ran that removed me from my groups, and it listed the groups I was removed from.

I went through each of them again doing sudo usermod -aG _group_ my_user_account.

Once I did that, I logged out and logged back in and everything seems to be back to normal. Hope this helps someone else who made the same mistake I did.

You'd think after 16 years of using Linux, I wouldn't make boneheaded mistakes like this, but apparently not...

Eliah Kagan
  • 117,780
  • That's why commands like adduser exist. adduser user group is far more convenient and safer than usermod -aG. – muru Oct 04 '17 at 09:13