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*

10
  • 3
    FWIW you can verify this is happening by running ls -il before and after ... if temp's inode number changed, you know it's a different file with the same name. Commented Dec 19, 2012 at 14:12
  • 3
    One could add that rm does not actually remove the file, but just removes a link to the file, and the file doesn't get deleted before the number of links decreases to 0. rm just removes the entry to the file in the directory. If root has another link (hard link) to the file in another directory, the user cannot remove the file. Commented Dec 19, 2012 at 14:21
  • 1
    @Useless I tried, and the number didn't change though the owner and the timestamp changed! Commented Dec 19, 2012 at 18:45
  • 1
    @amyassin You're right! I've updated my answer with an strace excerpt explaining it. Commented Dec 19, 2012 at 19:09
  • 2
    As an aside to your note about Windows vs. Unix permissions, if you want Windows-like behavior in Unix, you can create a directory owned by root (or another user who should have universal remove/rename/etc permissions) and set the sticky bit on the directory. Then users will only be able to delete their own files. Commented Dec 19, 2012 at 19:39