I suggest you rethink the whole idea from scratch. The solution to your problem has no relation to Perl - or, for that matter, any programming language. You're giving SUID to an executable via a non-secure process - this is an invitation to anyone on the system to grab UID0 (root) at will.

The correct solution requires securing the chain of trust that leads to the creation and execution of your SUID program; this means using 'su', 'sudo', 'super', or some other mechanism which will securely authenticate the valid user (rather than a program.) If you don't have such a mechanism, you can't do it securely (caveat: all rules are suspended for super-geniuses.) If you try, you're betting your knowledge and understanding against the many years of refinement produced by the constant attack/counterattack scenario that has resulted in the creation of the programs I've mentioned. That's a very, very poor bet.


-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells

In reply to Re: Detect name and path of calling script by oko1
in thread Detect name and path of calling script by Anonymous Monk

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.