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

This question already has an answer here:

I'm unable to create a new document in /var/www/

I followed this tutorial :- How to avoid using sudo when working in /var/www?

and did as suggested, but still I'm unable to make a new document. Any suggestions ?

share|improve this question

marked as duplicate by Radu Rădeanu, Eric Carvalho, guntbert, Raja, Seth Aug 23 '13 at 16:18

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 3 down vote accepted

You need root permissions to write to /var/www folder. You can create/edit files in /var/www folder with sudo.

sudo gedit /var/www/myfile.html


sudo touch /var/www/myfile.html  # only to create a file.


You can choose one of your own directory as your web folder. You can create a folder in your /home directory and change the web server's folder to it.

you can replace "/var/www" string in following files into your own directory path and then you can use new directory as your www folder.


After changing contents of the above files, run

sudo /etc/init.d/apache2 restart

to restart webserver. Then you will be able to use new directory as the web folder.

share|improve this answer

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