2

I have an webserver running Ubuntu 14.04.

I host 3 wordpress 4.1 sites using apache virtual hosts.

The website are working well but I can't upload any picture using wordpress>media>library>add new.

The webistes are located on /var/www/website name/public/ where website name is the name of each website.

There are 3 users for each website all users are in the group www-data.

The file permissions are as fallow:

  • folders: 755

  • files: 644

  • wp-config.php: 600

The folders ownership are as fallow:

  • site1 - user1:www-data
  • site2 - user2:www-data
  • site3 - user3:www-data

Using a ftp client such as FileZilla allows me to upload images to create folders etc.

No other problems with other upload system such as wordpress upgrade, posting, creating pages or installing themes.

The media upload system try to upload files in /public/wp-content/upload/yyyy/mm.

If the path location exists then it returns the error that the image file can't be moved in that location. if the path doesn't exists then it returns the error that it can't create the folder structure in upload folder.

PS.: If I set chmod 777 for wp-content/upload folder then I can upload files but I don't want to due security concerns.

1

Hmm! I'm not super familiar with apache virtual hosts, but I've messed a lot with permissions for php apps running on apache, so here's a stab:

755 is "read/execute only, no write" for group, right? So the apache user (www-data) can't write. You could perhaps run chmod 775 wp-content/upload (775 instead of 755) granting the group write permissions?

  • Yes, it's working and it was what I did as a temporary solution, I was wondering if this is the only solution or the best one ... and also if the wp-content has 755 why I can install new themes which are downloaded in wp-content/themes but I can't upload files in wp-content/uploads? – user1792771 Jan 26 '15 at 6:21
  • Huh! Go figure, that is strange. It looks like the theme editor may need more access: "If you want to use the built-in theme editor, all files need to be group writable" (codex.wordpress.org/Changing_File_Permissions). Could you try chmod -R 775 wp-content ? It's possible a lot of the sub-folders are still only 755. – Ryan S Jan 26 '15 at 16:03

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.