Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

This question already has an answer here:

I create a file under my user esolve and then su root and use chown to change its user to root then I returned to user esolve I notice I can still delete the file with rm why?

share|improve this question

marked as duplicate by Gilles, slm, Renan, vonbrand, jasonwryan May 11 '13 at 5:17

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

up vote 5 down vote accepted

Whether you can create, rename and delete a file does not depend on the ownership and access rights of the file but of those of the parent directory.

If you have write access to the directory (in the normal case, it's more complicated with richacl) then you can do this. The exception are directories with the sticky bit (the "SUID"/"SGID" bit for "others", see man chmod) set like /tmp usually. In such directories only the directory owner or the file owner can do this, other users with write access cannot.

share|improve this answer

Because you can remove the file, so if you can read that file, virtually you have "modified permission"

Say you have file named foo owned by root and its readable by you (everyone), under a dir what owned by you

-rw-r--r-- 1 root    root    4 May 11 12:34 foo
drwxr-xr-x 2 you     root 4.0K May 11 12:34 ./

Copy that file to a new file:

$ cp foo bar

-rw-r--r-- 1 root    root       4 May 11 12:34 foo
-rw-r--r-- 1 you     you        4 May 11 12:36 bar
drwxr-xr-x 2 you     root       4.0K May 11 12:36 ./

Edit the file "bar" to whatever you like

Move "bar" to "foo"

$ mv bar foo

-rw-r--r-- 1 you     you        4 May 11 12:36 foo

Now you have new file with same name, but of course different owner. But the point here is the content is changed

You doesnt have the modified permission, but you can rename/move/rm. I really dont get this kind of design!!

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.