Wednesday, December 14, 2011

Umask

umask is a set of setting default permissions for files or directories that you create on your system.
umask tells the system what permissions to remove from the normal default setting.
umask value can be a three or four digit value.

Global umask value can be change in /etc/bashrc (default value is 0022 or 022).
The extra 0 at the beginning just means that the number is in octal format.
umask can be set temporary using umask command

Example:
umask 077 (Owner - read, write and execute, Group - No Permissions, Others - No Permissions)

How to calculate umasks?
The octal umasks are calculated using bitwise AND of the unary complement of the argument using bitwise NOT. The octal notations are as follows:
Ocatal Value | Permission
0 - read, write and execute
1 - read, write
2 - read, execute
3 - read only
4 - write and execute
5 - write only
6 - execute only
7 - no permissions

Note: Directories must be executable (X) in order to browse them.

No comments:

Post a Comment