Unix File Permissions
File Permissions control what other system
users have access to your files. Be VERY careful
before making permission changes as you may effect scripts
installed on your site. Do a good check after making any updates.
File Permissions are broken into 3 sections:
User - For the owner of the file (usually you).
Group - For other users within the same group as the owner.
Other - For all other system users.
There are 3 types of permissions for each section :
Read - Controls the ability to read the file.
Write - Controls the ability to write to the file.
eXecute - Controls the ability to execute the file.
Common Permissions
File Type | Users | Group | Other |
Directories (Folders) | rwx | rx | rx |
Web Pages (html, php) | rw | r | r |
Graphics (.gif,.jpg,.png) | rw | r | r |
CGI Scripts | rwx | [NONE] | [NONE] |
Data Files | rwx | [NONE] | [NONE] |
Notes
- All CGI scripts and also ASP scripts execute as you. They are able to read and write files even though
no one else has permission. CGI scripts also do not have to be readable by anyone else. ASP scripts, since they
are embedded in web pages used by the server, must be readable by other -- but files they access can be
accessible only to you. If you are using a PERL/ASP script to invoked MySQL, you should set any files containing
passwords to be read/write ONLY by you. We also recommend you keep that information in one "include" file
used by the rest of your site.
- All PHP scripts execute as the webserver, they have very limited permissions. For a PHP script to read/write
a file you must open the permission to "Other", this include directories. PHP scripts also have some security
checks which only allow them to access files owned by you, they cannot read other files on the system.
If you are using a PHP script to invoke mySQL you can include the file "passwd.inc.php" in your phpMyAdmin directory.
It is ONLY readable by the webserver, and has the following variable defined which you can use to access
your password:
$cfg['Servers'][1]['password'] = '7aL987LCZu3zzy';
// Your MySQL password
For example, you would add the following lines to your existing PHP script.
....
include ("/pub/users/your-site/www/phpMyAdmin/passwd.inc.php");
....
$DBpassword =
$cfg['Servers'][1]['password'];