Adding a user to a group | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

Adding a user to a group

UNIX for Dummies Questions & Answers


Tags
linux

Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 11-13-2003
TRUEST TRUEST is offline
Registered User
 
Join Date: Jan 2002
Last Activity: 6 June 2005, 1:17 AM EDT
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
Adding a user to a group

Now, its been a while since i done this but I had to add a user to a group. I did that by using the usermod command and now when I superuser to the user's account and issue a "id", i get the desired gid.


i mean, output of id indicated the user is assigned to the group i want him to be in. also when I superuser to the users account and issued the "groups" command, the desired group name is displayed.

now, my question is, although every output of all the commands I typed indicated that this user now belongs to the group i want him to belong to, how come when i do a cat /etc/group | grep groupname, i do not see the user's name in the list of allowed users???

am i doing something wrong here???
Sponsored Links
    #2  
Old 11-13-2003
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon (Administrator Emeritus)
 
Join Date: Aug 2001
Last Activity: 28 October 2014, 3:35 PM EDT
Location: Ashburn, Virginia
Posts: 9,930
Thanks: 64
Thanked 437 Times in 261 Posts
The default gid is in /etc/passwd and that is what you changed. This may or may not have been an error. Did you want the user to retain membership in his old group? A user can be a member of several groups at once by adding him into various lines in /etc/group. It all depends on what you really want.

And hp-ux is a little odd here, but I seem to rememeber that you use sunos.
Sponsored Links
    #3  
Old 11-14-2003
kduffin's Avatar
kduffin kduffin is offline Forum Advisor  
UN1X
 
Join Date: Nov 2003
Last Activity: 21 January 2014, 4:03 PM EST
Location: Belize
Posts: 484
Thanks: 0
Thanked 3 Times in 2 Posts
If you want to set the default group (ie, what's in /etc/passwd) and set the supplemental group memberships (ie, what's in /etc/group), you can do something like the following:

usermod -g users -G apps,sysadmin kduffin

Cheers,

Keith

Last edited by kduffin; 11-17-2003 at 09:42 PM..
    #4  
Old 11-14-2003
TRUEST TRUEST is offline
Registered User
 
Join Date: Jan 2002
Last Activity: 6 June 2005, 1:17 AM EDT
Posts: 144
Thanks: 0
Thanked 0 Times in 0 Posts
what am saying is this

when you do a cat /etc/group | grep (desire groupname)
you should get an output similar to this:

groupname::45:james,lola,jerry

the last names james, lola and jerry belong to the group called groupname.

my questions is, how come after using the usermod to change the group of my user, how come his name does not appear in the /etc/group as being a member of the group???

i mean if i added the user to the group called groupname, i would expect the damn username to be added right behind jerry. right???
Sponsored Links
    #5  
Old 11-14-2003
jsilva's Avatar
jsilva jsilva is offline
Registered User
 
Join Date: Apr 2003
Last Activity: 28 July 2010, 3:08 PM EDT
Posts: 169
Thanks: 0
Thanked 2 Times in 1 Post
Hi,

Like Perderabo said, you are only changing your default group, and that information is on /etc/passwd on most unix systems, not on /etc/group. If you default group is "other", you wont see your userid in front of other: line on /etc/group.
Your userid will be on /etc/group if you belong to more that one group or if your user has a group for himself ( like seen on linux distributions ).
Sponsored Links
    #6  
Old 11-14-2003
Jody Jody is offline
Registered User
 
Join Date: Sep 2002
Last Activity: 7 September 2012, 2:43 PM EDT
Location: Nashville, TN
Posts: 72
Thanks: 0
Thanked 0 Times in 0 Posts
Why don't you just go into /etc/passwd and /etc/group to make the changes you want?
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Adding a user to a group bigben1220 Shell Programming and Scripting 4 03-05-2010 02:28 AM
Adding User to group saurabh84g Solaris 2 11-22-2008 12:20 PM
Log off mandatory after adding a user to a group to take effect? sirbijan BSD 1 10-09-2008 05:57 AM
Adding user to a group without SAM paqman HP-UX 2 08-15-2007 07:05 AM
Adding root user to a group The Specialist UNIX for Dummies Questions & Answers 7 10-28-2005 10:09 PM



All times are GMT -4. The time now is 01:31 PM.