I tried changing umask as:

umask 0012 for file c.

-rw-rw-r-- 1 unipro unipro 0 2010-10-15 11:30 c

umask 0013 for file d.

-rw-rw-r-- 1 unipro unipro 0 2010-10-15 11:32 d

How is it that both have the same permissions,even after different umask permissions.

link|improve this question

feedback

2 Answers

up vote 4 down vote accepted

From Wikipedia:

The umask only restricts permissions; it cannot grant extra
permissions beyond what is specified by the program that
creates the file or directory.

Real file permissions are calculated in this way:

real-permissions = requested-permissions AND NOT( umask )

requested-permissions is usually 0666 for files (and 0777 for directories), so:

0666 AND NOT( 0012 ) = 0664
0666 AND NOT( 0013 ) = 0664
link|improve this answer
Thank you .. +1 – Pavitar Oct 15 '10 at 20:21
feedback

Well 1 is execute, and umask can't add permissions, so I'm guessing neither of these files had +x set to begin with?

link|improve this answer
Yes>I got it now thank you :) +1 – Pavitar Oct 15 '10 at 20:20
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.