Link to home
Start Free TrialLog in
Avatar of Airgazm
Airgazm

asked on

How to run CGI script as a certain user without using Virtual Domain.

Hi experts.  I am a bit confused here.
Apache 1.3, Perl 5.6.1

I want to run Mailman(listserv) scripts from a perl cgi script.  The mailman scripts need to be run as either "root" or "list" to execute properly.

I got it to work when I setup the domain name to run as the user "list" in the apache virtual hosts setup.  But I would rather not do it this way since I may want to run something else as a different user down the road.

Is there a way to setup the web page to ask for a username on the page, that will run the script as that user? Or, can I just set the script somehow to run as a certain user?  Like sudo? I would like it to be automatic, but that might be a security problem, so if I had to login to the page that would be ok I guess.

So if I initate the cgi script from a HTML page, would this all work ok.  Is security a problem doing this?

Thanks Experts!


ASKER CERTIFIED SOLUTION
Avatar of zerofill
zerofill

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
you may chown and chmod as suggested by zerofill, butkeep in mind that apache needs to be configured to allow SUID scripts too.

Or you may call your script fromwithin aour existing perl cgi as follows:

  system("su","-","user","/path/to/script","arg-for-script");
Avatar of Airgazm
Airgazm

ASKER

Thanks for the Help!