Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I installed LAMP stack on my ubuntu 11.04 with

sudo apt-get install lamp-server^

Now I navigate to /var/www and use

wget http://ftp.drupal.org/files/projects/drupal-7.x-dev.tar.gz

I get the following error

--2011-08-03 13:59:00-- http://ftp.drupal.org/files/projects/drupal-7.x-dev.tar.gz Resolving ftp.drupal.org... 64.50.233.100, 64.50.236.52 Connecting to ftp.drupal.org|64.50.233.100|: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).

I have no clue how to resolve this error.

UPDATE :

I tried to download the same file in downloads folder, 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
1  

1 Answer 1

up vote 10 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 http://ftp.drupal.org/files/projects/drupal-7.x-dev.tar.gz
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

 
discard

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.