I have a file and can't delete it.

File created by user www-data:

-rw-rw-r-- 1 www-data www-data 17408 Jun  3 16:18 0.48257900 1464959885_555.png

I am also trying to delete it by user lifesim:

 rm -rf *
rm: cannot remove '0.48257900 1464959885_555.png': Permission denied

Why I can't delete that file?

lifesim@srvJH:~/public_html/upload/blog/posts/2016-06-03$ whoami
lifesim@srvJH:~/public_html/upload/blog/posts/2016-06-03$ id lifesim
uid=1001(lifesim) gid=33(www-data) groups=33(www-data)
lifesim@srvJH:~/public_html/upload/blog/posts/2016-06-03$ id www-data
uid=33(www-data) gid=33(www-data) groups=33(www-data),1001(lifesim)

File created by my PHP script.

  • What are the permissions of ~/public_html/upload/blog/posts/2016-06-03? – muru Jun 3 '16 at 13:57
  • drwxr-xr-x 2 www-data www-data 4096 Jun 3 16:18 2016-06-03 I think, that's read and exec for group... But why dir permissions? I am access file directly... – Arthur Jun 3 '16 at 13:58
  • 1
  • post the dir permissions where the file is stored: when you want to know who can delete a file, you need to check the permissions of the directory where the file is stored (rw on the file will not help) – TmTron Jun 3 '16 at 13:59

Browse other questions tagged or ask your own question.