I just installed apache2 and WordPress on my RPi. I followed this tutorial.

After its successful installation, I moved on to customization. But when I upload any images, etc.

I receive the following message,

Error rit Logo ful…2 - Copy.jpg Unable to create directory wp-content/uploads/2015/01. Is its parent directory writable by the server?

I am unsure of how to proceed. Do I have to change the file permissions to writable or change owner of the directory ?

Please advise on how to overcome this error along with appropriate commands.

  • The web-server's group should be used for the web-related files, and also, the server usually owns the files too. If only the group is set, then you should make the directories (and files you want the server to change) group-writable (chmod g+w). If the server actually owns the files, it should work without setting permissions. – orion Jan 26 '15 at 10:54
  • I am sure who owns the files. The directory is /var/www/ and the server is apache2. I tried to upload a image file using wordpress' customization tool. That is where I received the said error message. – BharathYes Jan 26 '15 at 11:07
  • Just check ls -l on the files (and ls -ld on the directory you want to be writable) and tell me what you see. – orion Jan 26 '15 at 12:08
  • @orion I got the following pi@pi01 /var/www/wp-content/themes $ ls -ld drwxr-xr-x 5 www-data www-data 4096 Dec 18 18:18 . – BharathYes Jan 26 '15 at 12:16
  • Is www-data the username that apache uses? Check ps -up $(pidof httpd) and the apache config file for User and Group keywords. Also check if [...]/uploads/2015/... has the same users and permissions as the rest of the directories. – orion Jan 26 '15 at 12:25

The solution that seems to be working was

chown -R www-data:www-data /var/www

Credits to Raspberry user nevil-verdoold and also to orion.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.