Setting Default Permissions for New Files
With the umask command, you can control the permissions of newly created files and directories. To view your current umask value, enter umask with no argument:
$ umask 077 $
To change your umask value, enter the new value as an argument:
$ umask 27
Don’t confuse the umask value with chmod in numeric mode. Here is how umask works.
UNIX wants to create any new file with read/write permission for everyone:
rw-rw-rw- # default new file permission
It wants to create the same for directories but must also add execute permission so that the directories can be accessed. It does not want to add execute permission for new files until you debug the code:
rwxrwxrwx # default new directory permission
umask acts like ...
Get Practical UNIX now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.