I have a folder /var/www/web/images/173
.
$ ls -hal
drwxrwxrwx 4 www-data www-data 524K Mar 30 23:11 173
Folder 173 has owner and group www-data and permissions 777, just for debugging purposes because I am hopeless. All 4 files in the folder have same permissions and owner as the 173 folder www-data:www-data and 777.
When I run PHP script line system("rm -rf /var/www/web/images/173")
I get:
rm: cannot remove '/var/www/web/images/173': Permission denied
I tried different approach from shell $ sudo -u www-data rm -rf /var/www/web/images/173
and I still get permission denied.
Is there some other system setting that prevents user www-data
to execute rm
command? This does not look like PHP problem, because not even direct command in shell can delete the file.
My www-data line in /etc/passwd
:
www-data:x:33:33:www-data:/var/www:/usr/sbin/nologin