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
To fix the permission denied error in Linux, one needs to change the file permission of the script. Use the “chmod” (change mode) command for this purpose.
Every Linux user should know the quick fix for the “permission denied” error encountered while executing any shell script. “chmod” command resolves this issue by changing the script's file permissions and allowing it to in an executable format for the current user.
To remove world read permission from a file you would type chmod o-r [filename]. To remove group read and execute permission while adding the same permission to world you would type chmod g-rx,o+rx [filename]. To remove all permissions for group and world you would type chmod go= [filename].
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With