LinuxQuestions.org
Register a domain and help support LQ
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices

Reply
 
Search this Thread
Old 11-11-2005, 09:43 AM   #1
emanresu
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 76

Rep: Reputation: 15
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
 
Old 11-11-2005, 09:58 AM   #2
homey
Senior Member
 
Registered: Oct 2003
Posts: 3,057

Rep: Reputation: 56
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.
 
Old 11-11-2005, 10:42 AM   #3
stimpsonjcat
Member
 
Registered: Apr 2005
Location: switzerland
Distribution: debian etch
Posts: 99

Rep: Reputation: 15
Re: how to add a user to a new group?

first, create the video group

#addgroup video

then,

#adduser emanresu video
 
Old 11-20-2005, 06:38 PM   #4
emanresu
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 76

Original Poster
Rep: Reputation: 15
the -a option doesn't seem to be available on my machine.
 
Old 11-20-2005, 07:35 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
You could edit the /etc/group file. Add the user to the end of the line that begins with the the word "video".
 
Old 11-21-2005, 08:18 AM   #6
emanresu
Member
 
Registered: Apr 2004
Distribution: Gentoo
Posts: 76

Original Poster
Rep: Reputation: 15
here is the solution:

Code:
gpasswd -a  <username> <groupname>
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
add user to the group ashley75 Linux - General 4 03-30-2005 02:42 PM
add user to group brandnewbie Linux - Newbie 3 08-08-2004 04:53 PM
how do i add user to a group jogurt666 Linux - General 2 04-02-2004 10:05 PM
how to add a user to a certain group? feetyouwell Linux - Software 2 01-13-2004 11:56 AM


All times are GMT -5. The time now is 03:19 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration