Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Linux directory permission inheritance

Can someone explain to me how directory permissions are inherited in Linux (Ubuntu, specifically)?

For example, what if I have the following directory structure:

folder_A
    folder_B

Do folder_A's permissions always override folder_B's? Is there any difference if folder_A's permissions are more restrictive than folder_B's, or vice-versa?

My guess would be that if folder_B had more restrictive permissions, it would override folder_A's, but if folder_A had more restrictive permissions, then it would override its children.

like image 483
Evan LaHurd Avatar asked Jul 19 '13 12:07

Evan LaHurd


1 Answers

The way permissions affect paths is explained in the path_resolution man page: http://linux.die.net/man/2/path_resolution

The only permission on folder A that matters is the search (execute) permission: if you don't have it you can't descend to folder B. Other than that there is no relation between permissions of A and B, for example if A is read-only and B is not, or even if you don't even have read permission to A, you still can create and delete files in B.

like image 64
Joni Avatar answered Oct 01 '22 22:10

Joni