Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

I experienced some weird stuff:

berni@zero:~$ touch wiki
berni@zero:~$ sudo chown root. wiki
berni@zero:~$ sudo chmod 000 wiki 
berni@zero:~$ ls -l wiki 
---------- 1 root root 0 2010-12-11 15:14 wiki

Summary: I created a file which nobody should be able to access in my HOME (~)

My user has default ubuntu permissions, no system tweaks etc.

But I'm able to delete the file without root permission!

berni@zero:~$ ls -l wiki
---------- 1 root root 0 2010-12-11 15:20 wiki
berni@zero:~$ rm wiki
rm: remove write-protected regular empty file `wiki'? y
berni@zero:~$ ls -l wiki
ls: cannot access wiki: No such file or directory
berni@zero:~$ 

This does not work in /tmp or any other folder (!= HOME).

Does anyone knows why this is the case?

share|improve this question
add comment

1 Answer

up vote 7 down vote accepted

Deleting files does not require any permissions on the file or directory you are going to delete, it requires that you have writing permissions in the parent directory and either is the owner of the file or the parent directory.

For example:

/                   root   755
/foo                user   755
/foo/bar            root   644

You cannot delete the /foo directory here, even though you are the owner of it, because you do not have write permissions in the parent directory (/). You can delete /foo/bar, though, since you do have write permissions in the directoy /foo.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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