Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

12
  • 2
    So it means deleting file is totally dependent on directory permissions only ? Commented Jan 16, 2020 at 14:03
  • See the edit -- it's just something specific to the rm utility. The unlink(2) system call rm is using to remove a file does only care about the permission of the containing directory, with some exceptions like when the directory has its sticky bit set. Commented Jan 16, 2020 at 14:06
  • Can you explain more simply. I am not getting it properly. Commented Jan 16, 2020 at 14:10
  • What exactly do you have trouble with? If user "joe" creates a file inside /tmp (a directory with its sticky bit set), the user "jack" won't be able to delete it, despite having read, write and execute permission to the /tmp directory. It's an exception where the actual permissions of the file also matter, not just those of the directory. Commented Jan 16, 2020 at 14:15
  • 3
    I love (some) standards. But when a question is "why?", any answer that refers solely to an arbitrary set of rules seems incomplete. Example: 'Why shalt thou not steal?' – 'Because of one of the Ten Commandments. Case closed.' But there is usually a rationale behind any rule, e.g. philosophers can debate over stealing. In this case I guess the rationale is: since the file is read-only, the owner probably does not want to lose any bit of data stored within, so it's better to ask before we remove the file as a whole. Commented Jan 16, 2020 at 14:21