The directory permissions affect (besides the obvious reading and entering the directory) creating and deleting of the files found in that directory... The file permissions control whether the user can actually read or write to that file (or execute it)..
To better understand, think of the directory as a normal file with a list in it... If you can write the file, you can modify the list.. Thus add or remove files from that directory... The
The root user is special just because he can do anything regardless of permissions.. That doesn't mean that it's files are immune to normal permissions.. But yes, that's why most system directories have root:root set as the owner... That ensures that users can't add or delete files from that directory..
and i assume that the creator of a dir will determine the permissions of ALL files on it? no need for chmod and chown it all depends on WHO create the directory.
No.. Reading, writing or executing are separate permissions on a file basis..
Take a look at my directory test
and it's contents:
drwxr-xr-t 2 root users 4096 Aug 28 22:31 .
drwx--x--x 32 smokey users 4096 Aug 28 15:43 ..
-rw-rw-rw- 1 smokey users 0 Aug 28 22:31 test.txt
In it, only root can create or delete files.. However, everyone can read or write to test.txt (they just can't delete the file, even if they can write to it)... Because the directory is owned by root and only the user write flag is set, even smokey
(the file owner) can't delete the file 'test.txt'.... So you see, adding a file and deleting a file are handled at directory level, while reading a file and writing a file handled at file level..
P.S. There are even Access Control Lists in newer linuxes that people don't know about... For more informations check