Set the permission mask when creating a file
umask [Mask]
Parameters
Mask can be a 3-bit octal number or a symbol value as used in chmod ,mask Specifies the disallowed permission (the actual permission of the file is 777 minus the umask value)
If there are no parameters, then umask will display the permission mask when the file is created
Options
-S gives the permission mask when creating the file in the form of a symbol
Exampleumask
$ umask0022
Displays the permissions that are not allowed by default when creating a file, regardless of the 1th bit
Group users and other users are not allowed to have write permissions here
umask-s
$ umask-su=rwx,g=rx,o=rx
Show default Permissions
umask Setting Masks
$ umask u=rw,g=r,o=r$ umask0133$ umask-su=rw,g=r,o=r
Set a mask as a character
umask Setting Masks
$ umask 022$ umask0022$ Umask-su=rwx,g=rx,o=rx
Set a mask numerically
Tips
1. Regardless of the mask value, most programs do not attempt to create a file with Execute permissions (this is a unspoken rule) because they do not consider it necessary to create an executable file
Therefore, when a utility (such as touch) creates a file, the system uses 6 minus each number in mask
2.mkdir is a special case, it assumes that the user does need to set executable permissions, so that the directory can be executed (into the directory)
61-umask Concise Notes