http://www.perlmonks.org?node_id=41470


in reply to RE: Re: How do I execute as root?
in thread How do I execute as root?

Works for me:
(fastolfe) eddie:~$ ls -l test -rwsrwxr-x 1 root fastolfe 53 Nov 13 16:17 test (fastolfe) eddie:~$ ./test uid=500 euid=0 (fastolfe) eddie:~$ cat test #!/usr/bin/perl printf("uid=%d euid=%d\n", $<, $>); (fastolfe) eddie:~$ uname -a Linux eddie.intranet 2.2.16 #1 Thu Jun 8 17:46:12 CDT 2000 i586 unknow +n
You may have to swap uid/euid as needed, though:
($<, $>) = ($>, $<);