Reputation: 534
I have aws EC2 and I installed WordPress, I am unable to upload a file from FTP and wordpress, one at a time works.
Scenario 1:if i change 'var/www/html' folders permissions to 755 and owner as ubuntu:ubuntu then i can upload using filezilla but not from wordpress.wordpress shows 'unable to move file '/wp-content/uploads
Scenario 2 :if i change owner to www-data:www-data
then can upload from WordPress but not from FileZilla. It shows error open for write: permission denied
I have used following commands for FileZilla to work:
sudo chown -R ubuntu: ubuntu /var/www/lifestyledesignpros.com/
sudo chmod -R 755 /var/www/lifestyledesignpros.com/public_html/wp-content/
With this FileZilla can upload, but WordPress not so I used following to WordPress to work:
sudo chown -R data:www-data /var/www/lifestyledesignpros.com/
sudo chmod -R 755 /var/www/lifestyledesignpros.com/public_html/wp-content/
Question What permission,/owner should I configure to ../wp-content/
so both FTP and FileZilla can upload files.
Upvotes: 2
Views: 8768
Reputation: 3521
Simply add user 'ubuntu' to a secondary group www-data
.
usermod -a -G www-data ubuntu
Now change ownership to ubuntu:www-data
sudo chown -R ubuntu:www-data /var/www/lifestyledesignpros.com/
sudo chmod -R 755 /var/www/lifestyledesignpros.com/public_html/wp-content/
You could also run the following command so that all the new files created are owned by the group
chmod g+s /var/www/lifestyledesignpros.com/public_html/wp-content/
If you want to fine-tune your control, you could use Access Control Lists .
sudo setfacl -d -m group:www-data:rw /var/www/lifestyledesignpros.com/public_html/wp-content/
Upvotes: 2