Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 30 Nov 2001 07:48:59 +0100
From:      Cliff Sarginson <cliff@raggedclown.net>
To:        freebsd-questions@freebsd.org
Subject:   Re: change permission to default ?
Message-ID:  <20011130074859.B7131@raggedclown.net>
In-Reply-To: <20011130043357.36971.qmail@web21103.mail.yahoo.com>
References:  <20011130043357.36971.qmail@web21103.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Nov 29, 2001 at 08:33:57PM -0800, Henry smith wrote:
> I have make any changes with the permission of
> directory/files.
> 
> How do I make the permission set as default ?
>
 
This is a simplfied explanation...and assumes you know
what an exclusive-or is.

The permissions of a file depend on a thing called the
umask (documented under the man page for sh/csh probably).
This is a bit mask (think octal here). When you create
a file the permissions it would get if the umask was 0
would be

rw-rw-rw-

This,if you like, in the absence of any qualification
is the default.

However no system will normally set a default umask of 0.
As you will see it gives the world and it's mother
read/write permission on the file.

Thinking of rw-rw-rw as an octal number you will see it is

0666

The file creation algorithm XOR's this 0666 with the value
of umask, so the XOR of 0666 and 0 is, 666.

Most systems will have a default umask set of 022, or possibly 002.
So:

0666 XOR 000 = 0666 = rw-rw--rw-

0666 XOR 022 = 0644 = rw-r--r--

0666 XOR 002 = 0664 = rw-rw-r--

And if you are bing draconian, set umask to 066

0666 XOR 066 = 0600 = rw-------

You can work out the other combinations from this I hope.
Here is an eccentric one, 0664, I will let you work out
what that does :)

So you need to change the system wide profile to the umask
you want, or a user can set it up in their shell startup
script(s).

-- 
Regards
Cliff



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?20011130074859.B7131>