Linux File Permissions Explained
File and directory permissions control who can read, write, and execute files on your hosting account. Incorrect permissions are a common source of both security vulnerabilities and website errors.
How Permissions Work
Every file and directory has three permission levels:
- Owner: The user who owns the file (typically your cPanel user).
- Group: Users in the same group as the owner.
- Others (World): Everyone else, including web visitors.
Each level can have three types of access:
- Read (r = 4): View the file contents or list directory contents.
- Write (w = 2): Modify or delete the file, or add files to a directory.
- Execute (x = 1): Run the file as a program, or access files within a directory.
Common Permission Values
- 644: Owner can read and write. Group and others can only read. Standard for files.
- 755: Owner can read, write, and execute. Group and others can read and execute. Standard for directories.
- 600: Only the owner can read and write. No access for anyone else. Use for sensitive files like
wp-config.php. - 750: Owner has full access. Group can read and execute. Others have no access.
- 777: Never use this. Everyone can read, write, and execute. This is a serious security risk.
Recommended WordPress Permissions
- Directories:
755 - Files:
644 - wp-config.php:
600or640 - .htaccess:
644
Changing Permissions in cPanel
- Open File Manager in cPanel.
- Navigate to the file or directory you want to modify.
- Right-click and select Change Permissions.
- Set the appropriate values using the checkboxes or enter the numeric value directly.
- Click Change Permissions to save.
Fixing Permission Errors
If you see 403 Forbidden errors, permissions are likely too restrictive. If WordPress cannot update itself or install plugins, the wp-content directory may need 755 permissions. Never set files to 777 as a quick fix — it exposes your site to serious security risks.