0

From the Apache documentation can be read:

If the Listen specified in the configuration file is default of 80 (or any other port below 1024), then it is necessary to have root privileges in order to start apache, so that it can bind to this privileged port.

After reading this, I immediately made the assumption that if I was running apache on port 8080, I wouldn't need to use sudo to restart the service. But as it turns out, I still need to use sudo, no matter what port I use.

Did I misunderstood the documentation? Or did something get misconfigured in my installation?

2

Apache is generally configured to start as root and then to setuid to the apache user by default.

If root started the apache server, then you will need to be root to restart it regardless of the port you are using.

If you start it as user X, you need to be user X to restart it. It's also likely to require some special configuration as the setuid call will fail if it is not started as root.

  • That means that if I sudo service apache2 stop, then I should be able to immediately service apache2 start, right? But I still get a permission error. – Enrique Moreno Tent Feb 15 '14 at 1:55
  • What is the error message? – Fred the Magic Wonder Dog Feb 15 '14 at 1:59
  • (13)Permission denied: AH00091: apache2: could not open error log file /var/log/apache2/error.log. – Enrique Moreno Tent Feb 15 '14 at 2:01
  • Your user does not have permission to write to the log files. You should be using a different set of config files that use your home directory to store data. – David Houde Feb 15 '14 at 2:25
  • But the config files are as well writable only by the root. I understand what you are trying to say, but it feels like apache is very un-friendly to non-root users. Anyway, thanks for the answer. – Enrique Moreno Tent Feb 15 '14 at 2:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.