UMASK in a Linux system also known as User Mask is the default permission of a file or directory when they are created in your Linux machine. In a more clearer form, Umask, or the user file-creation mode, is a Linux command that is used to assign the default file permission sets for newly created folders and files. The term mask references the grouping of the permission bits, each of which defines how its corresponding permission is set for newly created files. The bits in the mask may be changed by invoking the umask command. Most Linux distros have a default value of UMASK as 022.
Here at LinuxAPT, as part of our Server Management Services, we regularly help our Customers to perform related Linux System queries.
In this context, we shall look into how to use UMASK.
The minimum and maximum values of umask for a directory are 000 and 777 respectively. The minimum and maximum values of umask for a file are 000 and 666 respectively. The following table describes some of the common values:
To get a better understanding of how to use UMASK in Linux, let’s analyze the following example:
If the value of umask is 077, it means:
$ umask 077
$ mkdir new-folder
$ touch new-file
$ ls -ld new-folder new-file
You can get the current value of umask by simply running the command:
$ umask
Besides the method of using numeric value for umask, you can configure the umask by alphabetic value as:
For instance:
$ umask u=rw
$ mkdir test-folder
$ touch file-test
$ ls -ld test-folder file-test
This article covers how to use UMASK in the Linux system. On Linux operating systems, new files are created with a default set of permissions. Specifically, a new file's permissions may be restricted in a specific way by applying a permissions "mask" called the umask. The umask command is used to set this mask, or to show you its current value.