Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 01 Dec 1998 12:51:52 +0000
From:      Mark Ovens <marko@uk.radan.com>
To:        Chris <chrisj@outcast.media-net.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: umask
Message-ID:  <3663E668.CCF19E43@uk.radan.com>
References:  <Pine.BSF.3.96.981130183801.9430A-100000@outcast.media-net.net>

next in thread | previous in thread | raw e-mail | index | archive | help
Chris wrote:
> 
> hello. i was wondering if someone could please explain the working of
> umask. i understand what it does and what not, just not how to work out
> the octal numbers to get the desired result.
> 

The umask value is Xor'd with the default perms of 666 for files (777
for dirs) to arrive at the perms for a file/dir created by the user.
For example, if your umask is 022 then any files you create will have
644 perms (rw-r--r--).

If you write it out in binary it makes it clearer:

Files
            (r w - r w - r w -)
default 666  1 1 0 1 1 0 1 1 0
umask 022    0 0 0 0 1 0 0 1 0
Xor'd gives  1 1 0 1 0 0 1 0 0
            (r w - r - - r - -)

Dirs
            (r w x r w x r w x)
default 777  1 1 1 1 1 1 1 1 1
umask 022    0 0 0 0 1 0 0 1 0
Xor'd gives  1 1 1 1 1 1 1 0 1
            (r w x r - x r - x)


HTH


> Thanks
> 
> chris
> 
> To Unsubscribe: send mail to majordomo@FreeBSD.org
> with "unsubscribe freebsd-questions" in the body of the message

-- 
  Trust the computer industry to shorten Year 2000 to Y2K. It
  was this thinking that caused the problem in the first place.

Mark Ovens, CNC Applications Engineer, Radan Computational Ltd.
Bath, Avon, England.  Sheet Metal CAD/CAM Solutions
mailto:marko@uk.radan.com    http://www.radan.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3663E668.CCF19E43>