lkml.org 
[lkml]   [2001]   [Mar]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Bug in the file attributes ?
Date
Xavier Ordoquy writes:
> I just made a manipulation that disturbs me. So I'm asking whether it's a
> bug or a features.
>
> user> su
> root> echo "test" > test
> root> ls -l
> -rw-r--r-- 1 root root 5 Mar 29 19:14 test
> root> exit
> user> rm test
> rm: remove write-protected file `test'? y
> user> ls test
> ls: test: No such file or directory
>
> This is in the user home directory.
> Since the file is read only for the user, it should not be able to remove
> it. Moreover, the user can't write to test.

This is definitely not a bug. Deleting a file (under *nix) does not
"modify" the file at all, it is modifying the directory where the file
resides. In this case, a user _will_ have permission to write into
their home directory, so they can delete the file, but not modify it.

Why do such a thing? If you have group/world write permission on a
directory, then people who have write permission to the _directory_
should be able to delete files even if they don't own them. However,
if you set the "sticky" bit on the directory (chmod +t /dir), then only
the owner of the file can delete it, like in /tmp.

Cheers, Andreas
--
Andreas Dilger \ "If a man ate a pound of pasta and a pound of antipasto,
\ would they cancel out, leaving him still hungry?"
http://www-mddsp.enel.ucalgary.ca/People/adilger/ -- Dogbert
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:18    [W:0.121 / U:5.012 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site