LinuxQuestions.org
Help answer threads with 0 replies.
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 12-20-2011, 07:49 AM   #1
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Rep: Reputation: 77
Locate Users In A Specific Group


I've got a Linux server with ~200 user accounts on it. At one point accounts were genricly being created and their primary group (GID) was "users". Since I've taken over, I've created appropriate groups for users but my question is, how can I create a file w/ all the users on the system in /etc/passwd who have a primary GID of "users"?
 
Old 12-20-2011, 08:13 AM   #2
droyden
Member
 
Registered: Feb 2007
Location: UK
Posts: 150

Rep: Reputation: 19
grep users /etc/group
 
Old 12-20-2011, 08:44 AM   #3
carlosinfl
Senior Member
 
Registered: May 2004
Location: Orlando, FL
Distribution: Arch
Posts: 2,905

Original Poster
Rep: Reputation: 77
Woops. There is nothing listed as "users" so I had to grep for the GUI "100" and that worked. Just had to trim out the one UID that was "100".
 
Old 12-20-2011, 11:38 AM   #4
guna_pmk
Member
 
Registered: Sep 2008
Posts: 220

Rep: Reputation: 5
Try this

Code:
getent passwd | grep $(grep user /etc/group | cut -d: -f3) | cut -d: -f1
Cheers
 
  


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



Similar Threads
Thread Thread Starter Forum Replies Last Post
To locate process which is deleting some specific file dhiraj4mann Linux - Security 8 07-04-2010 11:36 PM
Secondary group users need to change the file permissions of primary group files? sunnybmv Linux - Newbie 3 12-10-2009 04:57 PM
Locate Members of a Group? carlosinfl Linux - General 6 09-05-2008 02:26 PM
How to make a specific command(s) work for specific users or group only naren_0101bits Linux - General 3 08-28-2005 05:22 PM

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

All times are GMT -5. The time now is 11:52 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
Open Source Consulting | Domain Registration