LinuxQuestions.org
Visit Jeremy's Blog.
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 08-23-2001, 05:28 PM   #1
sancho5
Member
 
Registered: Jul 2001
Location: Utah
Distribution: RedHat v7.3, OpenBSD 3.3, FreeBSD 5.0
Posts: 327

Rep: Reputation: 30
User/Group Management


Hey all,

How can I add users to groups, while keeping thier exising group memberships? I would prefer to be able to do this without a X utility also...
I have tried #usermod -g <username> and find that it changes membership, but I want to add membership, so that the user is a member of multiple groups.
 
Old 08-23-2001, 06:12 PM   #2
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
You can edit /etc/group and just add the users name after other users in the particular groups you want them added to. For instance if you look at /etc/group on your box you will have entries like this:

root:x:0:root
bin:x:1:root,bin,daemon
daemon:x:2:root,bin,daemon
sys:x:3:root,bin,adm
adm:x:4:root,adm,daemon
tty:x:5:
disk:x:6:root

Say you also had a group called "chem" and it looked like this:

chem:x:30:you

and you wanted to add "me" to the group, just add me to the end of the line.

chem:x:30:you,me

That's all there is to it. To verify that the user was added successfully and that the system know this type "groups {username}".
 
Old 08-23-2001, 06:16 PM   #3
sancho5
Member
 
Registered: Jul 2001
Location: Utah
Distribution: RedHat v7.3, OpenBSD 3.3, FreeBSD 5.0
Posts: 327

Original Poster
Rep: Reputation: 30
Cool - thanks! I had seen the #groups <name> command, but forgot it.

What if instead of adding the username to /etc/group, you add the group next to the user in /etc/passwd? will it accomplish the same thing, or nothing at all?
 
Old 08-23-2001, 06:48 PM   #4
d3funct
Member
 
Registered: Jun 2001
Location: Centralia, WA
Posts: 274

Rep: Reputation: 31
It wouldn't have any meaning in /etc/passwd. It would probably just corrupt that entry, maybe the entire file.
 
  


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
How to list user in Linux box, add an user to a group! steady_lfcfan Linux - Newbie 12 01-27-2013 01:14 PM
User and Group Admin: How to tell Who is in What group? Akhran Linux - Newbie 1 11-12-2005 11:16 PM
User and Group Management tinman77 Linux - Newbie 5 12-10-2004 12:46 PM
group management BoldKiller Linux - General 1 05-28-2003 05:35 PM
User/Group Management sancho5 Linux - General 3 09-21-2001 07:22 PM

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

All times are GMT -5. The time now is 06:52 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