Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Correct file permissions for WordPress #9991

    I set permissions to:

        # Set all files and directories user and group to wp-user
        chown wp-user:wp-user -R *
    
        # Set uploads folder user and group to www-data
        chown www-data:www-data -R wp-content/uploads/
    
        # Set all directories permissions to 755
        find . -type d -exec chmod 755 {} \;
    
        # Set all files permissions to 644
        find . -type f -exec chmod 644 {} \;
    

    In my case I created a specific user for WordPress which is different from the apache default user that prevent access from the web to those files owned by that user.

    Then it gives permission to apache user to handle the upload folder and finally set secure enough file and folder permissions.

    EDITED

    If you’re using W3C Total Cache you should do the next also:

    rm -rf wp-content/cache/config
    rm -rf wp-content/cache/object
    rm -rf wp-content/cache/db
    rm -rf wp-content/cache/minify
    rm -rf wp-content/cache/page_enhanced
    

    Then it’ll work!

    EDITED

    After a while developing WordPress sites I’d recommend different file permissions per environment:

    In production, I wouldn’t give access to users to modify the filesystem, I’ll only allow them to upload resources and give access to some plugins specific folders to do backups, etc. But managing projects under Git and using deploy keys on the server, it isn’t good update plugins on staging nor production. I leave here the production file setup:

    # Set uploads folder user and group to www-data
    chown www-data:www-data -R wp-content/uploads/
    

    www-data:www-data = apache or nginx user and group

    Staging will share the same production permissions as it should be a clone of it.

    Finally, development environment will have access to update plugins, translations, everything…

    # Set uploads folder user and group to www-data
    chown www-data:www-data -R wp-content/
    
    # Set uploads folder user and group to www-data
    chown your-user:root-group -R wp-content/themes
    
    # Set uploads folder user and group to www-data
    chown your-user:root-group -R wp-content/plugins/your-plugin
    

    www-data:www-data = apache or nginx user and group
    your-user:root-group = your current user and the root group

    These permissions will give you access to develop under themes and your-plugin folder without asking permission. The rest of the content will be owned by the Apache or Nginx user to allow WP to manage the filesystem.

    Before creating a git repo first run these commands:

    # Set all directories permissions to 755
    find . -type d -exec chmod 755 {} \;
    
    # Set all files permissions to 644
    find . -type f -exec chmod 644 {} \;
    
Viewing 1 post (of 1 total)