RE: [PHP] File/Directory Permissions

2002-03-07 Thread Ford, Mike [LSS]

 -Original Message-
 From: Alan McFarlane [mailto:[EMAIL PROTECTED]]
 Sent: 07 March 2002 03:20
 
 I've seen and successfully used the built-in function 
 'mkdir()' on several
 occasions, but I am having trouble understanding the mode parameter.
 
 I've seen 0771, 0775 and 0777 used on several occasions but I am never
 quite sure what to use.

These are actually the *nix access rights of the directory or file.  What you see is 
actually an octal bitmask: the first octal digit (or odgit!) applies to the file or 
directory's owner, the second to all users in the same group as the owner, and the 
third to all other users.  In each case, the odgit is made up by adding together the 
following bitmask values:

4: read permitted
2: write permitted
1: file can be executed; directory can be searched

so a mode of 0750, for example, says that the owner has all rights, other users 
belonging to the same group have read and execute/search, and everyone else has none.  
0777 is the most insecure setting as it gives everyone all rights!

 As a slight side note - can these permissions be applied to 
 files - if so,
 when (and how) would it be done?

Permissions are generally inherited from the parent directory if not explicitly set -- 
so you might set permissions on a file, for example, if you want it to be read-only in 
a directory that is itself set to allow read/write permissions.

Cheers!

Mike

-
Mike Ford,  Electronic Information Services Adviser,
Learning Support Services, Learning  Information Services,
JG125, James Graham Building, Leeds Metropolitan University,
Beckett Park, LEEDS,  LS6 3QS,  United Kingdom
Email: [EMAIL PROTECTED]
Tel: +44 113 283 2600 extn 4730  Fax:  +44 113 283 3211 

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




[PHP] File/Directory Permissions

2002-03-06 Thread Alan McFarlane

I've seen and successfully used the built-in function 'mkdir()' on several
occasions, but I am having trouble understanding the mode parameter.

I've seen 0771, 0775 and 0777 used on several occasions but I am never
quite sure what to use.

Since I write and normally run scripts on a Windows platform (NT WorkStation
SP5), I'm pretty sure it does not affect me, but I would like my code to run
without modification on a *nix platform.

So, can anyone explain the mode parameter for me please?

As a slight side note - can these permissions be applied to files - if so,
when (and how) would it be done?

--
Alan McFarlane




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