This isn't really a Perl question, because How to Do It depends on what your HTTP server software is. If it's apache, look into suEXEC.

Other than that, there aren't too many pitfalls (unless the user is root =) Running under -T is probably the biggest single thing you can do, as it will help you track down where your code isn't secure enough. You might create a user whose sole permission is to exec the htpasswd binaries, if you're truly paranoid.

A different kind of setup you might look into if you don't need *instant* updates is to have the CGI write to a file, and have a smart cron job running with more privileges handle the actual updating. But again, such pitfalls as exist will depend on your OS and HTTP server.

Philosophy can be made out of anything. Or less -- Jerry A. Fodor


In reply to Re: Running a CGI Script as user by arturo
in thread Running a CGI Script as user by skazat

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.