Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have some directories, with following permissions:

drwxr-xr-x 18 user1 root 4096 Oct 27 11:25 /home/test1/test2
drwxr-xr-x 24 user1 root 4096 Oct 21 08:38 /home/test1
drwxr-xr-x 492 root root 12288 Nov 17 01:31 /home
drwxr-xr-x 23 root root 4096 Nov  6 18:46 /

My question:

If I understand right, permission of /home says that only root can add/delete files (or directories) in this directory, but then there's the directory test1 which has user1 as its owner. That means that user user1 can add/delete files (or directories) in /home/test1. Does this mean that directory permission of /home is only valid till its immediate children and not its all descendants (grandchildren and so on)?

And it must be only root who let user1 be the owner of its child /home/test1 and from then on, user1 can control owners of its children (and all descendants)?

share|improve this question
add comment

2 Answers

Does this mean that directory permission of /home is only valid till its immediate children and not its all descendants (grandchildren and so on)?

Only partially.

If you were to change the permissions on /home from drwxr-xr-x to drwxr-x--- then user1 would no longer be able to access any files or directories below this.

Go make some files and try it out for yourself.

share|improve this answer
    
r-- would prevent access, but not --x. This distinction is rarely useful anyway. See In Linux, "Write" Permission Is Equivalent To "Execute" For Directories? –  Gilles Nov 18 '11 at 1:41
    
[root@dev base]# chmod o-x test [root@dev base]# exit exit [colinm@dev base]$ ls -ld test drwxrwxr-- 2 root root 4096 Nov 18 12:23 test [colinm@dev base]$ ls -l test total 0 ?--------- ? ? ? ? ? test/afile [colinm@dev base]$ cd test -bash: cd: test: Permission denied [colinm@dev base]$ cat test/afile cat: test/afile: Permission denied –  symcbean Nov 18 '11 at 12:26
add comment

The directory permission of home is only valid for itself. Once user1 has permissions on a directory it can do anything, including create subdirectories. So, once there is a directory under home that user1 has permissions on, it user1 can add anything to that directory.

However, if a directory under user1 was to be owned by another user, then user1 would only have world permissions on that directory.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.