6

As a member of sudo can I add myself to a group I don't belong to?

$ getent group thegroupname 
thegroupname:x:123794798:administrator,users,auser,moreusers,manymoreusers

$ sudo usermod -a -G thegroupname myusername
usermod: group 'thegroupname' does not exist

When I run the above I can't add myself to the group. The error message says the group doesn't exist, but it does.

Here I'll make a new group as per @terdon's comment.

$ sudo groupadd testgroup
useradd: user 'myusername' already exists
$ groups
myusername sudo users

$ getent group testgroup
testgroup:x:01234:


$ sudo usermod -a -G testgroup myusername
$ groups myusername
myusername : myusername sudo users testgroup

Sorry for the typo with just using groups instead of groups myusername. I'm not sure if that information is helpful as it still shows me as not belonging to the test group while groups myusername does.

$ groups
myusername sudo users
Louis Waweru
  • 25,409
  • 45
  • 137
  • 203

1 Answers1

2

I was trying to add a local user to an Active Directory group. This is not allowed.

Louis Waweru
  • 25,409
  • 45
  • 137
  • 203