in reply to Detect name and path of calling script

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
  • Comment on Re: Detect name and path of calling script