set uid - root - etc
Posted on 2002-04-04
I have written a little utility that I use when I want to make changes to my httpd.conf file. Now, once that file has been changed I need or course to restart my webserver which I do with
/usr/sbin/server httpd restart
from within the utility, which happens to be written in perl.
The good news, for me at least, is that all works well. Now, I have been using the utility from the root, and this is why all works well. But really the utility is secure enough that I could run it from elsewhere without danger. So, I decided to use setuid, or at least so I thoought.
I did a chmod 4755 on the script, which is of course owned by the root and expected all to work. It does not. The files get updated correctly but the restart fails because the server is apparentlky not operating as the root.
How do I make the setuid work the way I need it to.