umask 123, what are the permission of a file:
correct answer is: rw-r--r--.
but according to my method: 666 - 123 = 543, the file permission should
be r-xr---wx.
what's missing in my calculation?
thanks.
fshguo.
Sent via Deja.com http://www.deja.com/
Before you buy.
What's missing is that umask works via bitwise operations....
--
Kevin Benko
fsh...@hotmail.com writes:
>umask 123, what are the permission of a file:
>correct answer is: rw-r--r--.
>but according to my method: 666 - 123 = 543, the file permission should
>be r-xr---wx.
>what's missing in my calculation?
It's 777-123 which yields 654 (rw-r-xr--) (it's actually 777 & ~123)
but most applications give you 0666 & ~0123 == 644
Casper
--
Expressed in this posting are my opinions. They are in no way related
to opinions held by my employer, Sun Microsystems.
Statements on Sun products included here are not gospel and may
be fiction rather than truth.
<FLAME ON>
You are asking basic UNIX questions which have nothing to do
with Solaris per se.
I don't care if they came from a Solaris exam -- they are basic
UNIX questions, and are off-topic here.
<FLAME OFF>
Chris
With umask 0, a file is created with mode 666 (rw_rw_rw_).
With umask 123, the effect is "chmod u-x,g-w,o-wx <file>".
So the permission become 644 (rw_r__r__).
The key point is: a file started with "no execute permission on others"
cannot be stripped on the "execute bit on others".