Skip to content
Technology for businesses since 2008

Help center · Security

File permissions in cPanel: safe values for WordPress

A file permission is a three-digit number that determines who can read, write, and execute that file or folder. For a WordPress site, the usual values from the WordPress documentation are 755 for folders and 644 for files, with wp-config.php more restricted, such as 600 or 640. The value 777 allows writing by any user on the server and should be avoided: it appears in many old tutorials as a “fix,” but it opens the door to third parties changing your site.

This article explains how to read these numbers, how to check and change permissions in cPanel and FileZilla, and which errors a wrong permission usually causes. Menu and button names may vary depending on your cPanel version and the control panel theme.

What the numbers mean

Each digit corresponds to a group of people who access the file, always in this order:

  1. Owner (the user of your hosting account).
  2. Group (other users in the same group on the server).
  3. Public (any other user on the server, also called “world”).

Each digit is the sum of three permissions:

Permission Value What it allows
Read 4 View the file’s contents or list the folder
Write 2 Change, create, or delete
Execute 1 Run the file or enter the folder

For example, 6 is read plus write (4 + 2), and 7 is everything (4 + 2 + 1). 5 is read plus execute (4 + 1), and 4 is read only.

Most commonly used permissions

Value Owner Group Public Common use
600 Read and write None None wp-config.php and other sensitive files
640 Read and write Read only None wp-config.php, when the server requires group read access
644 Read and write Read only Read only Common WordPress files, such as .php, .css, images, and .htaccess
755 Read, write, and execute Read and execute Read and execute WordPress folders
777 Everything Everything Everything Avoid: anyone can write and execute

On shared hosting, “public” includes other accounts that share the same server. That is why 777 is so risky: if a neighboring site is hacked, an attacker can write to your files if they are open.

The WordPress security documentation generally indicates:

  • Folders: 755. This applies to wp-admin, wp-includes, wp-content, wp-content/uploads, wp-content/plugins, and wp-content/themes, as well as their subfolders.
  • Files: 644. This applies to .php, .css, and .js files, and to images.
  • wp-config.php: more restricted. This file stores the database password and the security keys. The documentation suggests values such as 600 or 640 (some guides go as far as 400 or 440, which prevent writing).

These are reference values. Depending on your server configuration (how PHP runs and who owns the files), you may need a different value. If a recommended value doesn’t work or you are unsure, check with your hosting support before opening permissions further.

Why 777 is dangerous

With 777, any user on the server, and any process running on it, can read, write, and execute the file. In practice:

  • A hacked neighboring site can change your files.
  • A vulnerable plugin can be used to write malicious code into open folders.
  • An attacker’s PHP file placed in a 777 folder can run without anyone noticing.

If a tutorial told you to use 777 and the error went away, the real problem was almost always something else (a wrong owner, or a 644/755 value that was actually incorrect). Go back to 755 and 644 and look for the cause. See also signs that a site has been hacked to check whether anything has already been changed.

How to view and change permissions in the cPanel File Manager

  1. Log in to cPanel and open File Manager.
  2. Navigate to your site’s folder, usually public_html.
  3. In the list, look at the Permissions column (if it doesn’t appear, click Settings in the upper-right corner and enable the column display).
  4. Right-click the file or folder and choose Change Permissions.
  5. Check the read, write, and execute boxes for each group, or type the numeric value, such as 644 or 755.
  6. Click Change Permissions to confirm.

To view hidden files, such as .htaccess, enable the Show Hidden Files (dotfiles) option in the File Manager settings. The step-by-step guide for locating and creating that file is in WordPress .htaccess: how to find and create the default file.

How to change permissions with FileZilla

If you already use an FTP account, FileZilla can also display and change permissions. If you don’t have one yet, see how to create and access FTP accounts in cPanel with FileZilla.

  1. Connect to the server and open your site’s folder in the right-hand pane (the server).
  2. Right-click the file or folder and choose File permissions.
  3. Type the numeric value, such as 755 for a folder or 644 for a file.
  4. To apply the change to several folders at once, check Recurse into subdirectories and choose whether the value applies to directories only or files only. This way you apply 755 only to folders and then 644 only to files, in two passes.
  5. Confirm with OK.

Make bulk changes with care: applying 755 to every file, or 644 to every folder, can take your site down. Before a mass change, make a site backup.

Errors caused by wrong permissions

Symptom Likely cause What to check
Error 500 (internal server error) A PHP file or folder with permissions the server does not accept, or an unreadable .htaccess Folders at 755, files at 644; open the cPanel error log
“Could not move the uploaded file” when uploading images The wp-content/uploads folder does not allow writing by the PHP user Folder at 755 and the correct owner
Cannot install or update plugins and themes The wp-content folder (or plugins and themes) lacks write permission Folder permissions and owner
WordPress asks for FTP details to update PHP cannot write to the WordPress files File owner and permissions
Cannot save the permalink structure .htaccess lacks write permission File at 644 and the correct owner
Blank page or access denied (403) error A file or folder with overly restrictive permissions (for example, 600 on a file the server needs to read) Values of 644 and 755 on public files

A 500 error can have many other causes, such as a faulty plugin or an incompatible PHP version. See how to update the PHP version in cPanel and how to update WordPress without taking the site down for other common causes.

The file owner also matters

Besides the number, each file has an owner and a group. In general, the site’s files should belong to the user of your hosting account. When the owner is wrong, no number will fix it: a file set to 644 that belongs to another user cannot be written by your WordPress.

This usually happens when:

  • The files were restored or copied by another process (a migration or a backup restore) and ended up with a different owner.
  • Someone uploaded files using an account other than your main account.

In cPanel you can see permissions, but you usually cannot change the owner of a file. If you suspect this problem, open a support ticket through contact with the folder that shows the error and the message displayed, so that support can check the owner and the server configuration.

Protect wp-config.php and .htaccess

These two files deserve special attention:

  • wp-config.php: stores your database access details. Use 600 or 640 (or the value support confirms for your server), and never leave it at 666 or 777. If the file was writable by everyone, change your database and site passwords after fixing the permission, following site passwords and access.
  • .htaccess: controls redirects and security rules. In general, 644 is enough. Because WordPress writes to it when you save permalinks, some administrators lock it (for example, at 444) once the site is set up. If you do this, remember to temporarily restore write access when you need to change the rules.

It is also worth making sure wp-config.php and .htaccess are not reachable through forgotten copies, such as wp-config.php.bak or .htaccess.old. Delete the copies you no longer use.

After fixing the permissions

  1. Test the site and the WordPress dashboard (/wp-admin).
  2. Try uploading an image to the media library and updating a plugin.
  3. If the site was already behaving strangely, check for suspicious files. The site flagged as dangerous page and the website virus removal service can help when there are signs of an intrusion.

Frequently asked questions

What is the correct permission for a WordPress site?

The usual values are 755 for folders and 644 for files, with wp-config.php at 600 or 640. Since your server configuration may call for different values, check with your hosting support if something does not work.

Can I use 777 just to make a plugin work?

It is not recommended. 777 leaves the folder open to every user on the server. If a plugin requires 777, look for the real reason: it is usually a wrong owner or outdated documentation. If necessary, contact support.

I changed a permission and the site returned a 500 error. What do I do?

Revert to the previous value, or apply 755 to the folders and 644 to the files. Also check .htaccess and the cPanel error log. If the error persists, contact support through contact.

How do I know whether the problem is permissions or ownership?

If the permissions are already 755 and 644 and the write error continues, the owner is the most common suspect. Because cPanel usually does not allow changing a file’s owner, ask support to check it.

Do I need to change permissions after installing a plugin?

Usually not. Plugins and themes installed from the WordPress dashboard already get the permissions the server sets. Only change them if there is a write error or a file was left more open than it should be.

Can wrong permissions be a sign of a hack?

They can. New files set to 777, or a wp-config.php that changed without you touching it, are warning signs. See signs that a site has been hacked and how to protect the WordPress login.

More on Security

See all →

Help center

Looking for something else?

See all tutorials, organized by topic.