Wordpress asks me for FTP credentials when I try to delete or install plugins. I know it has to do with permissions but I have been unable to figure it out. I have a linux system user XYZ and apache2 run as www-data. This works:
sudo chown www-data:www-data -R /path/to/wordpress sudo chmod 700 -R /path/to/wordpress
But it's unsafe. My initially planned configuration was:
sudo chown XYZ:www-data -R /path/to/wordpress sudo chmmod 750 -R /path/to/wordpress sudo chmod 770 -R /path/to/wordpress/wp-content
According to the wordpress docs, wp-content is the only folder which the webserver should have write-access to. It comprises the plugins and themes folders.
But it doesn't work. I've spent several hours researching online but nothing has helped so far and I don't know what to try anymore. What are the right permissions to allow automated updates and plugin installation, without giving the webserver write-access to everything?
For whatever reason, the following does not work:
sudo chown XYZ:www-data -R /path/to/wordpress sudo chmod 770 -R /path/to/wordpress
I thought it to be identical to the first variant above, giving www-data write-access to everything. How is this possible??