How to copy files to /var/www on Linux?

5

3

I’m trying to copy files to the /var/www folder on Ubuntu 10.04. But I think I don’t have the permissions.

How can I do this? Is there some specific permission I should set to this folder?

rogcg

Posted 2010-08-24T12:47:23.530

Reputation: 181

Answers

12

Since /var/www is not owned by your user, you need sudo privileges to do so. From a terminal, you could run:

sudo cp file_you_want_to_copy /var/www

Nikolaus Gradwohl

Posted 2010-08-24T12:47:23.530

Reputation: 601

14

You're missing the basics. Take a look here: http://www.redhat.com/docs/manuals/linux/RHL-9-Manual/getting-started-guide/s1-navigating-ownership.html

Now if you don't want to read everything: If you regularly need to edit files in /var/www, you should consider changing the owner/group and permissions on that directory.

If your username is 'user', try this:

sudo chown user /var/www

OR:

sudo chgrp user /var/www
sudo chmod 775 /var/www

Now you can copy a file with: cp file /var/www/

If you just want to copy 1 file without messing with permissions, use:

sudo cp file /var/www/

Lekensteyn

Posted 2010-08-24T12:47:23.530

Reputation: 5 236

2

Try using

gksudo nautilus

in the terminal, then navigate to /var/www and you can create, copy or delete files.

marcelo

Posted 2010-08-24T12:47:23.530

Reputation: 21

0

If gksu is not already installed:

sudo apt-get install gksu

Then do the following:

gksu nautilus /var/www/html

MindBrain

Posted 2010-08-24T12:47:23.530

Reputation: 221