• I am a complete newb and trying to figure out how to set correct permissions for WordPress folders in order to be able to update/install plugins and themes.
    I installed WordPress on my desktop and playing around creating a website on localhost. The local website is installed in the /opt/lampp/htdocs/site_name/ folder.
    Right now I am showing owner as www-data with permissions set as 755. This does not seem to work as I cannot install/delete plugins. In WordPress admin Tools –> Site Health it shows that none of the folders are writable.

    The main WordPress directory Not writable
    The wp-content directory Not writable
    The uploads directory Not writable
    The plugins directory Not writable
    The themes directory Not writable

    Who should the owner of all these folders be? Is it apache www-data or my login account?

    Directories information as reported in WordPress:

    wordpress_path: /opt/lampp/htdocs/site_name
    uploads_path: /opt/lampp/htdocs/site_name/wp-content/uploads
    themes_path: /opt/lampp/htdocs/site_name/wp-content/themes
    plugins_path: /opt/lampp/htdocs/site_name/wp-content/plugins

    There is also a WordPress folder in /usr/share/wordpress

    • This topic was modified 2 years, 7 months ago by jarhead8286. Reason: Added additional information
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator t-p

    (@t-p)

    Please Check this documentation on file permissions

    Thread Starter jarhead8286

    (@jarhead8286)

    I did see that document and set my permissions to the same. i set the owner to www-data and added my user account to the www-data group. This has been driving me nuts the entire day.

    Dion

    (@diondesigns)

    Is this a true localhost setup, meaning you’re accessing the site as https://localhost?

    If so, there’s a fairly simple solution. Let’s say your login user is jarhead. First, revert the ownership and permissions, as follows:

    sudo chown -R jarhead: /opt/lampp/htdocs
    sudo chmod -R g-w /opt/lampp/htdocs
    sudo chmod -R o-w /opt/lampp/htdocs

    Then edit the Apache configuration and change three lines so they look like this:

    Listen 127.0.0.1:80
    User jarhead
    Group jarhead

    If your setup supports SSL, then also add the following line:

    Listen 127.0.0.1:443

    Now restart Apache, and your issue should be resolved.

    Please be aware that the above is a serious security risk if you change the Listen directive(s) to allow the outside world to access your localhost site. If that’s what you want, revert file ownership/permissions as above, and then install/configure PHP-FPM to run as the jarhead user instead of changing the Apache configuration.

    Thread Starter jarhead8286

    (@jarhead8286)

    Dion,
    Your solution worked like a charm – than you very much.

    Yes, this is a localhost installation for me to practice creating a website and I don’t want the outside world to access my localhost.

    I am trying to understand what I was doing wrong that it wasn’t working for me. I did try to change the ownership to “jarhead” and permissions using these commands but could not fix the problem:

    sudo find /opt/lampp/htdocs/site_name/ -type d -exec chmod 755 {} \;
    sudo find /opt/lampp/htdocs/site_name/ -type f -exec chmod 644 {} \;

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘WordPress permission settings’ is closed to new replies.