Knowledgebase

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.

ItemRecommendedMeaning
Folders755Owner can read, write and open; others can only read and open.
Files (PHP, HTML, images)644Owner can read and write; others can only read.
wp-config.php and other files with passwords600 or 640Only the owner (and, with 640, the group) can read it.
Never use 777. It lets any process on the server write to your files, which makes it easy for malware to modify your site. On many hosting setups 777 also causes a 500 error (see how to fix a 500 Internal Server Error). If a plugin "needs 777", the real problem is usually file ownership: contact support instead.

Method 1: change permissions in File Manager

  1. Log in to cPanel and open File Manager (see how to upload your website using File Manager and FTP).
  2. Go to public_html or the folder of your site.
  3. Right-click a file or folder and choose Change Permissions.
  4. Tick the boxes or check the number shown, for example 644, and click Change Permissions.
  5. 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
  1. The first line moves into your website folder. Change it if your site is in an addon domain folder.
  2. The second line sets all folders to 755.
  3. The third line sets all files to 644.
  4. 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.

Need help? Open a support ticket or message us on WhatsApp +20 127 113 3655.

  • file permissions, chmod, 644, 755, wp-config.php permissions, File Manager, cPanel Terminal, صلاحيات الملفات, تأمين الموقع

Was this answer helpful?

0 Users Found This Useful