How to define file permissions for WordPress directories and files for ensuring best security?
Permissions defines what users can do with the file or directory. The permissions are represented by a set of numbers called permission mode.
WordPress file permissions:
WordPress file permissions specify who can read, write and execute the files and directories in WordPress website. Permission mode protect the website from unauthorized access by hackers. Permissions are given based on the role that user possess. Along with permission modes, it is always recommended to install security plugins that will reduce the security breach of the WordPress website. Popular WordPress security plugins are: Sucuri, iThemes, Security, Jetpack security, WPScan , Wordfence.
Types of permissions:
Permissions | Meaning | Symbol | Number representation |
Read | View contents of a file or directory | r | 4 |
Write | Can modify the contents of a file or directory | w | 2 |
Execute | Allowed to run script files or scripts inside directory | x | 1 |
No Permission | User has no access to the file or directory | – | 0 |
Roles:
- User : The assigned owner of the file or directory.
- Group : Members of the group that owns the file or directory.
- Others : All users other than file owner or group members
How to identify the permission mode:
- 3 = (2 + 1) = Write + Execute
- 5 = (4 + 1) = Read + Execute
- 6 = (4 + 2) = Read + Write
- 7 = (4 + 2 + 1) = Read + Write + Execute
Example:
Mode | Explanation |
670 | Owner has read and write only, group has read, write and execute, others have no permission |
777 | All have permissions for read, write and execute |
Recommended file permissions for WordPress website
Path | Permission mode |
Root directory (usually public_html) | 755 |
wp-config.php | 444 or400 |
.htaccess | 444 or 644 |
wp-includes | 755 |
wp-admin/js | 755 |
wp-content | 755 |
wp-content/themes | 755 |
wp-content/plugins | 755 |
wp-content/uploads | 755 |
Index.php | 644 or 444 |
Fixing permissions
Therearemultiplewaysto access your files and directories to fix the WordPress permissions. The user can choose whichever is convenient.
permissions using cPanel:
cPanel is an online Linux-based graphical interface (GUI) used as a control panel to simplify website and server management. cPanel allows you to publish websites, manage domains, organize web files.
- Log into your cPanel account. Either find a link on web host dashboard, or type /cPanel after the site
- SEO
- top seo company in kochi