[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Something weird about file permissions

Hi guys! Something is very weird or I didn't sleep enough last night. I am
puzzled. How can an ordinary user delete a file he has no write access?

See this example:
pep@montblanc:~$ cd /tmp/
pep@montblanc:/tmp$ mkdir test; cd test
pep@montblanc:/tmp/test$ sudo touch file_owned_by_root
pep@montblanc:/tmp/test$ ls -l file_owned_by_root
-rw-r--r-- 1 root root 0 2009-03-31 16:17 file_owned_by_root
pep@montblanc:/tmp/test$ id
uid=1000(pep) gid=1000(pep)
pep@montblanc:/tmp/test$ rm file_owned_by_root
rm: remove write-protected regular empty file `file_owned_by_root'? yes
pep@montblanc:/tmp/test$ ls -l file_owned_by_root
ls: cannot access file_owned_by_root: No such file or directory

I replicate consistently the same operations in several PCs. Doesn't
matter if the file is empty or has any data. So, I am wrong to expect that
rm returns an error when the user doesn't have write rights over that


Reply to: