Re: [Hampshire] Running a script that needs to do a rooty th…

Top Page

Reply to this message
Author: Tim Brocklehurst
Date:  
To: Hampshire LUG Discussion List
Subject: Re: [Hampshire] Running a script that needs to do a rooty thing
On Friday 26 November 2010 18:15:22 Victor Churchill wrote:
> 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


Can you ask for a password then su to root? Or perhaps store a password hash?

Tim B.
--
OpenPilot - Open-source Marine Chart Plotter
Lead Developer
http://openpilot.sourceforge.net