# Simple directory copy permissions issue



## aikiPupil (Feb 25, 2010)

I seem to be having some permissions issues that I am not sure I completely understand.

I am simply trying to copy a directory containing files from one place to another.


The user is a part of the following groups:

```
$ pw usershow dom4in.ss4rv3r -P
Login Name: MYUSER    #1002         Group: wheel             #0
 Full Name: MY USER
      Home: /home/MYUSER            Class:
     Shell: /bin/sh                        Office: [None]
Work Phone: [None]                     Home Phone: [None]
Acc Expire: [None]                     Pwd Expire: [None]
    Groups: www
```

The destimation directory /usr/local/www/apache22/data has the following permissions: (NOTE: I set it to everything trying to get it to work)

```
drwxrwxrwx  2 www   www    -  512 Feb 25 00:23 data/
```
The source directory /usr/home/MYUSER/www has the following permissions: (NOTE: I set it to everything trying to get it to work)

```
drwxrwxrwx  2 MYUSER  wheel  512 Feb 24 01:47 www
```

The file has the following permissions: (NOTE: I set it to everything trying to get it to work)

```
-rwxrwxrwx  1 MYUSER   wheel  -   450 Feb 25 00:53 template.html*
```

The following command is failing due to permissions:

```
$ cp /usr/home/MYUSER/www/*  /usr/local/www/apache22/data
cp: /usr/local/www/apache22/data/template.html: Permission denied
```

I think I might be having a fundemental misunderstanding of how the permissins work in freebsd. 
Should the above command have worked because all permissins were set on the destination directory?

Do I need to change permissions on every directory between the two? That does not seem right.


----------



## Speedy (Feb 25, 2010)

To my knowledge FreeBSD permissions are following the standard.

What are the permissions of /usr/local/www/apache22/data/template.html
What are the permissions of /usr/local/www/apache22/data


----------



## mamalos (Feb 25, 2010)

The permissions of the file /usr/local/www/apache22/data/template.html are the ones you are stating in your post?

try `ls -lao /usr/local/www/apache22/data/template.html` to see if there are any flags on the file that should be handled with chflags.

Then if everything is normal, `rm -f /usr/local/www/apache22/data/template.html` should work (since the directory is writeable by your user), and you should be able to `echo '' > /usr/local/www/apache22/data/template.html` and erase it, if you wanted to.

Lastly, check if there you have enable acls on the partition, if it's mounted read only...and that's all I can come up with at the moment (there are also some stuff regarding MAC that could disallow you to write in the folder, but I don't suppose you have enabled something like that).


----------



## aikiPupil (Feb 26, 2010)

Ok, So I feel pretty awkward now that I realize the problem.

I opened up all the permissions on the file directories and files to copy neglecting to change permissions on the files that were to be copied over and thus the permissions issue.

Thanks everyone with your patience as I am new to unix/freeBSD.


----------

