Re: Umask question

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 1/17/07, Sjoerd Mullender <sjoerd@xxxxxxx> wrote:
On 2007-01-17 17:06, Aaron Konstam wrote:
> On Wed, 2007-01-17 at 10:04 -0600, Aaron Konstam wrote:
>> On Wed, 2007-01-17 at 08:10 -0600, Styma, Robert E (Robert) wrote:
>>>  > Hi
>>>> if I issue the ommand umask I get a value of 0022. I thought umask
>>>> values were 022, what's the extra digit for?
>>>>
>>>> Thanks
>>>> Dan
>>> By convention, octal numbers have a leading zero.  This is a
>>> carry over from the C programming language.
>>>
>>> Bob
>>>
>> I am not sure that is true. There is a forth (the first on in the
>> output) that refers to SUID, GUID and stcky bit,
> I should try my answer before I shoot off my mouth. It looks like umask
> cannor set that fourth digit, so I guess I am wrong.

There are 9 permission bits that are relevant to umask in 3 groups of 3:
user, group, other, and for each of those, read, write, execute.  By
displaying the permissions in octal, you get one digit for each of those
groups.  Hence it is useful for umask to display three octal digits to
display the complete mask.  Note that ordinarily the first of those
three digits is 0, since you typically don't want the user (owner of the
file)'s permissions to be curtailed by the umask.

The fourth (or rather, first) digit is always 0 since in C a leading 0
in a number indicates that the number is given in octal (just like a
leading 0x indicates that the number is in hexadecimal).

So we arrive at four digits, the first two of which are 0: leading zero
to indicate octal number, zero to indicate no permissions removed for
user, and then the two 2s to indicate that write permission is to be
removed for other members of the group and everyone else in the world.

I hope this makes things clear.


--
Sjoerd Mullender

Hi All

Many thanks for your replies. Its a lot clearer now.

Regards
Dan


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux