Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

can't remove "permission denied" file - even with "sudo" and proper user/group set

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
like image 866
J.E.Y Avatar asked Oct 11 '19 18:10

J.E.Y


People also ask

How do you remove denied permissions in Linux?

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.

How do I fix permission denied chmod?

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.

How do I remove permissions from a directory in Linux?

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].


1 Answers

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.

like image 63
Sachin Yadav Avatar answered Oct 04 '22 18:10

Sachin Yadav