Wednesday, July 27, 2011

umask

umask (user mask)  is used to set permissions on files and directory created by that  particular user.


as we know 


4 -read
2 - write 
1 - execute


ex- 432 represents read permission to owner,write & execute permission for group and write permissions for others.


***for every user we can set umask value.


***by default umask value for all users in aix is 022.


***default permissions for file if umask is not set is 666
***default permission for directories if umask is not set is 777


note: setting the proper umask is must for system admin's.  as it reflects to the permissions of file and directories. suppose  u have set your umask to 000.it means that you had given  all(owner,group ,others)  permissions to access and edit the file. .




example to understand what umask does?


*********As we know that default umask is 022. create one file and directory and note down the permissions on that file and directory.  after that change the umask value. and again create another file and a directory and notice the differences in permissions.**********


suppose , i changed the umask for user abhi as 024 . 


#umask 024


user abhi created a  file "test". now the permissions on this file will be 666-024=642


#touch test


#ls -l  test
-rw- r-- -w-  1  abhi staff   ...............


if user abhi is creating directory aks the  permissions on the directory will be 777-024=753


# mkdir aks


# ls -l | grep aks
drwx r-x -wx  2  abhi staff ...............




for setting the umask value .




to view the current umask value


#umask


to change the umask value use


# chuser umask=024 abhi


or
login as abhi and run 
#umask 024

No comments:

Post a Comment