This article describes how to securely fix the wordpress “Unable To Create Directory Error”
This is a general permissions error and may be uncovered in a variety of situations; the most common of these is when trying to upload images:
“Unable to create directory /wp-content/uploads//. Is its parent directory writable by the server?”
There are many various articles about this error and horrifically, a lot of them advise fixes which are glaring security holes and can / will lead to compromise of the web server.
They look something like this: “Change permission of directories to 757 or 777” – doing this allows anyone on the internet to upload write files to your directory!!!
Here is the secure solution:
- Check to see which user & group the apache web server runs under. This information is held in the /etc/apache2/envvars file and you can view it as follows:
- Create the directory in question if necessary – note: it may already exist:
- Change the group ownership of the directory to the group apache runs under – in this caseĀ you can see that the group is “www-data”:
- Assign write permission to the group for that directory:
Job done!