'pw usermod -G' not removing user from group?

Matthew Pherigo hybrid120 at gmail.com
Wed Mar 25 15:49:28 UTC 2015


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 from any groups not specified in grouplist.

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

This isn't the end of the creative liberties, though. When checking /etc/group, 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 tripping over this strange behavior.

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

Thanks,
--Matt


More information about the freebsd-questions mailing list