[plug] Questions for information
Richard Henry
r.henry at murdoch.edu.au
Sun May 5 14:23:15 WST 2002
> > 1. How can you have permission to modify a file that you cannot
> > delete.
> >
>
> To create a file, delete a file or rename a file you need
> write permission for the directory that it is in. To modify
> file you need write permission for the file itself.
>
Just to add a bit: a directory is actually just a file. It contains an
array of filename => inode, where the inode is (basically) an area of memory
where all the information about the file is, such as it's size, permissions
etc.
If you have write permission on a file (lets call it X), you can modify its
contents. You do not need write permission to the directory itself to do
this, because changing the contents of X doesn't change any of the
information in the directory file - it still contains just the filename and
inode location, and these haven't changed.
However, if you try to delete or rename the file, that of course requires
write access to the directory file, because it needs to change the filename
to inode mapping (change the filename in the case of a rename, or remove the
entry in the case of a delete).
Hope this makes sense,
Rich.
More information about the plug
mailing list