Бая спор сте захванали, като намесвате Линукс (ядрото), там, където не му е работа. Защото системният примитив е:
MKDIR(2) Linux Programmer's Manual MKDIR(2)
NAME
mkdir - create a directory
SYNOPSIS
#include <sys/stat.h>
#include <sys/types.h>
int mkdir(const char *pathname, mode_t mode);
DESCRIPTION
mkdir() attempts to create a directory named pathname.
The argument mode specifies the permissions to use. It is modified by the process's umask in the usual way: the permissions of the created directory are (mode &
~umask & 0777). Other mode bits of the created directory depend on the operating system. For Linux, see below.
The newly created directory will be owned by the effective user ID of the process. If the directory containing the file has the set-group-ID bit set, or if the file
system is mounted with BSD group semantics (mount -o bsdgroups or, synonymously mount -o grpid), the new directory will inherit the group ownership from its parent;
otherwise it will be owned by the effective group ID of the process.
If the parent directory has the set-group-ID bit set then so will the newly created directory
...
...
ERRORS
EACCES The parent directory does not allow write permission to the process, or one of the directories in pathname did not allow search permission. (See also
path_resolution(7).)
...
EPERM The file system containing pathname does not support the creation of directories.
EROFS pathname refers to a file on a read-only file system.
...
Източник: man 2 mkdir
Или, иначе казано, всяка програма, която създава нова директория, сама посочва правата, с които я иска (като към тях се прилага и umask). А според това каква е и как е монтирана файловата система, се определя и за коя системна група отива третата цифричка от тези права.
Съответно, за shell програмката mkdir:
MKDIR(1) User Commands MKDIR(1)
NAME
mkdir - make directories
SYNOPSIS
mkdir [OPTION]... DIRECTORY...
DESCRIPTION
Create the DIRECTORY(ies), if they do not already exist.
Mandatory arguments to long options are mandatory for short options too.
-m, --mode=MODE
set file mode (as in chmod), not a=rwx - umask
...
Източник: man 1 mkdir
Както се вижда, по подразбиране (без допълнително указан аргумент за mode) тя прави директорията с права 0777 & ~umask.
Какво се случва в samba, предполагам, също не е неоткриваема тайна.
---------
Ще имам в предвид напред, че правила родител-дете хич ги няма в linux.
В Линукс (ядрото!) има отлични правила за това какво детето наследява от родителя. Но не в контекста на директории, а в контекста на
процеси.
От една директория няма какво да се наследява, директорията не е нещо „живо“ (за разлика от процеса), директорията е просто един файл с фиксирана структура.
За да създадеш нов файл (бил той обикновен или директория, или връзка и т.н.) се изисква ти (създаващият процес) да имаш определени права за достъп (w за директорията, в която ще е файла, x за всички директории от пълния път до нея, включително). Ако ги имаш, новосъздаденият файл може да бъде с каквито права ти си пожелаеш.