I have created directory as following:
root@host [~]# mkdir mydir
root@host [~]# ls -ld mydir
drwxrwxr-x 2 test test 4096 Mar 2 19:36 mydir
root@host [~]#
Then I have changed the group ownership of the directory by using the 'chgrp' command, and then also added the ‘setgid’ permission.
root@host [~]# chgrp test2 mydir/
root@host [~]# chmod g+s mydir
root@host [~]# ls -ld mydir/
drwxrwsr-x 2 test test2 4096 Mar 2 19:36 mydir/
root@host [~]#
Now, when I create a file under the directory, I see the file is missing execute permission.
root@host [~]# touch mydir/myfile3
root@host [~]# ls -l mydir/myfile3
-rw-rw-r-- 1 test test2 0 Mar 2 19:59 mydir/myfile3
root@host [~]#
My understanding is that the file should get exactly same permission as the parent directory. And, the parent directory as rwx permission so the file should also get rwx permission.
xbit for data files, or access by others for "private" files. See e.g. Permissions set on new files and folders by default ACLs – ilkkachu Jan 25 '22 at 19:20