How to set secure file permissions (644 and 755) in cPanel
Wrong file permissions can either break your website or leave it open to attackers. This guide explains what the numbers 644 and 755 mean, which permissions are safe for a website on cPanel hosting, and how to set secure file permissions using File Manager or the Terminal.
What the numbers mean
Every file and folder has three groups of permissions: the owner (your cPanel user), the group and everyone else. Each digit is the sum of: 4 = read, 2 = write, 1 = execute.
| Item | Recommended | Meaning |
|---|---|---|
| Folders | 755 | Owner can read, write and open; others can only read and open. |
| Files (PHP, HTML, images) | 644 | Owner can read and write; others can only read. |
wp-config.php and other files with passwords | 600 or 640 | Only the owner (and, with 640, the group) can read it. |
Method 1: change permissions in File Manager
- Log in to cPanel and open File Manager (see how to upload your website using File Manager and FTP).
- Go to
public_htmlor the folder of your site. - Right-click a file or folder and choose Change Permissions.
- Tick the boxes or check the number shown, for example 644, and click Change Permissions.
- The Permissions column in File Manager shows the current value for every item, so you can quickly spot anything set to 777 or 666.
This method is good for a few files. For a whole website, use the Terminal.
Method 2: fix all permissions with the Terminal
If your plan includes Terminal (in the Advanced section of cPanel) or SSH access, you can reset a whole site in seconds.
Warning: these commands change every file and folder under the path you give. Check the path carefully and take a backup first (see how to back up and restore your website).
cd ~/public_html
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
chmod 600 wp-config.php
- The first line moves into your website folder. Change it if your site is in an addon domain folder.
- The second line sets all folders to 755.
- The third line sets all files to 644.
- The last line protects the WordPress configuration file. Skip it if your site is not WordPress.
If the site shows an error after setting wp-config.php to 600, set it to 640 instead.
Common problems
- "Permission denied" when uploading: the folder may be 555 or owned by another user. Set it to 755; if that is not allowed, ask support to fix ownership.
- Plugin cannot update itself: usually an ownership problem, not a permission problem. Do not use 777.
- Permissions keep changing back: malware sometimes sets files to 444 so you cannot clean them. Scan the site (see how to know if your website is hacked).
Frequently asked questions
Do I need execute permission (755) on PHP files?
No. PHP files are read by the web server, so 644 is enough. Only folders need 755 so they can be opened.
Is 644 safe if "everyone" can read my files?
Yes. On EgWeb servers each account is isolated, so other customers cannot browse your files. Use 600 or 640 for files that contain passwords as an extra layer.