How exactly does Linux file permission inheritance work
I'm familar with file permissions under Linux. However, one thing I'm not sure of is how come I'm able to delete a file when I shouldn't have the right to. I have it set that the parent folder has rights to read/write/execute but the file only has read/execute permission. So why am I able to delete the file? I'm using Debian Sarge and here's the parent folder's permission:
drwxrwxr-x 2 root users 48 2006-04-13 11:35 test The file's permissions are as so: -rw-r--r-- 1 root root 0 2006-04-13 12:45 testfile Now as geneanthony which belongs to the user's group I can delete testfile. However, the permissions on the file says I can't, how come I can? What's the purpose of a file ACL if the parent folder always overrides it? |
Because if a folder/directory has write permission then it overrules the file permissions. Usually you would give the directory read and execute permissions enabling someone to enter the directory, then they can only do what they have permission to do to the file.
I'd suggest you read up a bit more on permissions and create a couple of accounts to play around with to test things out. Also investigate the 'sticky bit' permissions. |
Reply
I am playing around with a few accounts including one circumstance where I changed the permission to give write permission on the file, but none on the folder and I couldn't delete it anymore, so if the folder doesn't have write permission I can't write to a folder no matter what. So basically the only bit that seems to work on files is the executable bit correct? I mean if I don't have read/execute permission on the folder I can't go into the directory anyway and I'll have read permission since it would be inherited as well. I'm not opposed to this system, I'm just trying to understand it.
|
Quote:
|
Reply
I see what you mean. OK, this makes sense now. Thank you for your help.
|
File permissions:
r = read the contents of the file w = modify the file x = run the file as an executable Directory permissions: r = list the contents of the directory, but not 'ls' into it w = delete or add a file in the directory x = move into the directory |
All times are GMT -5. The time now is 01:56 AM. |