On Sat, 2006-02-18 at 18:59 -0600, rado wrote:
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@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
incidently tho, all I had read up on it, I never did really see or thought to just edit /etc/group but then only in the current (4.2) man useradd did I see mention of the "-a" command for append. Must be some pretty recent new addition I guess.
John