-   Linux - Newbie (
-   -   how to add a user to a new group? (

emanresu 11-11-2005 10:43 AM

how to add a user to a new group?
Hi all,

this is really a newbie question, but how do I add a user to a new group? For example, I have this user account "john" that is already part of the following groups:

users adm audio wheel

now, I need to add him into the group "video". But if I use "usermod -G", I need to retype all the existing groups. Is there an easier way to just add the new group on top of the existing one? Thanks.

-- eman

homey 11-11-2005 10:58 AM

From the ( man usermod ), try it with -a

-G group1[ ,group2,..., [groupN]]]
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.

stimpsonjcat 11-11-2005 11:42 AM

Re: how to add a user to a new group?
first, create the video group

#addgroup video


#adduser emanresu video

emanresu 11-20-2005 07:38 PM

the -a option doesn't seem to be available on my machine.

jschiwal 11-20-2005 08:35 PM

You could edit the /etc/group file. Add the user to the end of the line that begins with the the word "video".

emanresu 11-21-2005 09:18 AM

here is the solution:


gpasswd -a  <username> <groupname>

All times are GMT -5. The time now is 07:54 AM.