Setting file permissions for a local WordPress test site
I’ve always struggled a bit with setting file permissions correctly for my local WordPress test sites. It’s never been a problem on my remote server but locally it’s been a pain.
The problem has been that I can have it one of two ways; I can manage plugins and core updates via the admin but not have correct file permissions to edit files consistently in my IDE or have the correct file permissions to edit the files but not be able to manage plugins and core updates via the admin (WordPress continuously asks for correct FTP credentials).
So I dug into this a bit today and found the following two articles which explain how to set up your local WordPress test site with the correct file permissions; a Linux flavour and an OSX specific mod.
So from these, there was essentially a two-liner that worked for me. The first adds my user to the group
www and the second changes the ownership of the site files to
www. The latter is what allows you to manage plugins and updates via the admin whereas without the former you lose editing capabilities in the Finder / IDE.
Adding my user to the
dscl . append /Groups/www GroupMembership usershortname
Change the ownership to
sudo chown -R www:www .
Written by Steve Perry