Users, groups and directory access

A.J. Bonnema abonnema at xs4all.nl
Wed May 5 13:48:57 UTC 2004


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.

Guus.
-- 
A.J. Bonnema, Leiden The Netherlands,
user #328198 (Linux Counter http://counter.li.org)





More information about the users mailing list