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 am new to ubuntu.I install LAMP pakage acording to this page. I want to create new website such as say in this article. but when I create my site in "sites-avalible" and whant to chanege it and save,show a message ...

Error opening file '/etc/apache2/sites-available/mysite': Permission denied

The file on disk may now be truncated!

what I should to do?

share|improve this question
up vote 2 down vote accepted

You need to run your editor with sudo, because site configuration files cannot be modified by users.

For example:

$ ls -l /etc/apache2/sites-available/default
-rw-r--r-- 1 root root  950 2011-06-07 14:56 default

You should try to follow the official Ubuntu Server Guide. It is a very concise and clearly written article on what you'd like to achive.

share|improve this answer

To fix it, use sudo to edit the file: sudo -H gedit /etc/apache2/sites-available/default
Then enter your password, and that's it.

gedit is one possible editor, but you can use any of them you like: vim, nano, pico, etc..

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.