Daniel Quappe wrote:
hi list,
today i found something which i never had recognized before...;-)
situation 1: if i touch a file as user "root" in /home/daniel and the "/home/daniel"-dir is 755, the user "wwwrun" (after "su - wwwrun") CANNOT remove the created file (mode 700, owned by root).
situation 2: if i now "chmod 777 /home/daniel" the created file (still mode 700, owned by root) CAN be removed by the user "wwwrun"...very strange to me!
does the worldwriteability of the dir have a higher priority than the permission-mode of the file itself (the file was mode 700 and owned by root!!)?!
best regards,
daniel
Look at it this way: in situation 2, if wwwrun deletes the file this only affects the contents of the _directory_. The contents of the _file_ is neither read nor changed! I agree completely that this may be _unexpected_ behavior to many people but it is systematic according to the simple rules. Directories are like Textfiles with a lot of lines in it saying: name abc is a shortcut for inode 4711. If you have write-access to a directory, you may change the content of the directory (this "file"). And every single line may me changed (or even deleted) by everyone having write-access! Access-rights for a directory mean nothing to the _contents_ of the files... regards Roland