Incorrect file permissions are a common cause of problems on web servers. Here is a guide to adjusting them after the fact.
Typical Symptoms
- Web pages display "403 Forbidden"
- PHP scripts cannot write files
- Upload functions do not work
- CMS cannot read configuration files
Standard File Permissions
For a typical web server, we recommend:
- Directories: 755 (rwxr-xr-x)
- Files: 644 (rw-r--r--)
- Configuration files: 600 (rw-------)
Setting Permissions Recursively
To correct permissions retroactively in a directory tree:
For directories: find /path -type d -exec chmod 755 {} ; For files: find /path -type f -exec chmod 644 {} ;
Correcting Ownership
Make sure the files belong to the correct user. The web server user (www-data on Debian, apache on CentOS) must have read access.
If you have questions about filesystem configuration, contact us at info@ingate.de.