For Umask value 002, what are the corresponding file and directory default creation permissions?
The Umask command allows you to set the default mode for file creation, with a corresponding number of umask values for each type of user (file owner, same group of users, other user).
For a file, the maximum value for this number is 6, respectively. The system does not allow you to give permission to execute a text file when you create it.
This permission must be added with the chmod command after creation. The directory allows you to set execution permissions, so that for the directory, the number of umask can be up to 7.
Umask for a file, when the cardinality is included, the highest permission 666-unmak the value +1, including the even-numbered 666-umask
Umask for folders, maximum permissions 777-umask
[Email protected] app]# umask 023
[email protected] app]# Touch file1
[Email protected] app]# ls-ltr
-rw-r--r--. 1 root root 0 Jan 6 03:20 file1
[Email protected] app]# Umask 025
[email protected] app]# Touch file2
[Email protected] app]# ls-ltr
-rw-r--r--. 1 root root 0 Jan 6 03:20 file1
-rw-r---W. 1 root root 0 Jan 6 03:21 file2
[Email protected] app]# umask 035
[email protected] app]# Touch file3
[Email protected] app]# ls-ltr
-rw-r--r--. 1 root root 0 Jan 6 03:20 file1
-rw-r---W. 1 root root 0 Jan 6 03:21 file2
-rw-r---W. 1 root root 0 Jan 6 03:22 file3
[Email protected] app]# mkdir dir3
[Email protected] app]# ls-ltr
-rw-r--r--. 1 root root 0 Jan 6 03:20 file1
-rw-r---W. 1 root root 0 Jan 6 03:21 file2
-rw-r---W. 1 root root 0 Jan 6 03:22 file3
DRWXR---W. 2 root root 4096 Jan 6 03:26 dir3
Linux default permissions Super Simple calculation method