Kiran Dash
Kiran Dash

Reputation: 4956

file and folder permission settings for WordPress folder on linux

I have moved my website project to a linux environment and I have an issue assigning permission.

Command that I run:

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

find . -type d -exec chmod 755 {} \;

find . -type f -exec chmod 644 {} \;

If I set

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

where admin01 is the username, and this user is not root. I am able to edit the files and folders but the issue is I can't add images or upload plugins etc from the WordPress admin area.

enter image description here

If I run the following command

sudo chown www-data:www-data -R *

It allows me to upload images or plugins etc. But now I am unable to edit the files etc from admin01 account.

enter image description here

So what might be the correct permission so that I can edit the files with admin01 user(not root) and at the same time upload files and folders from the WordPress admin area? I will appreciate if you can give some explanation also so that I understand what I am doing wrong.

Permissions of folders and files inside WordPress folder after running the command

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

enter image description here

Upvotes: 1

Views: 8328

Answers (2)

Nikhil Parmar
Nikhil Parmar

Reputation: 499

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

Upvotes: 1

Ghanshyam Dekavadiya
Ghanshyam Dekavadiya

Reputation: 153

Have you tried with 755 permission mate?

chmod -R 755 /var/www/html/counsyl

I think above will help you

Upvotes: 2

Related Questions