Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Minimum file permission needed to delete a file in Linux

To delete a file in Linux,

  • What minimal permissions do we need to set on it?
  • What minimal permissions do we need to set on its parent directory?
like image 794
parmar7725274 Avatar asked Sep 19 '25 01:09

parmar7725274


1 Answers

You need to have x-permissions and w-permissions on the directory (and of course x-permissions on all parents), that is all.

mkdir foo
touch foo/bar
chmod 300 foo
chmod 000 foo/bar
rm -f foo/bar

But when testing you might stumble into thinking that you need more (e. g. r-permissions for the directory or whatever). This will be only due to false testing ;-)

like image 188
Alfe Avatar answered Sep 20 '25 23:09

Alfe