Understanding File Permissions (CHMOD 644 vs 755)
Every file and folder on your Jiinubi server has permissions that determine who can read it, write to it, or run it as a program. Setting these incorrectly can either break your website or leave it vulnerable to hackers.
The Three Types of Access
- User (Owner): That’s you (your cPanel account).
- Group: Other system processes or users in your group.
- World (Public): Everyone else on the internet.
The Number Breakdown
Permissions are usually expressed as a 3-digit number (e.g., 644). Each digit is a sum of these values:
- 4 (Read): Permission to view the file or list folder contents.
- 2 (Write): Permission to edit/delete the file or add files to a folder.
- 1 (Execute): Permission to run a script or "enter" a folder.
Standard Best Practices
- For Files: 644
- What it means: You (Owner) can read and write; the world can only read.
- Use for: HTML files, images, CSS, and most PHP scripts.
- Why: Allows the web server to show content while preventing visitors from changing your code.
- For Folders: 755
- What it means: You (Owner) have full control; the world can "enter" the folder and see contents but cannot modify them.
- Use for: All directories (e.g., public_html, wp-content).
- Why: Folders need "Execute" permission for the world; otherwise, visitors get a 403 Forbidden error.
- For Sensitive Files: 600 or 400
- Use for: wp-config.php or other files containing database passwords.
- Why: Restricts reading to only your account, protecting your credentials.
⚠ Warning: Never use 777 permissions. Setting a file or folder to 777 (Read+Write+Execute for everyone) is like leaving your front door wide open. Any user on the server or a malicious script can edit, delete, or upload malware to that directory.
How to Change Permissions in cPanel
- Open File Manager.
- Right-click the file or folder.
- Select Change Permissions.
- Tick the boxes or type the 3-digit code (e.g., 755) and click Change Permissions.
CHMOD Quick Reference
| Setting | User (Owner) | Group | World (Public) | Result |
|---|---|---|---|---|
| 644 | RW- | R-- | R-- | Safe for Files |
| 755 | RWX | R-X | R-X | Safe for Folders |
| 777 | RWX | RWX | RWX | DANGEROUS |