Correct File Permissions For Wordpress

Correct file permissions for WordPress

When you setup WP you (the webserver) may need write access to the files. So the access rights may need to be loose.

chown www-data:www-data  -R * # Let Apache be owner
find . -type d -exec chmod 755 {} \; # Change directory permissions rwxr-xr-x
find . -type f -exec chmod 644 {} \; # Change file permissions rw-r--r--

After the setup you should tighten the access rights, according to Hardening WordPress all files except for wp-content should be writable by your user account only. wp-content must be writable by www-data too.

chown <username>:<username>  -R * # Let your useraccount be owner
chown www-data:www-data wp-content # Let apache be owner of wp-content

Maybe you want to change the contents in wp-content later on. In this case you could

  • temporarily change to the user to www-data with su,
  • give wp-content group write access 775 and join the group www-data or
  • give your user the access rights to the folder using ACLs.

Whatever you do, make sure the files have rw permissions for www-data.

file and folder permission settings for WordPress folder on linux

Try adding both owner as admin01 and user as www-data. This will help you:

sudo chown admin01:www-data -R /var/www/html/counsyl

Try this, it should work. Structure is like

chown -R USERNAME:GROUPNAME /PATH/TO/FILE

Thank you

Wordpress new folder and file permissions are not correct

Adding these two lines to the wp-config.php file solved the problem:

define('FS_CHMOD_FILE', 0644);
define('FS_CHMOD_DIR', 0755);

Upload file wordpress

You need to set folder permissions for /uploads/ and possibly for /wp-content/ , too.

Typically, both folders should be 755. You may have to temporarily raise /uploads/ to 777 and upload an image (this will also force the server to change the folder permissions and user to the correct settings), but change it back to 755 right away.

It's easiest to set permissions with an FTP client. See Filezilla and FTP Clients « WordPress Codex.

And see Changing File Permissions « WordPress Codex for the correct Wordpress permission settings:

From the codex.wordpress: Typically, all files should be owned by your user (ftp) account on your web server, and should be writable by that account. On shared
hosts, files should never be owned by the webserver process itself
(sometimes this is www, or apache, or nobody user).

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 FTP files back and forth to your server, but
your server itself may run using a separate user, in a separate
user group, 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).



Related Topics



Leave a reply



Submit