Do you know where your variables are? | |
PerlMonks |
Determining if a script is running setuidby crashtest (Curate) |
on Jul 26, 2007 at 02:02 UTC ( [id://628841]=perlquestion: print w/replies, xml ) | Need Help?? |
crashtest has asked for the wisdom of the Perl Monks concerning the following question: Greetings, Monks. As I start typing this, I realize I may be asking more of a UNIX question than a Perl question, but Perl is my tool of choice... so please bear with me. I am experimenting with creating a setuid script. I've done this once successfully in the past. But if I create the script, set the appropriate permissions, then run it as a different user, my effective user id does not change. The little test script looks like this: I set permissions as follows: If I then log in as another user (call him guest) I do the following:
What I expected was UID = 20244, EUID = 20375. That is, I expected my effective user id to be the script's owner, not the user running the script. At this point, I wonder if I am misinterpreting the results of geteuid, or if I am missing something fundamental with respect to how setuid scripts work. Is there a better way to do this test? Or is the test showing me the correct result, and the script is not in fact running setuid for some reason? I'll admit that my knowledge has been passed down from google, which doesn't always guarantee comprehensive coverage of a topic, nor accuracy. I am running this on a Solaris 8 machine. Thanks in advance for any pointers or hints. UPDATE: mr_mischief was right. The filesystem is mounted to specifically not allow setuid: I had not known you could do that. Thanks also to kyle; nice catch on my or die ... code there. I guess it's moot now, but I wouldn't have ever run as root anyway.
Back to
Seekers of Perl Wisdom
|
|