Sponsored Content
Top Forums Programming to obtain users of each group in c Post 302352792 by fpmurphy on Sunday 13th of September 2009 11:34:44 AM
Old 09-13-2009
I think what you are looking for is the getgrent() function.
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Adding users to /etc/group

I'm using SAM to add users on an HP and they're adding fine. But in /etc/group it only lists the group names. It's not adding the users in there. Is there a way to have them put in there without going into SAM and modifying the group and adding them? I guess what I want to happen is when I add... (1 Reply)
Discussion started by: golfhakker
1 Replies

2. UNIX for Dummies Questions & Answers

How to obtain list of users ?

How to obtain list of users found in /home/ and append it to a file. (7 Replies)
Discussion started by: bobby36
7 Replies

3. AIX

Max users in a group ?

Hi All, Does anyone know if there is a maximum limit to the number of users that can be assigned to a group. I currently have on a production server 900+ users in 1 group. I know some of these users are no longer valid as we only have 500 employees and not all employees use this application. ... (4 Replies)
Discussion started by: anmiller
4 Replies

4. Shell Programming and Scripting

SSH for a group of users ?

Hi, Can any one tell me is it possible to setup private key public key pairing(SSH ) for a group of users , instead of setting it up for individual users ? Eg: Say i have 3 users A,B and C and i want the users to connect to SERVER1. instead of generating public private keys for each user , is... (3 Replies)
Discussion started by: deepusunil
3 Replies

5. Solaris

How can i allow only a group of users in NIS?

Hello experts. I am using Solaris10. How can i allow a group of users, remaining should be deny. Thanx in advance. (9 Replies)
Discussion started by: younus_syed
9 Replies

6. Shell Programming and Scripting

Diffferentiate group from users

Im trying to put all the groups in into a variable called $GROUP, however in /etc/group there are also lotsa users. And the GID of group can differ as it can be set, this there is no specific range, how can i put all the names of the groups into that variable? (3 Replies)
Discussion started by: dplate07
3 Replies

7. Shell Programming and Scripting

Change of group to different users

Need to change the chgrp for different uses d---rwx--t 3 root 764 4096 Mar 16 2007 algavi d---rwx--t 6 root 2857 4096 Jul 16 11:28 alharki d---rwx--t 5 root 2739 4096 Oct 14 2008 alpen d---rwx--t 5 root 546 4096 Mar 16 2007 alvarez d---rwx--t 3 root... (2 Replies)
Discussion started by: gsiva
2 Replies

8. Shell Programming and Scripting

users per group

hi guys I am trying to display a list of groups and the respective users: Group1 : user1 user2 user3 .... the closest thing I get is echo " "; echo "Group Users "; echo " "; cat /etc/group |grep | grep -v nfswhich I really don't since I want to remove the other stuff like x : and... (4 Replies)
Discussion started by: karlochacon
4 Replies

9. UNIX for Dummies Questions & Answers

How does IRC obtain the users in a channel?

I'm on an IRC server where the command /names is not a valid command. However, on programs like mIRC and Mibbit, the users in the channel still show up on the GUI where it displays the channel users. What command is being used to obtain the user list? (2 Replies)
Discussion started by: daigo
2 Replies
GETGROUPLIST(3) 					   BSD Library Functions Manual 					   GETGROUPLIST(3)

NAME
getgrouplist, getgroupmembership, -- calculate group access list LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> int getgrouplist(const char *name, gid_t basegid, gid_t *groups, int *ngroups); int getgroupmembership(const char *name, gid_t basegid, gid_t *groups, int maxgrp, int *ngroups); DESCRIPTION
The getgrouplist() and getgroupmembership() functions read through the group database and calculate the group access list for the user speci- fied in name. The basegid is automatically included in the groups list. Typically this value is given as the group number from the password database. The resulting group list is returned in the integer array pointed to by groups. For getgrouplist(), the caller specifies the size of the groups array in the integer pointed to by ngroups. For getgroupmembership(), the caller specifies the size of the groups array in maxgrp. The actual number of groups found is returned in ngroups. Duplicate group ids will be suppressed from the result. RETURN VALUES
The getgrouplist() and getgroupmembership() functions return 0 if successful, and return -1 if the size of the group list is too small to hold all the user's groups. In the latter case, the groups array will be filled with as many groups as will fit and ngroups will contain the total number of groups found. FILES
/etc/group group membership list SEE ALSO
setgroups(2), initgroups(3), group(5) HISTORY
The getgrouplist() function first appeared in 4.4BSD. The getgroupmembership() function first appeared in NetBSD 3.0 to address an API defi- ciency in getgrouplist(). BUGS
The getgrouplist() function uses the routines based on getgrent(3). If the invoking program uses any of these routines, the group structure will be overwritten in the call to getgrouplist(). BSD
January 6, 2005 BSD
All times are GMT -4. The time now is 05:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy