Perl/CGI - suEXEC

Light Poster
31Mar2008,16:43   #1
iraklic's Avatar
Hi everyone,

this is my first post. I relly hope you guys can help me.

So here is the thing:

I am trying to write to file from web using cgi. The user for web is '' (nobody) and of course it has no priviladges to open file for writing. So now I wanna do that with suEXEC.

1. Could you tell me how?
2. I couldn't find $q->virtualhos() or something like that for my query...


Thanks in advance...
Team Leader
31Mar2008,17:33   #2
pradeep's Avatar
I guess your webserver is Apache, try this http://httpd.apache.org/docs/1.3/suexec.html
Light Poster
31Mar2008,17:37   #3
iraklic's Avatar
yes, it's apache.
been there... read that... didn't really help... may be I'm slow...

can you actually give me a quick short code for perl that does something using that? I'd appreciate that.

and... thanks for reply...
Team Leader
1Apr2008,10:46   #4
pradeep's Avatar
You'll need to configure SuExec on Apache to run Perl scripts as owner!
Light Poster
1Apr2008,12:35   #5
iraklic's Avatar
Let's say suECEX is installed and configured on Apache. So I am writing a script where I have to change user from default to mine and give it some priviladges, is that right? If yes then how do I do that? That is my question. Thanks.
Team Leader
5Apr2008,16:12   #6
pradeep's Avatar
You'll need to compile apache back from source with suexec support! What OS are you using?
Light Poster
5Apr2008,17:04   #7
iraklic's Avatar
I'm using linux. What do you mean compile apache back from sourse?

can you just show me a little exaple of cgi using suEXEC?
Team Leader
6Apr2008,11:01   #8
pradeep's Avatar
Here, this is a full tutorial of how to use suexec http://linuxplanet.com/linuxplanet/tutorials/1445/1/
Light Poster
6Apr2008,13:49   #9
iraklic's Avatar
Thanks it helps.
Last thing. So as I understand you have to configure suEXEC with it's users on apache side and is hase nothing to do with perl script itself (It just gains the user priviladges given by suEXEC).
Is this correct?
Team Leader
7Apr2008,11:31   #10
pradeep's Avatar
Yes right! Perl script remains the same, usually the perl script is executed by the user assigned to the web server, but by using suexec, the perl script is executed using the permissions of the user who owns it!