|
Home > Archive > Unix administration > January 2004 > Specify more than 1 supplementary group for a user ??
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Specify more than 1 supplementary group for a user ??
|
|
|
|
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 ?
| |
| Finnbarr P. Murphy 2004-01-23, 5: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
| |
| those who know me have no need of my name 2004-01-23, 5: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
|
|
|
|
|