Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 25 Mar 2015 10:49:22 -0500
From:      Matthew Pherigo <hybrid120@gmail.com>
To:        FreeBSD Users <freebsd-questions@freebsd.org>
Subject:   'pw usermod -G' not removing user from group?
Message-ID:  <474FEC65-4E15-4972-A411-E91569B4E2A5@gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all,

The manpage for pw(8) says this about the -G flag:
> The user's name is added to the group lists in /etc/group, and removed fro=
m any groups not specified in grouplist.

However, when using this option on 10.1, pw decides to get creative:
> $ sudo id -a test
> uid=3D1003(test) gid=3D1003(test) groups=3D1003(test),0(wheel),69(network)=

> $ sudo pw usermod test -G network
> $ sudo id -a test               =20
> uid=3D1003(test) gid=3D1003(test) groups=3D1003(test),0(wheel),69(network)=


This isn't the end of the creative liberties, though. When checking /etc/gro=
up, we find:
> network:*:69:test,test

pw(8) has added the 'test' user to the network group *twice*. In fact, when I=
 was checking the /etc/group file, I found this little gem:
> wheel:*:0:root,ansible,matt,matt,matt,test

That trio of matts is the result of configuration management systems trippin=
g over this strange behavior.

Was this introduced in a recent patch? I can't imagine this has been around f=
or long. Hopefully it's just a doc error!

Thanks,
--Matt=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?474FEC65-4E15-4972-A411-E91569B4E2A5>