I have been using linux for years, but I need some clarification on what are probably pretty basic principles to how the OS works, but I definitely need clarification due to security concerns.

I am in a situation at work where someone has installed parts of a LAMP stack onto our new CentOS server. They have installed everything using the root user, which if I'm not mistaken, means that all those programs(daemons and the like) will run using the root user account. I have been lead to believe, through my experiences, that doing this is a BAD idea.

I have seen some stuff about creating a user for each process, like having a user for apache, mysql, php. Is this the correct way to go about it? If so, how can I create these users with the permissions they need?

Do I create a user account, then install the software using that user account?

I have looked up these questions individually to try to gain some insight, but I feel as though I'm either missing some pieces, or I have misunderstood something. What is most important to me is that I get this set up securely so we don't end up in a bad situation. I could really use some guidance into this matter. If anybody can provide clarification on the issues I have presented, or have some resources I can go through, that would be amazing.

3 Answers 3


"Installing as root user" isn't a bad thing necessarily, especially if they installed using package managers. For e.g., installing mysql on CentOS via yum, will create a mysql user and the mysql process then is usually run as that user.

For starts, see this: https://serverfault.com/questions/212269/tips-for-securing-a-lamp-server . If you have specific questions, post them in a new question here or on serverfault.com.


On most systems, including CentOS you have to install as the root user, to have the rights to write the programs and files to the right locations.

That doesn't mean that the programs once installed run as root. Most won't and some, like Apache will run as a special user. But in order to start these programs and obtain restricted resources (like port 80 and 443) these programs have to be started by root, and then change to a dedicated, non-root user.


You'll need a root access anyway to install and configure any software on your server.

After that you can work as regular user and access your files.

Take a look here for example of installing and configuring LAMP on CentOS server.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .