<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: get userlist from HPUX whose primary group is given in Operating System - Linux</title>
    <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817077#M100181</link>
    <description>Prasant:&lt;BR /&gt;#include &lt;GRP.H&gt;&lt;BR /&gt;#include &lt;PWD.H&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;int i=0;&lt;BR /&gt;struct group* grp;&lt;BR /&gt;struct passwd* pwd;&lt;BR /&gt;grp = getgrnam("adm_system");&lt;BR /&gt;if(grp)&lt;BR /&gt;{&lt;BR /&gt;        printf("Group Name %s\n",grp-&amp;gt;gr_name);&lt;BR /&gt;        printf("GRPID %d\n",grp-&amp;gt;gr_gid);&lt;BR /&gt;        while (grp-&amp;gt;gr_mem[i] !=NULL)&lt;BR /&gt;        {&lt;BR /&gt;                printf("Users from Group file : %s\n",grp-&amp;gt;gr_mem[i]);&lt;BR /&gt;                i++;&lt;BR /&gt;        }&lt;BR /&gt;        while (pwd=getpwent())&lt;BR /&gt;        {&lt;BR /&gt;                if (pwd-&amp;gt;pw_gid == grp-&amp;gt;gr_gid) printf("Users from Password file : %s\n",pwd-&amp;gt;pw_name);&lt;BR /&gt;        }&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PWD.H&gt;&lt;/GRP.H&gt;</description>
    <pubDate>Tue, 04 Jul 2006 08:20:46 GMT</pubDate>
    <dc:creator>Peter Godron</dc:creator>
    <dc:date>2006-07-04T08:20:46Z</dc:date>
    <item>
      <title>get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817073#M100177</link>
      <description>Hi,&lt;BR /&gt;I want to get the username list whose primary group is given on HPUX.&lt;BR /&gt;I used following program to get the username&lt;BR /&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;int i=0;&lt;BR /&gt;struct group* grp;&lt;BR /&gt;grp = getgrnam("adm_system");&lt;BR /&gt;if(grp)&lt;BR /&gt;{&lt;BR /&gt;printf("%s\n",grp-&amp;gt;gr_name);&lt;BR /&gt;printf("%s\n",grp-&amp;gt;gr_passwd);&lt;BR /&gt;printf("%d\n",grp-&amp;gt;gr_gid);&lt;BR /&gt;while (grp-&amp;gt;gr_mem[i] !=NULL)&lt;BR /&gt;{&lt;BR /&gt;printf("%s\n",grp-&amp;gt;gr_mem[i])&lt;BR /&gt;i++;&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;But it is displaying the user list whose secondary group is "adm_system" and also tried with getgrgid(), but it doesn't give the proper result.&lt;BR /&gt;&lt;BR /&gt;Please help me to get the user list whose primary group is "adm_system"&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Prasant</description>
      <pubDate>Tue, 04 Jul 2006 07:26:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817073#M100177</guid>
      <dc:creator>pjena</dc:creator>
      <dc:date>2006-07-04T07:26:31Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817074#M100178</link>
      <description>Hi&lt;BR /&gt;&lt;BR /&gt;For example GID= bin :&lt;BR /&gt;cat /etc/passwd|grep ":2:"&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;Victor</description>
      <pubDate>Tue, 04 Jul 2006 07:31:29 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817074#M100178</guid>
      <dc:creator>Victor BERRIDGE</dc:creator>
      <dc:date>2006-07-04T07:31:29Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817075#M100179</link>
      <description>Prasant,&lt;BR /&gt;thread &lt;A href="http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=849713" target="_blank"&gt;http://forums1.itrc.hp.com/service/forums/bizsupport/questionanswer.do?threadId=849713&lt;/A&gt; shows how to get the reverse of the info without C.&lt;BR /&gt;&lt;BR /&gt;So for your case,&lt;BR /&gt;get the gid for "adm_system" from /etc/group then look in /etc/passwd for this gid.</description>
      <pubDate>Tue, 04 Jul 2006 07:38:13 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817075#M100179</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-07-04T07:38:13Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817076#M100180</link>
      <description>Hi Prasant,&lt;BR /&gt;&lt;BR /&gt;Have you tried the logins command:&lt;BR /&gt;# logins -g &lt;GROUP-NAME&gt;&lt;BR /&gt;&lt;BR /&gt;For more info see man logins.&lt;BR /&gt;&lt;BR /&gt;Darrel&lt;/GROUP-NAME&gt;</description>
      <pubDate>Tue, 04 Jul 2006 07:44:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817076#M100180</guid>
      <dc:creator>Darrel Louis</dc:creator>
      <dc:date>2006-07-04T07:44:02Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817077#M100181</link>
      <description>Prasant:&lt;BR /&gt;#include &lt;GRP.H&gt;&lt;BR /&gt;#include &lt;PWD.H&gt;&lt;BR /&gt;main()&lt;BR /&gt;{&lt;BR /&gt;int i=0;&lt;BR /&gt;struct group* grp;&lt;BR /&gt;struct passwd* pwd;&lt;BR /&gt;grp = getgrnam("adm_system");&lt;BR /&gt;if(grp)&lt;BR /&gt;{&lt;BR /&gt;        printf("Group Name %s\n",grp-&amp;gt;gr_name);&lt;BR /&gt;        printf("GRPID %d\n",grp-&amp;gt;gr_gid);&lt;BR /&gt;        while (grp-&amp;gt;gr_mem[i] !=NULL)&lt;BR /&gt;        {&lt;BR /&gt;                printf("Users from Group file : %s\n",grp-&amp;gt;gr_mem[i]);&lt;BR /&gt;                i++;&lt;BR /&gt;        }&lt;BR /&gt;        while (pwd=getpwent())&lt;BR /&gt;        {&lt;BR /&gt;                if (pwd-&amp;gt;pw_gid == grp-&amp;gt;gr_gid) printf("Users from Password file : %s\n",pwd-&amp;gt;pw_name);&lt;BR /&gt;        }&lt;BR /&gt;}&lt;BR /&gt;}&lt;/PWD.H&gt;&lt;/GRP.H&gt;</description>
      <pubDate>Tue, 04 Jul 2006 08:20:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817077#M100181</guid>
      <dc:creator>Peter Godron</dc:creator>
      <dc:date>2006-07-04T08:20:46Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817078#M100182</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;do you really need to programm it by yourselfe? There is a tool in HP-UX called "logins" that allready does what you want.&lt;BR /&gt;&lt;BR /&gt;Do you just need the information? Then logins should be helpfool to you.&lt;BR /&gt;&lt;BR /&gt;Or do you need a function in your own programs?&lt;BR /&gt;&lt;BR /&gt;Regards Stefan</description>
      <pubDate>Tue, 04 Jul 2006 08:57:39 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817078#M100182</guid>
      <dc:creator>Stefan Schulz</dc:creator>
      <dc:date>2006-07-04T08:57:39Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817079#M100183</link>
      <description>Sorry&lt;BR /&gt;I missed the fact you could me using NIS...&lt;BR /&gt;In this case as suggested the use of logins -g &lt;GROUP&gt;| grep &lt;GROUP&gt; should do the trick under HPUX&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;All the best&lt;BR /&gt;Victor&lt;BR /&gt;&lt;/GROUP&gt;&lt;/GROUP&gt;</description>
      <pubDate>Tue, 04 Jul 2006 10:56:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817079#M100183</guid>
      <dc:creator>Victor BERRIDGE</dc:creator>
      <dc:date>2006-07-04T10:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: get userlist from HPUX whose primary group is given</title>
      <link>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817080#M100184</link>
      <description>Bear in mind that you don't need to search the group file (or map) for primary group membership. In fact, the presense of a login in the group files means nothing as it applies to primary group membership. Primary group member ship is determined solely by the GID value in the user's passwd entry. The only reason to consult the group file (or map) is to obtain the GID of the group. You then scan the passwd file (or map) for matching GID entries.&lt;BR /&gt;&lt;BR /&gt;The standard libc passwd and group file functions will automatically include the NIS data, if applicable.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;#include &lt;GRP.H&gt;&lt;BR /&gt;#include &lt;PWD.H&gt;&lt;BR /&gt;int main()&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;struct group *grp;&lt;BR /&gt;&lt;BR /&gt;grp = getgrnam("adm_system");&lt;BR /&gt;if(grp != NULL)&lt;BR /&gt;{&lt;BR /&gt;  struct passwd *pwd = NULL;&lt;BR /&gt;&lt;BR /&gt;printf("Group Name %s\n",grp-&amp;gt;gr_name);&lt;BR /&gt;printf("GRPID %d\n",grp-&amp;gt;gr_gid);&lt;BR /&gt;&lt;BR /&gt;do&lt;BR /&gt;  {&lt;BR /&gt;    pwd = getpwent;&lt;BR /&gt;    if (pwd != NULL)&lt;BR /&gt;      {&lt;BR /&gt;        if (pwd-&amp;gt;pw_gid == grp-&amp;gt;gr_gid) printf("%s\n",pwd-&amp;gt;pw_name);&lt;BR /&gt;      }&lt;BR /&gt;  }&lt;BR /&gt;while (pwd != NULL);&lt;BR /&gt;} &lt;BR /&gt;  return(0);&lt;BR /&gt;}&lt;BR /&gt;&lt;/PWD.H&gt;&lt;/GRP.H&gt;</description>
      <pubDate>Tue, 04 Jul 2006 16:25:52 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-linux/get-userlist-from-hpux-whose-primary-group-is-given/m-p/3817080#M100184</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2006-07-04T16:25:52Z</dc:date>
    </item>
  </channel>
</rss>

