Sponsored Content
Full Discussion: members in a group
Operating Systems Linux members in a group Post 302198113 by era on Thursday 22nd of May 2008 08:28:24 AM
Old 05-22-2008
On my Linux at least, groups era prints which groups I am a member of.
 

8 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

listing members of a unix group

I know there is a "groups" command to list the groups a user belongs to, but how about the opposite? Is there a standard command to find out which users belong to a particular group? (2 Replies)
Discussion started by: ovaska
2 Replies

2. Solaris

make issue when I add some members into a NIS group on solaris 9,please help !!

Hello Sir, I want to add some members into a group on NIS domain, but when I run "/usr/ccs/bin/make group" to update the group map it was failed :-( the error message is : problem storing develop... (4 Replies)
Discussion started by: lk74612
4 Replies

3. Programming

allowing members of a group to kill a process

I've written a python program where I want to allow members of a specific group the ability to kill it, and I'm not sure how to do it. I've been looking at the setuid() and setgid() and similar functions in the os module, but haven't been able to get them to work. I can't seem to change the uid or... (1 Reply)
Discussion started by: vastcharade
1 Replies

4. Shell Programming and Scripting

How to get a list of group members?

Is there a command to get a list of group members? Something similar to the groups command, but instead of passing a username and returning groups, you pass it a groupname, and it returns members? It is difficult to do it manually because the group membership information is split across two... (5 Replies)
Discussion started by: akbar
5 Replies

5. AIX

How to allow group members to kill process?

Hey I'm writing a script that creates some processes,and some scripts which kill those processes. the question is Simply: How can I allow group members to be able to kill processes created by other member at the same group? I need your help as soon as possible Thanks for your help in... (4 Replies)
Discussion started by: The Dark Knight
4 Replies

6. Solaris

How to list group members in solaris 9

Hi, I already gone through with old post regarding listing the group members and tried the command getenv group other the result is other::1:root i listed my part of the /etc/passwd file below test1:x:100:1::/home/test1:/bin/sh test2:x:101:1::/home/test2:/bin/ksh... (7 Replies)
Discussion started by: vr_mari
7 Replies

7. Shell Programming and Scripting

need a one liner to grep a group info from /etc/group and use that result to search passwd file

/etc/group tiadm::345:mk789,po312,jo343,ju454,ko453,yx879,iy345,hn453 bin::2:root,daemon sys::3:root,bin,adm adm::4:root,daemon uucp::5:root /etc/passwd mk789:x:234:1::/export/home/dummy:/bin/sh po312:x:234:1::/export/home/dummy:/bin/sh ju454:x:234:1::/export/home/dummy:/bin/sh... (6 Replies)
Discussion started by: chidori
6 Replies

8. UNIX for Advanced & Expert Users

Setfacl and granting permissions to a group and its members on a directory

Hi! I created a group HACKERS and made the user "demo" its member. $ id demo uid=500(demo) gid=500(demo) groups=500(demo),502(HACKERS) $ Next, I granted read and execute permissions to the group "HACKERS" on /var/log/httpd as shown below: setfacl -m "g:HACKERS:r-x"... (2 Replies)
Discussion started by: indiansoil
2 Replies
GETGROUPLIST(3) 					     Linux Programmer's Manual						   GETGROUPLIST(3)

NAME
getgrouplist - get list of groups to which a user belongs SYNOPSIS
#include <grp.h> int getgrouplist(const char *user, gid_t group, gid_t *groups, int *ngroups); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): getgrouplist(): _BSD_SOURCE DESCRIPTION
The getgrouplist() function scans the group database (see group(5)) to obtain the list of groups that user belongs to. Up to *ngroups of these groups are returned in the array groups. If it was not among the groups defined for user in the group database, then group is included in the list of groups returned by getgrou- plist(); typically this argument is specified as the group ID from the password record for user. The ngroups argument is a value-result argument: on return it always contains the number of groups found for user, including group; this value may be greater than the number of groups stored in groups. RETURN VALUE
If the number of groups of which user is a member is less than or equal to *ngroups, then the value *ngroups is returned. If the user is a member of more than *ngroups groups, then getgrouplist() returns -1. In this case the value returned in *ngroups can be used to resize the buffer passed to a further call getgrouplist(). VERSIONS
This function is present since glibc 2.2.4. CONFORMING TO
This function is nonstandard; it appears on most BSDs. BUGS
In glibc versions before 2.3.3, the implementation of this function contains a buffer-overrun bug: it returns the complete list of groups for user in the array groups, even when the number of groups exceeds *ngroups. EXAMPLE
The program below displays the group list for the user named in its first command-line argument. The second command-line argument speci- fies the ngroups value to be supplied to getgrouplist(). The following shell session shows examples of the use of this program: $ ./a.out cecilia 0 getgrouplist() returned -1; ngroups = 3 $ ./a.out cecilia 3 ngroups = 3 16 (dialout) 33 (video) 100 (users) Program source #include <stdio.h> #include <stdlib.h> #include <grp.h> #include <pwd.h> int main(int argc, char *argv[]) { int j, ngroups; gid_t *groups; struct passwd *pw; struct group *gr; if (argc != 3) { fprintf(stderr, "Usage: %s <user> <ngroups> ", argv[0]); exit(EXIT_FAILURE); } ngroups = atoi(argv[2]); groups = malloc(ngroups * sizeof (gid_t)); if (groups == NULL) { perror("malloc"); exit(EXIT_FAILURE); } /* Fetch passwd structure (contains first group ID for user) */ pw = getpwnam(argv[1]); if (pw == NULL) { perror("getpwnam"); exit(EXIT_SUCCESS); } /* Retrieve group list */ if (getgrouplist(argv[1], pw->pw_gid, groups, &ngroups) == -1) { fprintf(stderr, "getgrouplist() returned -1; ngroups = %d ", ngroups); exit(EXIT_FAILURE); } /* Display list of retrieved groups, along with group names */ fprintf(stderr, "ngroups = %d ", ngroups); for (j = 0; j < ngroups; j++) { printf("%d", groups[j]); gr = getgrgid(groups[j]); if (gr != NULL) printf(" (%s)", gr->gr_name); printf(" "); } exit(EXIT_SUCCESS); } SEE ALSO
getgroups(2), setgroups(2), getgrent(3), group(5), passwd(5) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2008-07-03 GETGROUPLIST(3)
All times are GMT -4. The time now is 09:30 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy