- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- which users in a group?
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:09 AM
06-15-2007 03:09 AM
how can I get from command line the users belonging to a group??
thanks
Enrico
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:12 AM
06-15-2007 03:12 AM
Re: which users in a group?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:15 AM
06-15-2007 03:15 AM
Re: which users in a group?
I meant: some commands giving a list of users, and not just a string like dba::202:bmml,alcatel,snml ...
I'd prefere as output:
bmml
alcatel
snml
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:23 AM
06-15-2007 03:23 AM
Re: which users in a group?
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:32 AM
06-15-2007 03:32 AM
Re: which users in a group?
use the 'groups' command:
groups : my groups I am member at
groups usernam
see 'man groups'
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:36 AM
06-15-2007 03:36 AM
Re: which users in a group?
Here's another approach that will list:
User
#!/usr/bin/sh
logins | awk '{print $1}' | while read U
do
echo "${U}\t\c"
groups -l ${U} | while read G
do
echo "${G}\c"
done
echo
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:37 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:51 AM
06-15-2007 03:51 AM
Re: which users in a group?
What about:
grep
All the best
Victor
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 03:55 AM
06-15-2007 03:55 AM
Re: which users in a group?
just realized, what you really want.
From a CLI sight of view, it depends which name resolution is set in ns_switch.conf: files, NIS, ...
It seems not deifficult to me. to modify my NIS-example for other resolution types:
(ypmatch GRPNAM group.byname; ypcat passwd) |
awk -F: 'NR==1 {group=$1;gid=$3;i=split($4,grp,",");next}
$4==gid {grp[++i]=$1}
END {if(i) {for(j=1;j<=i;j++) print grp[j]}}'
mfG Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 04:06 AM
06-15-2007 04:06 AM
Re: which users in a group?
do
echo $a
done
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-15-2007 04:18 AM
06-15-2007 04:18 AM
Re: which users in a group?
just do a long listing or grep for the group.
ll /etc/groups
grep group name /etc/groups
sp,