Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I want to run a specific (perl) CGI script on my webserver. This works reasonable, but it would work immensely better if the CGI script would be running as the currently authenticated user.

Is there a way to do that, e.g. with a wrapper and sudo?

The virtualhost config is as follows:

    DocumentRoot /path/to/script
    <Directory /path/to/script>
            Options FollowSymLinks +ExecCGI
            AddHandler cgi-script .cgi

            AuthType Basic
            AuthName "Authenticate"

            # This authenticates against the local NIS
            PerlAuthenHandler Apache2::AuthenNIS
            PerlAuthzHandler Apache2::AuthzNIS
            PerlSetVar AllowAlternateAuth no

            Require valid-user
    </Directory>
share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

What exactly is preventing your app from running this way?

It's possible to do what you're asking, but it might be a better use of your time to configure an environment where your app can run as the same user which owns the httpd processes.

You're just introducing more complexity to your environment which makes it more difficult to debug, secure, and manage.

Anyway, to answer your question: look into suEXEC -- http://httpd.apache.org/docs/2.0/suexec.html

Echoing the documentation, you're almost always better off not doing things this way.

share|improve this answer
    
I'm slightly familiar with suEXEC, but how can I use it to run as the current authenticated user? –  dtech Sep 17 '11 at 7:31
    
Marking as solved because suEXEC is probably the answer, just haven't had time for it yet. –  dtech Oct 15 '11 at 9:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.