Computer filesystems allow you to define access rights i.e. permissions for different files and directories which you can use to determine which users can do what: read, write, modify, etc. Setting the permissions properly is important in order to make sure applications/users will be able to access the needed files and folders (e.g. WordPress might need access rights in order to be able to write to files in your wp-content directory and thus enable certain functions).
Permission Modes
A permission mode is calculated by adding up values for the user, the file group, and for everyone else. The table above is demonstrating an example for 755.
- Read 4 - allowed to read files
- Write 2 - allowed to write/modify files
- eXecute1 - Read/write/delete/modify/directory
The table above is demonstrating an example for 744.
Example Permission Modes
Mode | Str Perms | Explanation |
---|---|---|
0477 | -r--rwxrwx | owner has read only (4), other and group has rwx (7) |
0677 | -rw-rwxrwx | owner has rw only(6), other and group has rwx (7) |
0444 | -r--r--r-- | all have read only (4) |
0666 | -rw-rw-rw- | all have rw only (6) |
0400 | -r-------- | owner has read only(4), group and others have no permission(0) |
0600 | -rw------- | owner has rw only, group and others have no permission |
0470 | -r--rwx--- | owner has read only, group has rwx, others have no permission |
0407 | -r-----rwx | owner has read only, other has rwx, group has no permission |
0670 | -rw-rwx--- | owner has rw only, group has rwx, others have no permission |
0607 | -rw----rwx | owner has rw only, group has no permission and others have rwx |
Permissions will be different from host to host, so this guide will only explain the general principles and is applicable to servers running a standard setup.
Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. Any file that needs write access from WordPress should be owned or group-owned by the user account used by the WordPress (which may be different than the server account).
For example, you may have a user account that lets you send files files back and forth to your server via FTP, but your server itself may run using a separate user, in a separate usergroup, such as dhapache or nobody.
If WordPress is running as the FTP account, that account needs to have write access, i.e., be the owner of the files, or belong to a group that has write access. In the latter case, that would mean permissions are set more permissively than default (for example, 775 rather than 755 for folders, and 664 instead of 644).
The file and folder permissions of WordPress should be the same for most users, depending on the type of installation you performed and the umask settings of your system environment at the time of install.
Typically, all core WordPress files should be writable only by your user account (or the httpd account, if different). (Sometimes though, multiple ftp accounts are used to manage an install, and if all ftp users are known and trusted, i.e., not a shared host, then assigning group writable may be appropriate. Ask your server admin for more info.) However, if you utilize mod_rewrite Permalinks or other .htaccess features you should make sure that WordPress can also write to your /.htaccess
file.
If you want to use the built-in theme editor, all files need to be group writable. Try using it before modifying file permissions, it should work. (This may be true if different users uploaded the WordPress package and the Plugin or Theme. This wouldn't be a problem for Plugin and Themes installed via the admin. When uploading files with different ftp users group writable is needed. On shared hosting, make sure the group is exclusive to users you trust... the apache user shouldn't be in the group and shouldn't own files.)
Some plugins require the /wp-content/ folder be made writeable, but in such cases they will let you know during installation. In some cases, this may require assigning 755 permissions. The same is true for /wp-content/cache/
and maybe /wp-content/uploads/
(if you're using MultiSite you may also need to do this for /wp-content/blogs.dir/
)
Additional directories under /wp-content/ should be documented by whatever plugin / theme requires them. Permissions will vary.
/ |- index.php |- wp-admin | `- wp-admin.css |- wp-blog-header.php |- wp-comments-post.php |- wp-commentsrss2.php |- wp-config.php |- wp-content | |- cache | |- plugins | |- themes | `- uploads |- wp-cron.php |- wp-includes `- xmlrpc.phpUsing an FTP Client
FTP Programs ("clients") allow you to set permissions for files and directories on your remote host. This function is often called chmod,
set permissions
or check attributes in a program menu.
In a WordPress install, two files that you will probably want to alter are the index page, and the css which controls the layout. Here's how you change index.php - the process is the same for any file.
In the screenshot below, look at the last column - that shows the permissions.
Disegard the check boxes. Just delete the 'Numeric value:' and enter the number you need - in this case it's 666. Then click OK.
Using the Command LineIf you have shell/SSH access to your hosting account, you can use chmod
to change file permissions, which is an advanced method meant for experienced users. Before using chmod it is recommendd that you read some tutorials to learn different ways it can be used. This is important because specifying incorrect permissions can disrupt normal site behaviour.
wp-content
directory writable, but before doing this first try safer alternatives like modifying just the directory.chmod -v 746 DIR chmod -v 747 DIR chmod -v 756 DIR chmod -v 757 DIR chmod -v 764 DIR chmod -v 765 DIR chmod -v 766 DIR chmod -v 767 DIR
If those fail to allow you to write, try them all again in order, except this time replace -v with -R, which will recursively change each file located in the folder. If after that you still cant write, you may now try 777.