[CentOS] the correct way to add users to another group???

Sun Feb 19 00:59:23 UTC 2006
rado <rado at rivers-bend.com>

> > I want to add a user to another group w/out removing the groups the user
> > already belongs to.
> >
> > in man usermod:
> >       -G group,[...]
> >               A  list of supplementary groups which the user is also
> > a member of.  Each group is separated from the next by a comma, with  no
> >               intervening  whitespace.   The  groups  are subject to the
> > same restrictions as the group given with the  -g  option.   If  the
> >               user  is currently a member of a group which is not
> > listed, the user will be removed from the  group.  This  behaviour  can
> > be changed  via  -a option, which appends user to the current
> > supplementary group list.
> >
> > ok...I kinda get this but unclear of the exact format and I am super
> > fearful of ripping up my userbase.
> >
> > Here is what I think it should be:
> >
> > # usermod <user> -a -G <group> 
> >
> > where the user's name is say..."pete" and I want him to be added to the
> > group "tech":
> >
> > # usermod pete -a -G tech
> >
> > Say pete is already in groups ummm, sales,admin, and help. After
> > administering the above command, would pete still be in sales,
> > admin,help, and now tech? I am interested in the simplest, correct way
> > to do this.
> >
> > thx,
> >
> > John Rose
> >
> > _______________________________________________
> > CentOS mailing list
> > CentOS at centos.org
> > http://lists.centos.org/mailman/listinfo/centos
> >
> >   
> 
> The command should be
> # usermod -G <group1,group2...> <username>
> When doing it this way you need to specify ALL the groups the user 
> belongs to as this does not append to the current list. So to get a list 
> of groups a user may be associated with type
> # groups <username>
> Then take the output to be used with usermod command. Or you can just 
> edit the /etc/groups file by hand
> 
> Zeb

ok, thx, Zeb! sure works for me

John
> _______________________________________________
> CentOS mailing list
> CentOS at centos.org
> http://lists.centos.org/mailman/listinfo/centos