LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 09-14-2006, 12:04 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Question Usermod


Yesterday my user name "carlwill" was a part of 2 groups on this server (RHEL4).

"ctia" & "wheel"

I created a new group on the server called "ctia_admin" with specific read/write access to folders.

I then gave the following command:

Code:
#usermod -G ctia_admin cwilliams
Now I am no longer a member of wheel. I am now a member of ctia & ctia_admin. Why did this command not add a 3rd group rather than replace my wheel group. I could not for the life of me understand why I no longer had sudo access.

I did "man" the usermod page and am still confused.

Thanks!
 
Old 09-14-2006, 03:17 PM   #2
mcmillan
Member
 
Registered: Jul 2005
Distribution: Arch
Posts: 489

Rep: Reputation: 30
usermod -G changes the groups so your only part of the groups you specify. A better command to use is adduser <name> <group>
 
Old 09-14-2006, 03:24 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Quote:
Originally Posted by mcmillan
A better command to use is adduser <name> <group>
I am not sure if "adduser" would be good considering the user already exist on the system. I would just be modifying their groups and not adding an entire new person to the system unless I am misunderstanding you...
 
Old 09-14-2006, 04:35 PM   #4
mcmillan
Member
 
Registered: Jul 2005
Distribution: Arch
Posts: 489

Rep: Reputation: 30
Sorry about that. I knew there was a different command from usermod that doesn't remove all the preexisting groups, but I gave the wrong one. gpasswd was the one I was thinking of. It's used gpasswd -a <user> <group>
 
Old 09-14-2006, 06:53 PM   #5
fudam
Member
 
Registered: Feb 2006
Distribution: FC
Posts: 86

Rep: Reputation: 15
Or quite simply edit /etc/group as root. Much easier to remember and manage IMO.
 
Old 09-14-2006, 08:23 PM   #6
JrLz
Member
 
Registered: Mar 2004
Location: Jakarta
Posts: 164

Rep: Reputation: 30
Quote:
Originally Posted by 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
you need to list all of the groups(wheel,ctia,etc) for that user in usermod -G parameters, and put the user's initial group with -g parameter
 
Old 09-15-2006, 07:32 AM   #7
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
So just to avoid confusion, can you post an example of how this scenario would look.

User = Jim
Group(s) = ctia wheel

Jim needs to also be a member of admin so in total Jim will be a member of ctia wheel admin

How would this command look?
 
Old 09-15-2006, 01:26 PM   #8
mcmillan
Member
 
Registered: Jul 2005
Distribution: Arch
Posts: 489

Rep: Reputation: 30
To use usermod -G ctia_admin,wheel,ctia cwilliams

gpasswd would be gpasswd -a cwilliams ctia_admin for what you originally wanted, just adding the group. Since now you're just missing wheel it would be gpasswd -a cwilliams wheel.

As for directly editing the files, I don't remember the syntax and I'm currently on windows and trying to figure out how to get my wireless working on Linux so I'm not much help right now.
 
Old 09-19-2006, 08:26 PM   #9
JrLz
Member
 
Registered: Mar 2004
Location: Jakarta
Posts: 164

Rep: Reputation: 30
Quote:
Originally Posted by Carlwill
So just to avoid confusion, can you post an example of how this scenario would look.

User = Jim
Group(s) = ctia wheel

Jim needs to also be a member of admin so in total Jim will be a member of ctia wheel admin

How would this command look?
usermod -g admin -G admin,ctia,wheel Jim
with admin as the initial group, ctia and wheel supplementary groups
Jim will be a member of admin,ctia and wheel
you can check it by using id command, or groups command (as Jim)

files to edit are /etc/passwd(note the GID there) and /etc/group
 
  


Reply



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 On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
command usermod not found bowie101 Linux - Newbie 12 08-18-2021 01:26 AM
usermod and groupadd meDream Linux - Newbie 0 10-05-2005 05:01 AM
usermod / useradd ? bibilit Linux - Software 1 12-19-2003 02:16 AM
usermod shanenin Linux - Software 4 12-08-2003 08:49 AM
usermod thelight1 Linux - Newbie 1 07-24-2003 12:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 03:26 PM.

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
Open Source Consulting | Domain Registration