UMASK (User Mask or User file creation MASK) is the default permission or base permissions given when a new file (even folder too, as Linux treats everything as files) is created on a Linux machine. Most of the Linux distros give 022 (0022) as default UMASK. In other words, it is a system default permissions for newly created files/folders in the machine.
For root user default umask value is 022.
For normal user default umask value is 0002
How to check the umask value of the current user (root) ?
using umask to can find the default value
[root@Rhel ~]# umask
0022
when you create a directory default directory permissions is
0777
0022
-------
0755
-------
[root@Rhel ~]# ls -ld /vasu
drwxr-xr-x. 2 root root 6 Nov 24 15:06 /vasu
[root@Rhel ~]#
when you (root) create a any file the default file permission are 644
[root@Rhel ~]# ls -l
-rw-r--r--. 1 root root 0 Nov 24 15:06 a
how to check the umask value of the normal user (student)?
[student@Rhel ~]$ umask
0002
[student@Rhel ~]$
when you create a directory default directory permissions is
0777
0002
-------
0775
-------
[student@Rhel ~]$ mkdir vasu
[student@Rhel ~]$ ls -l
total 0
drwxrwxr-x. 2 student student 6 Nov 24 15:17 vasu
when you create a any file the default file permission are 664
[student@Rhel vasu]$ touch a
[student@Rhel vasu]$ ls -l
total 0
-rw-rw-r--. 1 student student 0 Nov 24 15:19 a
[student@Rhel vasu]$
umask and level of security
The umask command be used for setting different security levels as follows:
umask value
|
Security level
|
Effective permission (directory)
|
022
|
Permissive
|
755
|
026
|
Moderate
|
751
|
027
|
Moderate
|
750
|
077
|
Severe
|
700
|
For more information about the umask read the man page of bash or ksh or tcsh shell:
man bash
help umask
man chmod
No comments:
Post a Comment