Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to set up a webserver and I understand that when using linux its not safe to install things under root. So should I install things like apache and php under a different user? And if i do, will everything be installed in the /usr directory?

share|improve this question
up vote 1 down vote accepted

When using Linux you should not run things as root unless it's essential. This means that most installations will actually be done as root, normally by using the sudo command (or the GUI equivalent) as this ensures that all the files can be put in the right locations, with most files being below the /usr directory.

The Apache developers are well aware of security concerns and, by default, will install the webserver to run as a specially created user; on my system, most of the apache2 instances are running under the user www-data which I believe is the default (it's a long time since I installed it).

I think you can override the default locations for the actual web files during installation, but normal practice is to use the default (/var/www as I recall) and then link subfolders to there.

In summary, taking the defaults of the installation (run as root or using sudo) will give you a reasonably safe setup and you don't need to take any special action.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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