ArticleDirectory
- Parameters
- Option
- Example
-
- Tips
Set the permission mask when creating the file
Umask [Mask]
Parameters
MaskIt can be three octal digits orChmodSymbol value used in,MaskSpecify the disallowed permissions (the actual permission of the file is 777 minus the umask value)
If there are no parametersUmaskThe permission mask is displayed when the file is created.
Option
-S indicates the permission mask used to create a file.
Example Umask
$ Umask0022
Displays the permissions that are not allowed by default when a file is created. You can leave the 1st-bit permission blank.
The group users and other users are not allowed to have write permissions.
Umask-S
$ Umask-Su= Rwx, G = RX, O = RX
Show Default Permissions
Umask
$ Umask u = RW, G = r, O =R$ umask0133$ Umask-Su= RW, G = r, O = r
Set mask in Character Mode
Umask
$ Umask022$ Umask0022$ Umask-Su= Rwx, G = RX, O = RX
Set mask in numeric Mode
Tips
1. Whatever the value of the mask, mostProgramWill not try to create a file with the execution permission (this is a potential rule), because they do not think it is necessary to create an executable file
Therefore, when a utility (such as touch) creates a file, the system uses 6 minus every number in the mask.
2. mkdir is a special case. It assumes that you do need to set executable permissions to make the directory executable (enter the directory)