ImageBundle icon indicating copy to clipboard operation
ImageBundle copied to clipboard

How can I delete files from cache dir as ordinary user?

Open StefanGlaesser opened this issue 6 years ago • 1 comments

The cache directory is owned by www-data:www-data and has initial rights of 0777. Each subfolder has rights of 0755 and is also owned by www-data:www-data. I have an ordinary user which also belongs to the www-data group, but I'm not able to delete files from that directory. So I have the following situation:

$ ls -al
total 32
drwxr-xr-x 2 www-data www-data  4096 Apr 11 19:09 .
drwxr-xr-x 3 www-data www-data  4096 Apr 11 19:09 ..
-rw-r--r-- 1 www-data www-data 20817 Apr 11 19:09 48775fdc58830aef06bf75353c3bae8041df60a8.jpg

So when trying to delete those file I got:

$ rm 48775fdc58830aef06bf75353c3bae8041df60a8.jpg 
rm: remove write-protected regular file '48775fdc58830aef06bf75353c3bae8041df60a8.jpg'? y
rm: cannot remove '48775fdc58830aef06bf75353c3bae8041df60a8.jpg': Permission denied

So how can I setup the cache_directory that I can remove those files? I have some commands which are run by the ordinary user but those commands break down because some files of the image_cache directory can't be deleted/refreshed.

Best regards, Stefan

StefanGlaesser avatar Apr 11 '19 17:04 StefanGlaesser

Hello,

That is the purpose of the GarbageCollector (cleaning old files) I suggest you try to run the demo/gc.php script, that will delete files older than 5 days for instance

You can also consider passing -1 to the days parameters to delete all the files and not only the older ones

Are you hosting your website on a dedicated server or standard hosting ?

Gregwar avatar Apr 12 '19 13:04 Gregwar