Restarting apache as www-data using perl Restarting apache as www-data using perl unix unix

Restarting apache as www-data using perl


The init-scripts can/should only be run as root (at least on my standard-Debian this is the case).

The apache-process (and the ones of the other services) will call setuid (or one of its friends) to change the actual user of the process.


root should restart the webserver:

sudo /etc/init.d/apache2 restart

This will make apache run under the www-data user.

you don't need to add www-data to the sudoers file unless you want to allow the www-data user to restart the server - but typically you should not log in under the www-data account, it's a system account.