[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: group information?

Ingo Luetkebohle wrote:
> How do I obtain group information for a user?
> ---/dev/il

This is not specified by PAM. You should use the username as an index for
getting the user's group through the POSIX call, getpwnam(). This returns a
passwd structure that contains the gid of the user. Both libc and libpwdb
provide this function. To find the supplimentary groups of a user is very
messy with POSIX. So far as I can tell, you have to call getgrgid() with
every possible gid and see if the user is returned in the member lists.

There is a non-POSIX call initgroups() that will set all of the groups of a
user. I'm assuming you would like a simple list (without setting anything).

Libpwdb comes with a request runction that will determine this for you. If
you want to see how it works, I would recommend you get the SimplePAMApps
from my PAM/pre-directory and look at the code that sets the user's

Finally, if your applicant user-process already has all of these groups, you
can use the getgroups() function to list them.

Hope that helped


               Linux-PAM, libpwdb, Orange-Linux and Linux-GSS
       [ For those that prefer FTP  ---  ftp://ftp.lalug.org/morgan ]

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index] []