I have a folder, which was created by the Docker, but nginx seemed to have no access for it. When i'm trying to access (delete) it manually, i'm getting

rm: cannot remove '0': Permission denied

error. So here's what is going on:

ubuntu@ip:/data/nginx-cache$ ls -l 
total 80 
drwxr-xr-x 2 ubuntu ubuntu 4096 Apr 29 09:48 0

ubuntu@ip:/data/nginx-cache$ rm -rf 0 
rm: cannot remove '0': Permission denied

I've been playing with chmod, even tried to set it to 777, but still getting the same error.

PS: please, dont offer sudo, i'm trying to get whats going on there. Its looking super strange for me: i have my user's access there, i have my user's group access there, but still "permission denied".


 -------------e-- ./0

getfacl 0
# file: 0
# owner: ubuntu
# group: ubuntu user::rwx group::r-x other::r-x
  • What's the output of lsattr and getfacl on that directory? – dsstorefile1 Apr 29 '18 at 10:23
  • 1
    @dsstorefile1 added output to the question – Vitalii Vasylenko Apr 29 '18 at 10:25
  • Might be MAC then. I'll let someone else answer. – dsstorefile1 Apr 29 '18 at 10:30
  • 2
    I believe that the problem is with the permissions of the parent directory, please add the output of ls -ld /data and ls -ld /data/nginx-cache to your question. – mook765 Apr 29 '18 at 10:39
  • @mook765 Thanks for answer - i'm pretty sure that parent's owner was the same. Mostly probably i'm wrong, because after i deleted everything and deployed again, everything works fine. My bet is that i didnt restart after sudo usermod -aG docker $(whoami) when installed Docker, so those folders were created by root or something like that. I dont see any other logical explanations. – Vitalii Vasylenko Apr 29 '18 at 15:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.