LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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-05-2008, 12:29 PM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Question Locate Members of a Group?


I am trying to remove the "users" group and it tells me I can't remove someones primary group however when I check /etc/group, I show nobody's name next to the GID. Is there a command I can run that will tell me all the members of the specific GID or how can I check who is a member of this group?

Thanks!
 
Old 09-05-2008, 01:58 PM   #2
sin0nyx
LQ Newbie
 
Registered: Aug 2008
Distribution: Gentoo, Fedora, CentOS, Ubuntu
Posts: 15

Rep: Reputation: 0
A users primary group is set in the /etc/passwd file. It is the fourth entry and listed numerically. To delete the group you will first need to delete the user or change their primary group.


# grep test /etc/passwd
test:x:506:65534::/:/bin/bash
# grep 65534 /etc/group
nogroup:x:65534:
 
Old 09-05-2008, 02:03 PM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Something is wrong here...

Code:
[root@lt2fs3 /]# grep users /etc/passwd
[root@lt2fs3 /]# cat /etc/passwd | grep users
[root@lt2fs3 /]# cat /etc/group | grep users
users:x:508:
[root@lt2fs3 /]# groupdel users
groupdel: cannot remove user's primary group.
 
Old 09-05-2008, 02:12 PM   #4
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
If you take a look in the /etc/passwd file, you will see that none of the groups are listed by name, only by GID. Try grepping for '508' through your passwd file, as that seems to be the GID of your 'users' group.
 
Old 09-05-2008, 02:16 PM   #5
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
OK that makes sense. For some reason when I look for 508 in /etc/passwd, I find a boat load of accounts with gid of 508. Not sure why they don't show up on /etc/group under the users section. Is it safe to modify the /etc/passwd file by hand?
 
Old 09-05-2008, 02:23 PM   #6
Poetics
Senior Member
 
Registered: Jun 2003
Location: California
Distribution: Slackware
Posts: 1,181

Rep: Reputation: 49
If you are just looking to adjust their primary group (make sure to have them in at least one group), it shouldn't be an issue to edit them manually, though there's likely some command-line tool for doing just that if you don't want to get your hands dirty in /etc/passwd

Personally I've never had a problem with it.
 
Old 09-05-2008, 02:26 PM   #7
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
I just opened vim and ran:

:%s/508/100/g

The above replaced all 508 groups with 100 GID and then I saved it and removed the group. Thanks all!
 
  


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 all members of a group bg108 Linux - Newbie 12 11-24-2013 03:26 AM
Listing the members of a group armandino Linux - General 5 06-24-2007 06:43 PM
listing the members of a group bondoq Linux - Server 3 02-25-2007 05:10 PM
winbind: group members? eantoranz Linux - Software 0 11-01-2005 08:47 AM
Group members and rights EERookie Linux - Newbie 0 06-03-2004 08:19 AM

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

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