[thelist] Perl script as root

David Gray david_gray at 3b2.com
Thu Feb 14 08:20:01 CST 2002


Hi Chris,

You have to turn on the setuid bit of your script so that it runs as the
user it's owned by. You can do this using this syntax (the file has to
be executable):

chmod +s script.pl

If you'd like to check what user your script is running as before you
try the setuid stuff, you can check $< (real uid) and $> (effective uid)
within your program.

HTH,

 -dave


-----Original Message-----
From: thelist-admin at lists.evolt.org
[mailto:thelist-admin at lists.evolt.org] On Behalf Of CDitty
Sent: Wednesday, February 13, 2002 10:07 PM
To: thelist at lists.evolt.org
Subject: [thelist] Perl script as root


Hello all,

I wrote a little perl script that catches the ip addresses for people
trying to access formmail.pl  on my site.  The script is supposed to add
the ip to the firewall blocking them from accessing my site in the
future.  Problem is, ipchains needs to be run by root.  I have given the
script root permissions, but it still won't work right.  Does anyone
know how to make a script run as root?

Thanks

Chris

--
For unsubscribe and other options, including
the Tip Harvester and archive of thelist go to: http://lists.evolt.org
Workers of the Web, evolt !





More information about the thelist mailing list