Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Chris Brannon
Mike MacCana [EMAIL PROTECTED] writes: Hi folks, What's the proper way to query the passwd and group database on a Unix host? Use the pwd and grp modules, respectively. ## Get the full group database entry, leave just the user list, ## and split the list on comma

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Fredrik Lundh
Mike MacCana wrote: What's the proper way to query the passwd and group database on a Unix host? I'd like to fetch the users in a group (obviously from name services), but my many varied searches can't find any reference of someone ever looking up users on a Unix system, just NT. Weird, I

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Sebastian lunar Wiesner
Chris Brannon [EMAIL PROTECTED]: Iirc since Python 2.5 these tuples are named ... Instead, do this: import grp groupname = 'users' groupusers = grp.getgrnam(groupname)[3] ... thus this line could be written as: groupusers = grp.getgrnam(groupname).gr_mem Slightly more readable, imho

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Sebastian lunar Wiesner
Guilherme Polo [EMAIL PROTECTED]: On Wed, Jul 23, 2008 at 9:16 AM, Sebastian lunar Wiesner [EMAIL PROTECTED] wrote: Chris Brannon [EMAIL PROTECTED]: Iirc since Python 2.5 these tuples are named ... Instead, do this: import grp groupname = 'users' groupusers = grp.getgrnam(groupname)[3]

Re: Proper way to query user and group database on a Unix host?

2008-07-23 Thread Mike MacCana
On Wed, 2008-07-23 at 09:13 +0200, Fredrik Lundh wrote: http://mail.python.org/mailman/listinfo/python-list Thanks - in the midst of trying to filter out search results for every damn python 'user group' 'yahoo group' 'interest group' etc, I seem to have missed this. Thanks to the other

Proper way to query user and group database on a Unix host?

2008-07-22 Thread Mike MacCana
Hi folks, What's the proper way to query the passwd and group database on a Unix host? I'd like to fetch the users in a group (obviously from name services), but my many varied searches can't find any reference of someone ever looking up users on a Unix system, just NT. Weird, I know.