I have an annoying problem. I have made a user account that I want to be able to create files and folders off a chroot'd directory /home/user/. So it can do what it wants there. But I want the default permissions of newly created files to be 660, and newly created directories to be 770 (since the owner and group need the execute bit set to change down into that folder).
I can't find a method to actually accomplish this, since setfacl or umask both appear to affect files and folders.
People keep telling the answer is to use umask 0007. However I disagree, because the mask would allow rwx for all new files and folder created by user or group. If the application allows to create a file with the x bit set, then the mask would also allow the file to inherit that setting.
umask
should work (since it's a mask) - try for exampleumask 0007; mkdir foo; touch bar
umask 0077; mkdir foo; touch bar; stat -c %a foo bar
==>700 600
open(2)
system call, not bytouch
or other commands. So I don't understand what you mean by "setting created by touch" and "linux ... retain[s] the settings".