I just learned file permissions in a textbook and am still figuring out how it all works together. Especially with top level directories and subdirectories. It seems to me that if I restrict write access for a subset of users to a top level directory, then those same users can not write to any subdirectory inside of it. Here is the file structure.
drwxrwxr-x 4 brian brian 4096 Feb 22 17:17 tdir
drwxrwxrwx 2 brian brian 4096 Feb 22 17:17 tdir/dir1
drwxrwxrwx 2 brian brian 4096 Feb 22 17:17 tdir/dir2
sudo -u casey touch ~brian/playground/tdir/dir1/tfile
touch: cannot touch '/home/brian/playground/tdir/dir1/tfile': Permission denied
Say I do not want world users to be able to change the contents of tdir/ but I want them to be able to alter the contents of its subdirectories dir1 and dir2. I'm assuming this is a fairly common situation, but with my current permissions I still get permission denied when a world user tries to create files within dir1 or dir2. How can I get around this and what is the typical way to deal with the situation? Thanks in advance.
tdir/dir1
. With evidence of permissions.cd tdir; ls -la; cd dir1; touch zzzz
. Add it to your question. – ctrl-alt-delor Feb 22 '18 at 22:41cd ~brian/playground/tdir; ls -la; cd dir1; sudo -u casey touch zzzz
– ctrl-alt-delor Feb 22 '18 at 23:02dir1
? Directory permissions and file permissions affect different things – ErikF Feb 23 '18 at 02:16