Sunday, March 29, 2015

UMASK in Linux

When user creates a file or directory, it creates with a default permissions. As you all know, the permission values for read,write and executes are given below.
read -4
write -2
execute -1


What is umask ?

umask is the default permission for a file or directory which a user{root/other user} creates.

Where do you set up the umask value in linux OS?


It is in /etc/profile or /etc/bashrc


Note : The files are created with access permissions in 666 {files}and 777{directories}.



What is the default umask value ?


If the file/directory is created by root user  the umask value is 022

ie , for a file , the permission should be 666 - 022 = 644
and for directories , the permission should be 777 - 022 = 755


If the file/directory is created by other user , the umask value is 002.


ie , for a file , the permission should be 666 - 002 = 664

and for directories , the permission should be 777 - 002 = 775

Please find the examples here for one sample file and directory and try it yourself.












Thank you ......

No comments:

Post a Comment

Thank you !!