[Hampshire] Running a script that needs to do a rooty thing

Top Page

Reply to this message
Author: Victor Churchill
Date:  
To: Hampshire LUG Discussion List
Subject: [Hampshire] Running a script that needs to do a rooty thing
Hi

I have been asked to make a Perl script that does some stuff with Apache's
config (adds a virtual host) and then does an apache2ctl graceful to tell
Apache to re-read its config files.
This is Ubuntu 10.04, Apache 2.2. The script does its thing with the files
(it runs as the www-data userID, and the files belong to www-data, so that's
OK). But it can't do the apache2ctl command. Although the running apache
processes are owned by www-data, the startup of apache is done as root to
bind a socket to address :80 AIUI.

It would be daft to make www-data a sudoer and I'm not sure how I would do
that anyway. Any ideas on how to achieve this, or alternatives?

thanks

--
best regards,

Victor Churchill,
Bournemouth