1

I've been working on securing my WordPress site. It was all working before I changed the permissions. I now get a 403 Forbidden error when trying to log in.

I added my username to the www-data group:

sudo usermod -aG www-data admin

Used the following commands to set the permissions:

sudo find . -type d -exec chmod -R 775 {} \
sudo find . -type f -exec chmod 664 {} \
sudo chown admin:www-data -R wp-content/* 
sudo chmod 660 wp-config.php .htaccess

Can anyone help as I'm struggling to figure out why as it's actually what WordPress said to do.

Here are the permissions - I think the sr is causing the issue on the directories:

drwxrwsr-x  9 admin admin  4096 Jun 19 09:57 wp-admin
-rwxrwxr-x  1 admin admin   364 Jun 19 09:56 wp-blog-header.php
-rwxrwxr-x  1 admin admin  1477 Sep 15 17:55 wp-comments-post.php
-rwxrwxr-x  1 admin admin  4840 Sep 15 18:57 wp-config.php
drwxrwsr-x  8 admin admin  4096 Jun 19 10:25 wp-content
3
  • 1
    Is your hosting managed? Hosting support would be in best position to tell about how it should be on their servers.
    – Rarst
    Commented Sep 17, 2016 at 17:27
  • No it's not managed its a shared box
    – Jamie
    Commented Sep 17, 2016 at 17:34
  • Seems like you added everything to the admin group, while you want the www-data group and their permissions on those files…
    – kaiser
    Commented Sep 18, 2016 at 13:24

1 Answer 1

1

I removed the sticky permission with using the - instead of the + and the website works.

sudo chmod -R g-s

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.