6

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)?

2

2 Answers 2

4

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.

2
  • r-- would prevent access, but not --x. This distinction is rarely useful anyway. See In Linux, "Write" Permission Is Equivalent To "Execute" For Directories? Commented Nov 18, 2011 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
    Commented Nov 18, 2011 at 12:26
0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .