Perl/CGI - suEXEC

Discussion in 'Perl' started by iraklic, Mar 31, 2008.

  1. iraklic

    iraklic New Member

    Joined:
    Mar 31, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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...
     
  2. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
  3. iraklic

    iraklic New Member

    Joined:
    Mar 31, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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...
     
  4. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You'll need to configure SuExec on Apache to run Perl scripts as owner!
     
  5. iraklic

    iraklic New Member

    Joined:
    Mar 31, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  6. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    You'll need to compile apache back from source with suexec support! What OS are you using?
     
  7. iraklic

    iraklic New Member

    Joined:
    Mar 31, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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?
     
  8. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
  9. iraklic

    iraklic New Member

    Joined:
    Mar 31, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    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?
     
  10. pradeep

    pradeep Team Leader

    Joined:
    Apr 4, 2005
    Messages:
    1,645
    Likes Received:
    87
    Trophy Points:
    0
    Occupation:
    Programmer
    Location:
    Kolkata, India
    Home Page:
    http://blog.pradeep.net.in
    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!
     
  11. iraklic

    iraklic New Member

    Joined:
    Mar 31, 2008
    Messages:
    6
    Likes Received:
    0
    Trophy Points:
    0
    thanks, I appreciate your help
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice