running a subroutine as a different user 
Author Message
 running a subroutine as a different user

I have a webpage where our customers come and register for an account
with us. After checking
for all the details, I either take them to a success page
(success.cgi) or a failure page(failure.cgi).
The webpage itself is a cgi program(written in perl). Works good so
far.
Here is the issue now. As part of the processing, if I goto the
"success" page, I need to execute some scripts, which come inbuilt
with windows( like the cscript.exe, findweb.vbs etc..)
These scripts by default can be run only by the administrator. so,
I'm not able to invoke
these scripts in my success.cgi because the user is not
administrator. When the cgi is accessed from the web
the user would be IUSR_something. My cgi is there failing.

I've three solutions in mind, but I'm not quite sure how to go about
implementing them.

1. create a new user on my server, who would have permissions to
execute these scripts.
so, within success.cgi, I would like to change the effective user run
these scripts and revert back to
IUSR. Is that possible? I mean can i change the effective user
within my perl program just to execute
a subroutine.

2. my second solution, is call these scripts from our database stored
procedure. But again,
in my stored procedure, the userid is "sa". so here again, I need a
way to change the effecitve user.
Is there a way.??

3. my third solution is the simplest, but I'm not every enthusiastic
about this.
Well, I can write all the parameters that I need to run these scripts
into a text file.
(note: I get the parameters from the success.cgi). Then run a batch
file as a chron job, that would
read this file, and call the scripts I want.
This approach means, I dont execute my scripts(cscript.ext,
findweb.vbs)
from my success.cgi, but from command line.
This approach will work fine, but this means my whole process is not
automated, which is what
we are trying to achieve.
If I decide to go with the 3rd solution, can someone point out how i
can run chron jobs in windows 2000.

I'll very glad to clarify anything thats not clear in my post

my environment : windows 2000 , perl, sql server.



Sun, 24 Oct 2004 15:49:48 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Running Daemon as Different User

2. Running scripts under different user ID on UNIX

3. setuid - running a script for different users

4. Benchmark results for different subroutine argument access methods

5. call subroutines from a different file

6. accessing subroutines in different scripts.

7. Subroutines in different files

8. Executing script as different user (suid)

9. script to modify database table as different user

10. script does things as different user?

11. A Perl Script Runs on Different Platforms

12. Running Perl5.001 on Different Unix Systems

 

 
Powered by phpBB® Forum Software