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 installed a local web-server (apache2, php5, mysql). All the time I want to edit some permissions or to create a folder or to add some lines to hosts I need to login as a root.

Do I need to grant privileges by the root all the time for this folders and files or is there a way to make it at once? Maybe i should reinstall webserver by the user i want to use one?

share|improve this question
up vote 0 down vote accepted

You can do it by giving the file ownership to the user. Use chown command to do that.

ex: chown -R user website_folder

[-R is for recursively change file ownership; change user and the folder accordingly].

And make sure you have write permission too. You can set write permission with chmod.

ex: chmod +x webpage.html

[The above command will give the write permission to the current user]

share|improve this answer
This means i have to do it every time i want to create a project.. Or if i change user to basic webserver folders i would not have to change it after? – Rootical V. Jun 1 '12 at 13:43
No, you can do chown -R user /var/www. it will change all permission. But don't change permissions of /etc/php5 (or any file in /etc/ ;). It is not a good practice. – Manula Waidyanatha Jun 1 '12 at 13:47

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.