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 the LAMP stack on my Ubuntu 11.04 (Natty Narwhal) with

sudo apt-get install lamp-server^

Now I navigate to /var/www and use


I get the following error.

 --2011-08-03 13:59:00-- Resolving, Connecting to||:80... connected. HTTP request sent,
 awaiting response... 200 OK Length: 2757101 (2.6M)
 [application/x-gzip] drupal-7.x-dev.tar.gz: Permission denied

 Cannot write to `drupal-7.x-dev.tar.gz' (Permission denied).

How do I resolve this error?

I tried to download the same file in the downloads folder, and it went on without an issue. So it seems to be some permission error, but I'm not sure about that or how to solve it.

share|improve this question
up vote 12 down vote accepted

I believe you need root permissions to write to /var/www. So you should use sudo in front of your command i.e

sudo wget
share|improve this answer
this works, but in my desktop, I don't require to use sudo in front of wget – Nikhil Aug 3 '11 at 8:57
@Nikhil: you might have changed the permissions of /var/www on your desktop. Its not wget which needs sudo but the directory /var/www as only root user has write permissions to this directory. – binW Aug 3 '11 at 8:58
this might be the case, because I just used tar to unpack the files, and it also required me to use sudo, which was not the case with desktop version. – Nikhil Aug 3 '11 at 9:01
@Nikhil: tar will unpack the file drupal-7.x-dev.tar.gz and will create few directories and files in the process in /var/www directory. Again as only root has write permissions to /var/www, you need to use sudo to untar the file. If you dont want to use sudo you can either switch to root prompt using "sudo -i" or change the permissions on /var/www directory to allow writes to your username but I WONT RECOMMEND any of these methods. Stick to using sudo, its safer. – binW Aug 3 '11 at 9:05
And remember to accept the answer if it helped :) – binW Aug 3 '11 at 9:06

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.