11.04, copy a directory

Asked by peter on 2011-07-03


I copied a directory from a USB stick to the harddrive (by Ctrl-C and Ctrl-V). The directory contains a Joomla web side.

If I'll start the backend of this Joomla web side, I'll get the following error message:

You don't have permission to access /siedlung_im_tal/administrator/ on this server.
Apache/2.2.11 (Unix) DAV/2 mod_ssl/2.2.11 OpenSSL/0.9.8i PHP/5.2.8 mod_apreq2-20051231/2.6.0 mod_perl/2.0.4 Perl/v5.10.0 Server at localhost Port 80

I tried to copy the directory in a terminal. For this in the terminal I logged in with GKSUDO. In a second terminal I entered GKSUDO Nautilus and copied the directory by Ctrl-C and Ctrl-V. But I couldn't execute the Joomla web side. I tried to copy the directory by the cp command and I got the following error message:

cp: omitting directory `/media/USB DISK/siedlung_im_tal'

What can I do to get back the needed permissions? Thanks in advance

Question information

English Edit question
Ubuntu apache2 Edit question
No assignee Edit question
Solved by:
Last query:
Last reply:
Chris (fabricator4) said : #1

You can take ownership of the directory. Currently, the owner is probably an administrative user such as the admin login used to administer the site.

You can verify this with a long directory listing. In a terminal:

ls -l /media/USB\ DISK/

you should see the directory in question (filename on the far right)

On the left you will see something that looks like drwxr-xr-x which is the access rights for owner,group,others and then a decimal number, then the owner and group.

Make a note of the owner and group if you ever want to copy this website back onto the server.

Now change the owner/group recursively so that you have full access including read and write:

sudo chown -R username:username /media/USB\ DISK/siedlung_im_tal

Where 'username' should be replaced by your login id.

You should verify the change of ownership with the ls -l command again. If all is well you should be able to copy and use the files with your normal login.


peter (peter-neuweiler) said : #2

Hi Chris

Thanks for your answer. But it didn't help.

The owner and the group was set correct. If I make ls -la /media/USB DISK/siedlung_im_tal, all the directories have a rwx as access rights. But there a php-files they have only a rw as access rights. These files are called configuration.php and index.php.

I guess, this will be the problem. I made sudo chmod 777 for this two files, but it didn't help. I'm still missing the x in the access rights.

The following is the output of ls -la /media/USB DISK/siedlung_im_tal:

peter@peter-linux:~$ ls -la '/media/USB DISK/siedlung_im_tal'
total 384
drwx------ 15 peter peter 16384 2011-06-18 19:03 .
drwx------ 10 peter peter 16384 1970-01-01 01:00 ..
drwx------ 10 peter peter 16384 2011-04-19 04:11 administrator
drwx------ 2 peter peter 16384 2011-04-19 04:11 cache
drwx------ 12 peter peter 16384 2011-04-19 04:11 components
-rw-r--r-- 1 peter peter 1749 2011-06-18 19:03 configuration.php
-rw-r--r-- 1 peter peter 3189 2011-04-07 17:47 htaccess.txt
drwx------ 4 peter peter 16384 2011-07-01 11:19 images
drwx------ 2 peter peter 16384 2011-04-19 04:11 includes
-rw-r--r-- 1 peter peter 1389 2011-02-21 20:44 index.php
-rw-r--r-- 1 peter peter 1245 2011-04-19 04:11 joomla.xml
drwx------ 4 peter peter 16384 2011-04-19 04:11 language
drwx------ 6 peter peter 16384 2011-04-19 04:11 libraries
-rw-r--r-- 1 peter peter 17816 2009-12-12 16:44 LICENSE.txt
drwx------ 2 peter peter 16384 2011-04-19 04:11 logs
drwx------ 8 peter peter 16384 2011-04-19 04:11 media
drwx------ 25 peter peter 16384 2011-04-19 04:11 modules
drwx------ 10 peter peter 16384 2011-04-19 04:11 plugins
-rw-r--r-- 1 peter peter 4493 2011-01-09 03:40 README.txt
-rw-r--r-- 1 peter peter 849 2011-04-03 02:43 robots.txt
drwx------ 6 peter peter 16384 2011-04-19 04:11 templates
drwx------ 2 peter peter 16384 2011-04-19 04:11 tmp
-rw-r--r-- 1 peter peter 1811 2011-04-07 17:30 web.config.txt

What can I do? Thanks a lot.

Manfred Hampl (m-hampl) said : #3

According to https://help.ubuntu.com/community/Joomla#Configure%20Access%20Rights the files for a Joomla web site have to be owned by www-data:www-data
Please check again with the Joomla documentation!

peter (peter-neuweiler) said : #4

Hi Manfred

The username must be peter. www-data:www-data is only written as an example. Thanks.

Manfred Hampl (m-hampl) said : #5

Are you sure that your apache server runs under the 'peter' user ID?
You should be able to check by issuing the command
ps ax | grep apache

Maybe the following commands from https://help.ubuntu.com/community/Joomla#Configure%20Access%20Rights help

cd /siedlung_im_tal #or whatever the name of your directory is
sudo find . -type f -exec chmod 644 {} \;
sudo find . -type d -exec chmod 755 {} \;

peter (peter-neuweiler) said : #6

Hi Manfred

I love you *l. The problem has saved.

It's strange. I used the two sudo commands already, but I got an error message.

Thanks a lot!