Re: Displaying a user's group memberships

2006-12-22 Thread Dr.Ruud
Chad Perrin schreef: > Ruud: >> So some security layer is not implemented at your end. I don't know >> which is implemented here, there are several ways to do something >> similar. > > At a wild guess, I'd say it might be a chroot "jail". I just asked them, and the shell runs in a (modified) yp (

Re: Displaying a user's group memberships

2006-12-22 Thread Dr.Ruud
Chad Perrin schreef: > John W. Krahn: >> Chad Perrin: >>> Chad Perrin: I'm sure that could be made prettier by someone with better Perl mojo than I have at the moment, and it could be made a bit simpler if all you want is the gid for each group rather than the group name. >>> >

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 06:24:53PM -0800, John W. Krahn wrote: > Chad Perrin wrote: > > On Thu, Dec 21, 2006 at 03:02:04PM -0700, Chad Perrin wrote: > >>I'm sure that could be made prettier by someone with better Perl mojo > >>than I have at the moment, and it could be made a bit simpler if all you

Re: Displaying a user's group memberships

2006-12-21 Thread John W. Krahn
Chad Perrin wrote: > On Thu, Dec 21, 2006 at 03:02:04PM -0700, Chad Perrin wrote: >>I'm sure that could be made prettier by someone with better Perl mojo >>than I have at the moment, and it could be made a bit simpler if all you >>want is the gid for each group rather than the group name. > > I po

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 03:02:04PM -0700, Chad Perrin wrote: > > I'm sure that could be made prettier by someone with better Perl mojo > than I have at the moment, and it could be made a bit simpler if all you > want is the gid for each group rather than the group name. I posted a gid version her

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 01:25:01PM -0700, Tom Smith wrote: > Chad Perrin wrote: > > > >That's why I said you may as well either just use the id utility from > >the shell if you're not going to grab group memberships in an > >idiomatically Perlish way -- the Perl code is likely to be more > >portabl

Re: Displaying a user's group memberships

2006-12-21 Thread Mumia W.
On 12/21/2006 09:05 AM, Tom Smith wrote: I try to avoid calling console commands because there tends to be differences in some of the CLI utilities between distributions--that was actually one of the first things I had considered doing, except with the `groups` command. You could limit o

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Chad Perrin wrote: On Thu, Dec 21, 2006 at 08:05:05AM -0700, Tom Smith wrote: Dr.Ruud wrote: Chad Perrin schreef: Of course, if you're going to call out of the Perl script to the id utility, you may as well skip the Perl script entirely and just enter this at the shell promp

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 08:05:05AM -0700, Tom Smith wrote: > Dr.Ruud wrote: > >Chad Perrin schreef: > > > >>Of course, if you're going to call out of the Perl script to the id > >>utility, you may as well skip the Perl script entirely and just enter > >>this at the shell prompt: > >> > >> id -Gn

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 03:06:38AM -0800, John W. Krahn wrote: > Chad Perrin wrote: > > On Wed, Dec 20, 2006 at 05:28:46PM -0800, John W. Krahn wrote: > >> > >> Since you are only reading from /etc/group you are not picking up the > >> primary > >> group stored in /etc/passwd. > > > > Singling o

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 08:08:07AM -0700, Tom Smith wrote: > > Yeah, the smiley may have clarified the intentions a little... . . . or it may have just looked like part of the Perl code. -- CCD CopyWrite Chad Perrin [ http://ccd.apotheon.org ] print substr("Just another Perl hacker", 0, -2); -

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 11:23:15AM +0100, Dr.Ruud wrote: > Chad Perrin schreef: > > Dr.Ruud: > > >> TIMTOWTDI. On the shell machines of my provider (FreeBSD) the "id" > >> approach will work, and the "/etc/group" one won't. > > > > I don't think that has anything to do with it being FreeBSD. > >

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Tom Smith wrote: Dr.Ruud wrote: Chad Perrin schreef: Dr.Ruud: TIMTOWTDI. On the shell machines of my provider (FreeBSD) the "id" approach will work, and the "/etc/group" one won't. I don't think that has anything to do with it being FreeBSD. That was and is also what

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Chad Perrin wrote: On Thu, Dec 21, 2006 at 01:48:38AM -0600, Mumia W. wrote: On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; I'm not trying to be argumentative or say

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Dr.Ruud wrote: Chad Perrin schreef: Dr.Ruud: TIMTOWTDI. On the shell machines of my provider (FreeBSD) the "id" approach will work, and the "/etc/group" one won't. I don't think that has anything to do with it being FreeBSD. That was and is also what I don't think. I

[Fwd: Re: Displaying a user's group memberships]

2006-12-21 Thread Tom Smith
Sorry, I sent this to the poster rather than the list... My bad. Original Message Subject:Re: Displaying a user's group memberships Date: Wed, 20 Dec 2006 20:39:13 -0700 From: Tom Smith <[EMAIL PROTECTED]> To: John W. Krahn <[EMAIL PROTECTE

[Fwd: Re: Displaying a user's group memberships]

2006-12-21 Thread Tom Smith
Sorry, I sent these to the poster rather than the list--my bad. Original Message Subject:Re: Displaying a user's group memberships Date: Wed, 20 Dec 2006 20:23:53 -0700 From: Tom Smith <[EMAIL PROTECTED]> To: John W. Krahn <[EMAIL PROTECTE

Re: Displaying a user's group memberships

2006-12-21 Thread Tom Smith
Mumia W. wrote: On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; I'm not trying to be argumentative or say that this is "wrong"... But does anyone else agree with this? If so, why is this

Re: Displaying a user's group memberships

2006-12-21 Thread Mumia W.
On 12/21/2006 02:59 AM, Chad Perrin wrote: On Wed, Dec 20, 2006 at 10:47:25PM -0800, John W. Krahn wrote: Mumia W. wrote: On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=//

Re: Displaying a user's group memberships

2006-12-21 Thread John W. Krahn
Chad Perrin wrote: > On Wed, Dec 20, 2006 at 05:28:46PM -0800, John W. Krahn wrote: >> >> Since you are only reading from /etc/group you are not picking up the primary >> group stored in /etc/passwd. > > Singling out the primary group wasn't a requirement for the Perl script, > as far as I recall

Re: Displaying a user's group memberships

2006-12-21 Thread Dr.Ruud
Chad Perrin schreef: > Dr.Ruud: >> TIMTOWTDI. On the shell machines of my provider (FreeBSD) the "id" >> approach will work, and the "/etc/group" one won't. > > I don't think that has anything to do with it being FreeBSD. That was and is also what I don't think. I only mentioned it because OP men

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 01:48:38AM -0600, Mumia W. wrote: > On 12/21/2006 12:42 AM, Tom Smith wrote: > >Mumia W. wrote: > >> > >>use strict; > >>use warnings; > >>$_ = `id $ARGV[0]`; > >>s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; > > > >I'm not trying to be argumentative or say that this is "

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Wed, Dec 20, 2006 at 05:28:46PM -0800, John W. Krahn wrote: > Tom Smith wrote: > > > > Thank Chad (and John) for your input on this. I thought I'd post the > > portion of the script that I was trying to work out to see if there's > > room for improvement. This should work on any *nix system. Th

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Wed, Dec 20, 2006 at 10:47:25PM -0800, John W. Krahn wrote: > Mumia W. wrote: > > On 12/20/2006 04:14 PM, Tom Smith wrote: > >> [...] > >> So is there a better way to do this, or perhaps a cleaner way? > > > > use strict; > > use warnings; > > $_ = `id $ARGV[0]`; > > s/.*?groups=// && print "@{

Re: Displaying a user's group memberships

2006-12-21 Thread Chad Perrin
On Thu, Dec 21, 2006 at 09:24:51AM +0100, Dr.Ruud wrote: > Tom Smith schreef: > > Mumia W.: > > >> use strict; > >> use warnings; > >> $_ = `id $ARGV[0]`; > >> s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; > > > > I'm not trying to be argumentative or say that this is "wrong"... But > > does an

Re: Displaying a user's group memberships

2006-12-21 Thread Mumia W.
On 12/21/2006 12:42 AM, Tom Smith wrote: Mumia W. wrote: use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; I'm not trying to be argumentative or say that this is "wrong"... But does anyone else agree with this? If so, why is this way better than t

Re: Displaying a user's group memberships

2006-12-21 Thread Dr.Ruud
Tom Smith schreef: > Mumia W.: >> use strict; >> use warnings; >> $_ = `id $ARGV[0]`; >> s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; > > I'm not trying to be argumentative or say that this is "wrong"... But > does anyone else agree with this? If so, why is this way better than > the pure Perl

Re: Displaying a user's group memberships

2006-12-20 Thread John W. Krahn
Mumia W. wrote: > On 12/20/2006 04:14 PM, Tom Smith wrote: >> [...] >> So is there a better way to do this, or perhaps a cleaner way? > > use strict; > use warnings; > $_ = `id $ARGV[0]`; > s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; print $1 if `groups $ARGV[0] 2>/dev/null` =~ /$ARGV[0]\s*:

Re: Displaying a user's group memberships

2006-12-20 Thread Tom Smith
Mumia W. wrote: On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? Thanks again for your help! ~ Tom use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; I'm not trying to be argumentativ

Re: Displaying a user's group memberships

2006-12-20 Thread Mumia W.
On 12/20/2006 04:14 PM, Tom Smith wrote: [...] So is there a better way to do this, or perhaps a cleaner way? Thanks again for your help! ~ Tom use strict; use warnings; $_ = `id $ARGV[0]`; s/.*?groups=// && print "@{[ /\((\w+)\)/g ]}\n"; -- To unsubscribe, e-mail: [EMAIL PROTECTED] For

Re: Displaying a user's group memberships

2006-12-20 Thread John W. Krahn
Tom Smith wrote: > > Thank Chad (and John) for your input on this. I thought I'd post the > portion of the script that I was trying to work out to see if there's > room for improvement. This should work on any *nix system. The format of > the command is simple: `test.pl username`, where username i

Re: Displaying a user's group memberships

2006-12-20 Thread Chad Perrin
On Wed, Dec 20, 2006 at 03:14:18PM -0700, Tom Smith wrote: > > Thank Chad (and John) for your input on this. I thought I'd post the > portion of the script that I was trying to work out to see if there's > room for improvement. This should work on any *nix system. The format of > the command is

Re: Displaying a user's group memberships

2006-12-20 Thread Tom Smith
Chad Perrin wrote: On Mon, Dec 18, 2006 at 04:50:57PM -0700, Tom Smith wrote: I need to capture a user's group memberships for further processing in a Perl script. The user's username is passed to the script via the command line and captured with ARGV. From there, I want to determine the gro

Re: Displaying a user's group memberships

2006-12-18 Thread John W. Krahn
Tom Smith wrote: > I need to capture a user's group memberships for further processing in a > Perl script. The user's username is passed to the script via the command > line and captured with ARGV. From there, I want to determine the group > memberships (much like executing `groups` from the comman

Re: Displaying a user's group memberships

2006-12-18 Thread Chad Perrin
On Mon, Dec 18, 2006 at 04:50:57PM -0700, Tom Smith wrote: > I need to capture a user's group memberships for further processing in a > Perl script. The user's username is passed to the script via the command > line and captured with ARGV. From there, I want to determine the group > memberships