File and folder permissions (chmod) in cPanel

Permissions decide who can read, change and run a file. You rarely need to change them: after a site is uploaded, permissions are usually already right. You will need them if the site shows "403 Forbidden", the CMS cannot write a file, or a file with passwords has to be closed for reading.

How to change permissions

  1. Select a file or folder in "File Manager".
  2. Click "Permissions".
  3. Tick the boxes or type the numbers in "Permission".
  4. Click "Change Permissions".
Changing permissions
Changing permissions

You can select several files at once (click with Ctrl) - all of them get the new permissions. Only the selected files and folders change: files inside a folder keep their old permissions.

What the numbers mean

The three digits are permissions for three groups: the owner ("User" in the window), "Group" and everyone else ("World"). Each digit is a sum: 4 - read, 2 - write, 1 - execute. 644: the owner reads and writes (4+2), others only read. 755: the owner can do everything (4+2+1), others read and open the folder.

PermissionsFor
644regular files: .php, .html, images
755folders
600files with passwords, such as wp-config.php or .env
777do not use - such a site is easier to hack

The "Permissions" column of the file list shows the current permissions.

Sites on the hosting run as your user, so no CMS needs 777. If a plugin or installer asks for 777, 755 on the folder is enough.

Permissions for the whole site at once

File Manager does not change permissions of nested files. To set permissions for the whole site, connect over FTP: in FileZilla, right-click the site folder, open file permissions, turn on recursion into subdirectories and apply to files only (644). Then repeat for directories only (755).

Common mistakes

  • A folder was set to 644 - its contents do not open and the site returns 403. Folders need 755.
  • Files were set to 777 "just to be sure" - the site becomes more vulnerable, and world-writable files are a favourite target of malicious scripts.
  • Permissions were changed on a folder in the hope that files inside change too - File Manager does not do that, see above.
Questions and answers
Files 644, folders 755, wp-config.php 600 or 640.
No. Sites run as your user; 777 only makes hacking easier.
Often yes: check that folders are 755 and files 644. Other causes are a missing index file or a deny rule in .htaccess.