LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-08-2003, 04:23 PM   #1
ALF
Member
 
Registered: Oct 2002
Posts: 32

Rep: Reputation: 15
Adding new group to existing user


Hi,

I want to add more than one group to existing user, what command should I use?

Thanks

Alf
 
Old 07-08-2003, 04:29 PM   #2
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
usermod

See
man usermod
info usermod
 
Old 07-08-2003, 04:40 PM   #3
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
FYI, You can also just add them to the group by editing /etc/group
 
Old 07-08-2003, 05:00 PM   #4
ALF
Member
 
Registered: Oct 2002
Posts: 32

Original Poster
Rep: Reputation: 15
usermod works perfect, but it wouldn't let me add more than one group in the same command

usermod oracle -G oracle, dba

wouldn't work, I have to do it in two steps

usermod oracle -G oracle

then

usermod oracle -G dba

why is that?

Alf
 
Old 07-08-2003, 05:14 PM   #5
fancypiper
LQ Guru
 
Registered: Feb 2003
Location: Sparta, NC USA
Distribution: Ubuntu 10.04
Posts: 5,141

Rep: Reputation: 58
From man usermod:
Code:
       -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
Can you figure out what you did wrong now?
 
0 members found this post helpful.
Old 07-08-2003, 05:15 PM   #6
trickykid
LQ Guru
 
Registered: Jan 2001
Posts: 24,149

Rep: Reputation: 256Reputation: 256Reputation: 256
What's the errors you get? Make sure the group actually exists as well.
 
Old 07-08-2003, 05:28 PM   #7
slizadel
LQ Newbie
 
Registered: Jun 2003
Distribution: RH9, Gentoo, Slack
Posts: 23

Rep: Reputation: 15
Looking at the code that you used
Quote:
usermod oracle -G oracle, dba
it looks like you have a space between the comma and dba. I could be wrong, but I think that you have to omit whitespace.
 
Old 05-08-2006, 10:35 PM   #8
jmtag23
LQ Newbie
 
Registered: May 2006
Posts: 1

Rep: Reputation: 0
Wink

The correct syntax is

usermod -G <group> <user>

or

usermod -G <group>,<group> <user>
 
  


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
adding user to group ryancoolest Linux - Newbie 9 04-14-2008 01:50 PM
adding user to wheel group tied2 *BSD 10 09-28-2007 05:22 AM
after adding user to group peter72 Linux - General 2 08-01-2005 11:17 AM
adding user to a group Chilipepa Linux - Newbie 2 09-27-2003 12:08 PM
add root user to the existing group ashley75 Linux - General 4 09-25-2003 10:40 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:06 AM.

Main Menu
Advertisement
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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration