When and why to use Umask ?
hi,
When i have to use umask and why ? pls make me understand clearly. i am confused with the concept.Umask concept is not clear to me. thanx.. |
To understand umask, you will have to understand file permissions. www.google.com/linux search for file permissions.
umask is a way of rejecting permissions. Even if you tell the system to give full permissions, it will mask out those permissions in the umask, and will not grant them. The only place I have run into this is when setting up an fstab entry for a windows partition. It usually umask's write access. |
Sorry, but there's a bit of a misconception happening here.
umask is NOT about rejecting any permissions. It is used to define the default mode of a newly created file, and the perms are XORed. E.g., a umask 022 will create a file with 644 permissions for you when you save a new file from an editor. The usage of umask in mount-entries in fstab is a whole different story, read Code:
man mount Code:
man bash Cheers, Tink |
Umask is to set the default permissions not to reject permission.
HI,
1) In breif: Maximum permissions - UMASK value = Default permissions. 2) For Executables (Exg: directories) total permissions = 777 For text files ( Normal files ) total permissons = 666 Lets say Umask value is 022, then Default permissions of a directory is 755 (777-022=755). |
tofee,
as a young linux user please do not play with 'umask'. Every linux generally defaults to umask of '0022' and that is the only acceptable default if you are concerned of security. Every file you (username) have created bears automatically the proper safe permissions based on your 0022 default umask. There are only exceptional instances that the user has to manipulate the mask. And that instance should not occur at a time that we are still young. :-) Click this link, it has a short but good explanation about permissions and it has a good say about 'umask'. Hope this helps. Goodluck. |
All times are GMT -5. The time now is 12:42 AM. |