This is a discussion on File permissions not preserved with copy function? within the PHP Language forums, part of the PHP Programming Forums category; Folks, Just noticed this with PHP 5 on RHEL 4 -- started using the copy function to move some files around ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Folks,
Just noticed this with PHP 5 on RHEL 4 -- started using the copy function to move some files around and saw that executable permissions were being lost? The documentation didn't say anything about that? Is this a bug or a feature? Thanks. -- John __________________________________________________ _________________ John Murtari Software Workshop Inc. jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM) http://thebook.com/ |
|
|||
|
John Murtari escribió:
> Just noticed this with PHP 5 on RHEL 4 -- started using > the copy function to move some files around and saw that > executable permissions were being lost? The documentation didn't > say anything about that? Is this a bug or a feature? It sounds sensible. Copying means reading the original file, creating a new file and dumping contents in the new file. Let's see an extreme example: -rw-r--r-- root root /usr/share/foo/splash.png Obviously, john should not be able to create a new file owned by root. But he should be able to copy the file if he can read the source and has permissions in the destination directory. Check these functions: umask() stat() chmod() chown() chgrp() -- -- http://alvaro.es - Álvaro G. Vicario - Burgos, Spain -- Mi sitio sobre programación web: http://bits.demogracia.com -- Mi web de humor al baño María: http://www.demogracia.com -- |
|
|||
|
On May 1, 5:43 pm, John Murtari <jmurt...@thebook.com> wrote:
> Folks, > > Just noticed this with PHP 5 on RHEL 4 -- started using > the copy function to move some files around and saw that > executable permissions were being lost? The documentation didn't > say anything about that? Is this a bug or a feature? > > Thanks. > -- > John > __________________________________________________ _________________ > John Murtari Software Workshop Inc. > jmurtari@following domain 315.635-1968(x-211) "TheBook.Com" (TM)http://thebook.com/ I would think that it's probably a feature, a copy is basically creating a new file using the contents of the old as contents. If user B copied a file owned by user A but which he had permission to read, then if permissions were copied then the result would be another file owned by user A. User B may have made a copy of the file belonging to user A in order to make his own modified version, so if the permissions were identical then he wouldn't be able to edit his copy either. |