How to set permissions on new files in UNIX?

I want all newly created folders in /home/user had rights rwx --x --x
a new file - rwx r-- r--
How to do that?
I tried to use `setfacl` in different combinations, but have failed.
June 5th 19 at 21:38
2 answers
June 5th 19 at 21:40
Add umask 0022 to your .bashrc (or similar file).
I read about umask and it's not exactly what you need. This mask is always set for files 644 and for folders 755, and I need 711 for folders, 644 files. - roy.Kunze commented on June 5th 19 at 21:43
such is not supported.
we can just add to the script chmod ?? - Sandra_Kautzer42 commented on June 5th 19 at 21:46
you can tell what is the point in 711 for directories? - zoie_Watsi commented on June 5th 19 at 21:49
I already knew. About crowns with chmod once thought, but it is not elegant. - roy.Kunze commented on June 5th 19 at 21:52
The point is that if someone will bypass php open_base and begin to look at all the folders on the server, especially including other users, he will not be able to read the contents of the folder. For safety. - roy.Kunze commented on June 5th 19 at 21:55
it is implemented by the settings of the web server, not rights to be in the file system. - jaylin.Emmeri commented on June 5th 19 at 21:58
separate masks are in kafige vsftpd but there also made by the "programno" using chmod.
I would advise frequent dif.backup to protect against intrusion - Sandra_Kautzer42 commented on June 5th 19 at 22:01
With backups all OK. About vsftpd did not understand what you mean. - roy.Kunze commented on June 5th 19 at 22:04
the web server may have vulnerabilities (for example https://rdot.org/forum/showpost.php?p=22580&postco... and configured correctly on the right will be more reliable. - roy.Kunze commented on June 5th 19 at 22:07
sorry with vsftpd not. - Sandra_Kautzer42 commented on June 5th 19 at 22:10
you mentioned php so the user is working with files through a web server. Answer the question: which user executed the process on the web server? - jaylin.Emmeri commented on June 5th 19 at 22:13
installed mod_ruid2. Scripts are executed on behalf of the user. - roy.Kunze commented on June 5th 19 at 22:16
well , then search for "different umask for files and directories" provides the decision in the first few rows. - jaylin.Emmeri commented on June 5th 19 at 22:19
June 5th 19 at 21:42
What you need is the umask.
But it works not as you want that is so different rights for folders and files ask will not work.

Find more questions by tags Access rights* nix-like systems