Specify more than 1 supplementary group for a user ??
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix administration > Specify more than 1 supplementary group for a user ??




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    Specify more than 1 supplementary group for a user ??  
noone


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:11 PM


Whenever I do:

usermod -G groupname username

.... any existing supplementary group of username, as shown from
/etc/group, gets removed and the new one added.

man usermod says:

-G group
Specify an existing group's integer "ID" "," or  char-
acter  string name. It redefines the user's supplemen-
tary group membership. Duplicates between  group  with
the  -g and
-G options are ignored.  No  more  than  NGROUPS_UMAX
groups may be specified as defined in  <param.h>.


So I assume NGROUPS_UMAX is set to 1 ?


Is it alright then to just directly modify /etc/group so that the
username is in more than one supplementary group ?







[ Post a follow-up to this message ]



    Re: Specify more than 1 supplementary group for a user ??  
Finnbarr P. Murphy


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:11 PM

noone <noone@noone.org> wrote in message news:<9zoKb.79333$aT.58320@news-server.bigpond.net.au>...
quote:
> Whenever I do: > > usermod -G groupname username > > .... any existing supplementary group of username, as shown from > /etc/group, gets removed and the new one added. > > So I assume NGROUPS_UMAX is set to 1 ? > > > Is it alright then to just directly modify /etc/group so that the > username is in more than one supplementary group ?
You did not specify your particular flavor of Unix. However usermod usually accepts one or more groups for the -G option as in [ -G group [, group ...]] and then does a replacement operation i.e. replaces all existing supplementary groups with the specified supplementary group(s). It does not incrementally all supplementary groups. - Finnbarr




[ Post a follow-up to this message ]



    Re: Specify more than 1 supplementary group for a user ??  
those who know me have no need of my name


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-23-04 10:11 PM

in comp.unix.admin i read:
quote:
>Whenever I do: > > usermod -G groupname username > >.... any existing supplementary group of username, as shown from >/etc/group, gets removed and the new one added.
naturally, exactly as your documentation says will happen ...
quote:
> -G group > Specify an existing group's integer "ID" "," or char- > acter string name. It redefines the user's supplemen- > tary group membership.
i.e., it specifies the group list, replacing whatever is current.
quote:
>Is it alright then to just directly modify /etc/group so that the >username is in more than one supplementary group ?
that's one way. be sure you aren't editing the file while others are doing so, otherwise you'll have a `last writer wins' result, i.e., your changes may disappear. your system may have a `vigr' command which performs simple locking to prevent such from happening. another way is to enumerate the current list and append the new group so that usermod can be presented with a list with which i wants to work and you get the result you want, e.g., # usermod -G `id -G $user | tr ' ' ,`,$addgroup $user -- a signature




[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 06:46 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register