Thanks Amit.
Yours is the valid doubt.
The $ENV { USER } approach is not secure. 

I'll go with Merlyn

>> my $user = getpwuid $<;
>> if ($user eq "merlyn") { ... } # it's me!

Rajnikant Jachak | Software Engg | Persistent Systems Limited
[EMAIL PROTECTED] | Cell: +91 9822204088 | Tel: +91 (20)
3023 2479
 
Persistent Systems - Innovations in software product design,development and
delivery - www.persistentsys.com
 

-----Original Message-----
From: Amit Saxena [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, July 02, 2008 10:55 AM
To: Rajnikant
Cc: Richard Lee; Perl Beginners
Subject: Re: user id validation

What if before running this perl code, I modify the 'USER' environment
variable ?

I have not tried like that but I feel it can be done because the environment
variables are not restricted.

Assuming that works, then any user can just reset the environment variable
to any one among the allowed ones and the script will work.

I feel the better way is to use system command and call "whoami" or "id"
command.

Regards,
Amit Saxena

On Wed, Jul 2, 2008 at 10:30 AM, Rajnikant <
[EMAIL PROTECTED]> wrote:

>
> I think Work around for this is,
>
> My $usr = $ENV { USER };
> If ($usr eq "userA")
>   Go get it
> Else
>   Access restricted.
>
>
> Rajnikant Jachak | Software Engg | Persistent Systems Limited 
> [EMAIL PROTECTED] | Cell: +91 9822204088 | Tel: +91 
> (20)
> 3023 2479
>
> Persistent Systems - Innovations in software product 
> design,development and delivery - www.persistentsys.com
>
>
> -----Original Message-----
> From: Richard Lee [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, July 02, 2008 10:18 AM
> To: Perl Beginners
> Subject: user id validation
>
> I am just wondering how to validate a user who is using the script??
>
> I wanted to allow only user below to be able to user the script and 
> was thinking about
> userA(userid: 1077)
> userB(userid: 1088)
> userC(userid: 1099)
>
> so, inside of script, I would put,
>
> unless ( $userid =~ /1077|1088|1099/ ) {
>        print "You are not authorized to use this\n"; }
>
> but I am not sure how to come up w/ $userid ?
> how do I find out what the userid of person who is using the script? 
> Is there specific perl command for that?
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional 
> commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
>
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which 
> is the property of Persistent Systems Ltd. It is intended only for the 
> use of the individual or entity to which it is addressed. If you are 
> not the intended recipient, you are not authorized to read, retain, 
> copy, print, distribute or use this message. If you have received this 
> communication in error, please notify the sender and delete all copies of
this message.
> Persistent Systems Ltd. does not accept any liability for virus 
> infected mails.
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED] For additional 
> commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/
>
>
>


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to