Re: Recursive permissions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Sat, Feb 18, 2006 at 06:07:16PM -0500, tedd wrote:
> >On 2/18/06, tedd <tedd@xxxxxxxxxxxx> wrote:
> >> Hi gang:
> >>
> >> Question: I know you can set a directory to have certain permissions,
> >> but how do you set the permissions to be recursive? In other words,
> >> for example, if you set the directory to be 755, then everything
> >> placed within that directory will also be 755.
> >
> >http://php.net/manual/en/function.umask.php
> >
> >--
> >Kim Christensen
> 
> 
> Kim:
> 
> Thanks, but are you sure about that?

In a way, yes. It is rather unclear because, well a 755 on a normal
file isn't and shouldn't be needed. 

It also depends on how the file is created, by default most file
creation tools will always try to create a file with 666
permissions and  directory creation with 777.  The umask is an XOR
value that should be applied to the creation. 

Assuming umask is set to 022, when you create a dir
777 XOR 022 == 755; make a file, 666 XOR 022 = 644.

So if your directories dont end up with a 755 setting your umask is
set to something other than 022. 

> 
> What I'm looking for is how to set the permissions for a directory 
> such that all files in it will have the same permissions.

Directoryies require that you have the x (execution aka octet 1) bit set in
order to get a listing of the directory. Thus why you have 755 on
directories. 

Files should only have the x bit set if they actually should be
executed, otherwise they should be 644.

Now with all that. if you set a umask of 133, and dont need to ever
get a directory listing of files, you most likely will be able to
maintain a file structure that everything has the same permissions
but it will only be 644.

> 
> I use GoLive and in their file "FTP access" settings they have a 
> recursive checkbox. If the checkbox is not checked, then whatever 
> permission setting I give to a directory is just to the directory. 
> However, if it the recursive checkbox is checked, then all files 
> placed in the directory will have the directory's permissions. 
> Perhaps this is something limited to GoLive and not an option in 
> setting chmod's via php's built-in functions.
> 
> I am aware of how to change the contents of a directory to a specific 
> chmod using a recursive php routine, but I was looking for a simpler 
> way.

Your question is really not clear what the problem is.  It seems
you are having some issues with permissions, and is probably due to
your ftp access vs your web access but that is a guess at this
point.

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux