usermod returns "group 'thegroupname' does not exist" for known group
15,036
I was trying to add a local user to an Active Directory group. This is not allowed.
Related videos on Youtube
Author by
Louis Waweru
Updated on September 18, 2022Comments
-
Louis Waweru over 1 year
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 ofgroups myusername
. I'm not sure if that information is helpful as it still shows me as not belonging to the test group whilegroups myusername
does.$ groups myusername sudo users
-
terdon almost 9 yearsI suppose that creating a new group and adding your user to it does work as expected right? It's only
thisgroupname
that fails? -
Louis Waweru almost 9 years@terdon I'm not sure. I could use
usermod
but notgroupadd
. I've updated the question based on your feedback. -
Louis Waweru almost 9 years@terdon reading that again, it seems the answer to your question is "yes".
-
terdon almost 9 yearsHmm. Strange. Could you fix the typo you where
groupadd
prints auseradd
error message (2nd code line in your edit)? -
Louis Waweru almost 9 years@terdon Doh, I overlooked something obvious trying to add a local account to an Active Directory group. If you want to post that in an answer, feel free! Thanks for your troubleshooting.
-
terdon almost 9 yearsHuh? You mean the issue was thta you were running
sudo useradd testgroup
instead ofgroupadd
? If so, lol, and nah, not worth posting an answer, just delete it. It's unlikely to help anyone else.
-