At 1:09 PM -0400 10/26/02, Mark Knipfer wrote:
Of course that only works if the 'root' user is named 'root', and not 'administrator' or etc. And it doesn't allow someone to run your script from sudo.On 10/26/02 11:55 AM, Mark Knipfer wrote:After browsing and reading through part of the O'Rielly - Programming Perl 2nd Edition book, I came up with this routine:How do you check for root level access in Perl 5.6.0 in Mac OS X?
$login = (getpwuid($>));
if (!$login == "root")
{
die "\nYou cannot run this Perl script as user \"$login\", must be ROOT!\n\n";
}
But you may find more assistance in perldoc -f getpwuid
-Jeff Lowrey
