Question

Why do we use root as user for apache2?

Hi there, I have a question, If we follow the instructions to implement a web server with apache on Ubuntu 18.04, why do we use the root user (or sudo user granted privileges) in the installation process? From what I’ve seen they use www-data user, because of security. Is that OK? Thanks


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hello, @ericferrando92

Could you please let me know if you refer to to this article:

https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-ubuntu-18-04

As the article says “In order to complete this tutorial, you will need to have an Ubuntu 18.04 server with a non-root sudo-enabled user account”

As for the user with which Apache (and the individual sites) run on the server this can be modified.

If you’re just running apache, serving static files and things, www-data is enough.

If you have a whole bundle of applications also running in apache (in modphp, modperl etc) you end up with lots of your own, custom, internet-facing code running as www-data, which gives the bad guys more of a chances to gain access to that user, and puts them in control of more stuff if they do.

Hope this helps!

Regards, Alex