Just after setting up your wordpress site, and writing a test article, you just want to upload some photo, wallpaper, wp header image etc. and the media uploader gives you the error
Unable to create directory wp-content/uploads/year/month. Is its parent directory writable by the server?
this means, that your directory on the webserver is not owned by your webservice that’s running the webserver. In many cases this is apache2.
To quickly find out under what user apache2 is running, grep it to a process command:
ps aux | grep apach
and it will show you some lines starting with:
www-data 32154 0.0 0.0 1021 912 ? S 15:00 0:00 /usr/sbin apache2 -k start
The very first word is the user it’s running under. This is www-data by apache2 servers, or maybe www.
Now look at the permissions of your wordpress directory, by navigating to it. Depending on your webserver this can vary, apache2 installed by a simple apt-get install apache2 defaults to /var/www.
cd /var/www/wp-content
ls -la
Notice the usernames, which can be root or yourusername or www-data. Probably, it’s not www-data, so we give the directory to apache2 by chown’ing it:
chown -R www-data .
and / or
chown -R www-data *
Try uploading the picture again, and it should work.
Do not try to set permission using chmod 0777 or 0775 as this is a security risk!