[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: umask (was "Working both Worlds")
- From: Kevin Colby <kevinc grainsystems com>
- To: redhat-install-list redhat com
- Subject: Re: umask (was "Working both Worlds")
- Date: Thu, 01 Mar 2001 09:33:08 -0600
Horace wrote:
>
> If a umask=007 is equivalent to a chmod 770, why don't
> I just use chmod instead. And what's a umask for?
umask is to file permissions what netmask is to IPs.
chmod 750 would be overwriting the permissions to "750".
750 (octal) = 111 101 000 (binary)
Keep the binary representation in mind. Many programs
create files, such as bash (the shell itself). When a
program creates a file, users and/or administrators will
want a way to specify the "default" permissions. However,
you do not want the default permissions mechanism to ever
extend the permissions of the new files beyond that which
the creating program wished to give them. You only want
to sometimes restrict this further. Thus, we use a mask
rather that a specific setting.
If a umask of 027 is in place, and a file was to be created
with permissions of 777, the mask would strip out bits
such that the resulting file had permissions of 750.
Attempt: 777 (octal) = 111 111 111 (binary)
Umask: 027 = 000 010 111
Result: 750 = 111 101 000
The operation is XOR. It is simple, effective, and very
easy to do in electronic systems. It is used for setting
the filesystem-wide permissions for FAT filesystems
mounted under Linux, Samba file creation, IP networking,
and tons of other places.
I hope that clears things up.
- Kevin Colby
kevinc grainsystems com
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]