Welcome to the most active Linux Forum on the web.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 03-24-2006, 12:56 AM   #1
Registered: Mar 2006
Posts: 41

Rep: Reputation: 15
When and why to use Umask ?


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.

Old 03-24-2006, 01:02 AM   #2
Registered: Feb 2006
Location: oregon
Distribution: PIII fedora2 | P4 fedora2 | Thinkpad fedora2
Posts: 54

Rep: Reputation: 15
To understand umask, you will have to understand file permissions. 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.
Old 03-24-2006, 01:27 AM   #3
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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

The usage of umask in mount-entries in fstab is a whole
different story, read
man mount
man bash
(press n a couple of times)
for details

Old 11-26-2009, 03:50 AM   #4
LQ Newbie
Registered: Oct 2006
Posts: 12

Rep: Reputation: 0
Umask is to set the default permissions not to reject permission.


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).
Old 11-26-2009, 09:21 AM   #5
Senior Member
Registered: Dec 2008
Location: root
Distribution: Slackware & BSD
Posts: 1,669

Rep: Reputation: 498Reputation: 498Reputation: 498Reputation: 498Reputation: 498

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.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
what is Umask ? tofee Linux - Newbie 1 03-23-2006 07:05 AM
umask help glabiche Linux - Security 1 06-07-2005 08:20 AM
umask wbdune Linux - Newbie 5 10-14-2003 01:53 AM
Umask robyso Linux - Security 1 07-14-2003 02:33 PM
umask Spaz17 Linux - Newbie 1 07-04-2003 10:12 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:22 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration