I found this on the net:
http://www.scribd.com/doc/51889769/104/Primary-Versus-Secondary-Groups

One final note on groups is that it is important to understand the
difference between the primary and secondary group.
A user can only be a member of one primary group. The primary group is
the group that any files they create will belong to by default.
However,a user can be a member of multiple secondary groups.The
primary group is the one that is listed in the
/etc/passwd file along with the usersentry. Any other group that the
user is a member of in /etc/group
is considered to be a secondary group.

And apparently a user needs to have a secondary group membership in
group wheel to have sudo powers :)

Mike


On Sat, May 7, 2011 at 6:25 PM, Michael Sioutis <papito....@gmail.com> wrote:
> Thanx a log for your replies :)
>
> I was also using the wrong command for the EXISTING user katia:
> pico@hive:~$ sudo useradd -G guest katia
> useradd: already a `katia' user
>
> Now:
> pico@hive:~$ sudo usermod -G guest katia
> pico@hive:~$ groupinfo guest
> name    guest
> passwd  *
> gid     31
> members root katia
>
> So user 'katia' was in primary and now is in secondary too!
> I can't say I understand the use of primary and secondary.
>
> I remember when I created user 'user' with useradd and entered 'wheel'
> when prompted for the login group,
> I didn't gain any sudo powers. (primary)
> It was only untill I did: usermod -G wheel user that I gained sudo
> powers (sencondary as I understand it).
>
> Mike
>
> On Sat, May 7, 2011 at 6:01 PM, Antoine Jacoutot <ajacou...@bsdfrog.org>
wrote:
>> On Sat, 7 May 2011, Stuart Henderson wrote:
>>
>>> Yes this is expected behaviour. /etc/group lists secondary group
>>> memberships, /etc/passwd (and related files) list the primary groups.
>>>
>>> Most of the tools you're using to investigate group membership
>>> (groupinfo, getent etc) only list secondary groups.
>>>
>>> "id katia" is showing first the primary group (gid=31), and then a
>>> list of all groups this user has permissions for (either primary
>>> or secondary).
>>
>> When you use useradd -g =uid, the primary group is created and the user
>> put into it.
>>
>> # groupadd kiki
>> # useradd kiki
>> # groupinfo kiki
>> name    kiki
>> passwd  *
>> gid     1001
>> members
>>
>> versus
>>
>> # useradd -g =uid kiki
>> # groupinfo kiki
>> name    kiki
>> passwd  *
>> gid     1001
>> members kiki
>>
>> --
>> Antoine

Reply via email to