Ubuntu 14.04 server wordpress file permission

chownfile-permissionsUbuntuweb-serverWordpress

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.

Best Answer

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?

Related Topic