Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

umask 123

418 views
Skip to first unread message

fsh...@hotmail.com

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
exam question2:

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.

kevin benko

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
fsh...@hotmail.com wrote:
>
> exam question2:
>
> 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.

What's missing is that umask works via bitwise operations....

--
Kevin Benko

Casper H.S. Dik - Network Security Engineer

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
[[ PLEASE DON'T SEND ME EMAIL COPIES OF POSTINGS ]]

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.

mack23

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
In article <8qtldt$i8n$1...@nnrp1.deja.com>, <fsh...@hotmail.com> wrote:
>exam question2:

>
>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.


<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

Mason Ip

unread,
Sep 27, 2000, 3:00:00 AM9/27/00
to
fsh...@hotmail.com wrote...

>
>exam question2:
>
>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.

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".


0 new messages