10

I couldn't delete a file even I change its mode, its user, group properties to proper ones, and even I tried sudo it. I keep receiving "permission denied". Looked online and this forum to no avail.

This happened in a Ubuntu v.18.04 subsystem for Windows. (WSL).

can you help?

jon@competition:~/projects/medium-blog-kafka-udemy/udemy-reviews-producer/target/classes/avro$ ls -l
total 4
-rw-rw-rw- 0 jon jon 1320 Oct 11 12:28 udemy-review.avsc
jon@competition:~/projects/medium-blog-kafka-udemy/udemy-reviews-producer/target/classes/avro$ sudo rm -rf udemy-review.avsc
rm: cannot remove 'udemy-review.avsc': Permission denied
J.E.Y
  • 1,173
  • 2
  • 15
  • 37
  • 2
    `sudo fuser -v -m udemy-review.avsc` will tell you if the file is locked by a process. – LegendofPedro Oct 11 '19 at 19:06
  • Thanks, that's a very useful command, I found out it's WSL's init()/bash shell lock the file. After closing those consoles the problem is gone. – J.E.Y Oct 12 '19 at 02:52

1 Answers1

5

To delete a file you don't need write permission for the file but write and execute permissions for the folder(directory) the file is in.

Sachin Yadav
  • 748
  • 9
  • 28