A.J. Bonnema wrote:
Matthew Miller wrote:
On Wed, May 05, 2004 at 03:30:07AM -0500, David L Norris wrote:
# root can change john's group membership like this usermod -G proj john
This is bad because it *replaces* the current list of groups. If john was
previously a member of 'staff' or 'proj2', that would be removed. This is
why gpasswd -a is usually better.
Thanks for allerting me to this detail!
Yes, well I can confirm, although it doesn't work as I expected after reading the man-page.
The primary group is never deleted (the man-page only mentions that groups not listed will be deleted, which appears not to be true for the primary group.
If you add the primary group using 'usermod -G' then all secondary groups are deleted from this user.
If you add a secondary group, that is new to this user, the old secondary groups are all deleted (from this user). The primary group remains in effect.
If the utilities are not working as you want, just edit the /etc/group file and manually make the changes.
Fall back to the old standby editor and the way it used to be done.
Guus.