Contents
Can a umask be used to add permissions?
The umask cannot add permissions, it only servers to mask away some of the permission bits set by the process creating the file in question. The umask is used by open (2), mkdir (2), and other system calls that create files to modify the permissions placed on newly created files or directories.
Where did I go wrong in my understanding of umask?
I ran umask 027 expecting this would result in all permissions for myself, read and execute for group, and none for everyone else. Based on a default of 777 minus 027 = 750. This is not at all what I was expecting. Where did I go wrong in my understanding of umask?
Why is umask not working with ssh keygen?
If the umask could be used to force adding permission bits, stuff like email clients and ssh-keygen would be in trouble: they’d have no way to create files that can only be accessed by the owner! If we arrange for the file to be created with wider permissions, we see the execute bits too:
Is it necessary to reset the umask in mkdir?
It’s up to the shell developers to decide (and OS makers). umask is per process, but inherited, rather than global. In the wrapper script there is no need to reset the umask after the real mkdir has completed, it will just cange the umask for the shell running the script, which is just about to exit anyway.
Is the filesystem on the server ZFS or INTR?
The filesystem on the server is ZFS. Client is mounting hard,intr. Client is using cachefilesd, but that appears unrelated to the issue. As this is NFSv4 (v2 and v3 are thoroughly disabled on the server), TCP is being used. The port is non-standard.
Can a file be executable in umask of 077?
When you use a umask of 077 only the user has read, write and execute permissions. The user definitely will be able to open (‘execute’) directories (see more on why directories have to be executable in my answer here). However, files must always be made executable by entering chmod u+x myfile; they are never automatically executable.
What is umask and what does it mean in Bash?
The umask is an attribute of the process not of a file – that is part of UNIX architecture and is nothing todo with Bash, or any other shell program. The real issue is that the programs you are using do not allow the permissions to be changed on creation. In C, for example, mkdir has a second parameter, the mode.