My client's website is hosted at Digital Ocean and is running Ubuntu 20.04 with Apache. I have WordPress installed and running with some issues. The ability to upload or update plugins and themes is not working because of permission issues. I have been following the official WordPress security hardening article, but I believe some of the changes I have applied have caused the permission issues.
I have detailed all of the current permission settings below for reference. The user for this account is callkneehill.
Root WordPress directory (callkneehill.ca) and files found in /var/www:
- 755
- 644
- Owner and group are callkneehill
wp-admin and wp-include directories and files (recursively applied):
- 755
- 644
- Owner and group are callkneehill
wp-content directories and files (recursively applied):
- 755
- 644
- Owner is callkneehill
- Group is www-data
plugins and theme directories and files (recursively applied):
- 755
- 644
- Owner and group is callkneehill
With these permissions, WordPress informs me that FTP/SFTP needs to be used to upload/update plugins and themes. Before working with the hardening article, www-data was the sole owner and group for permissions within the WordPress root directory.
If I use www-data on the plugins and themes directory, the same FTP/SFTP notice is displayed when trying to upload or update.
How do I go about configuring the user and group permissions to provide the security hardening with the ability to upload/update within WordPress?
Updated with per-user pool configuration settings
Should chdir be /var/www/callkneehill.ca?
/etc/php/7.4/fpm/pool.d
[callkneehill]
user = callkneehill
group = callkneehill
listen = /run/php/callkneehill.sock
chdir = /var/www
listen.owner = www-data
listen.group = www-data
/etc/apache2/sites-available
<FilesMatch \.php$>
# SetHandler "proxy:unix:/var/run/php/php7.4-fpm.sock|fcgi://localhost"
SetHandler "proxy:unix:/run/php/callkneehill.sock|fcgi://localhost"
</FilesMatch>