How exactly does Linux file permission inheritance work
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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:
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.
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.
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.
You can write to the file. Open it in $EDITOR, make changes and save it. That should be no problem. You can't change the contents of the directory though, because you have no writing permission there.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.