Access to files by group owner

  • Follow


chl% cd /tmp
chl% groups
chl bin uucp mail news src sysadmin uk-answers
chl% touch foo
chl% ls -l foo
-rw-rw-r--   1 chl      chl            0 Mar 19 11:03 foo
chl% echo FOO > foo
chl% cat foo
FOO
chl% chmod 0060 foo
chl% ls -l foo
----rw----   1 chl      chl            4 Mar 19 11:03 foo
chl% cat foo
cat: cannot open foo
chl% touch foo
chl% ls -l foo
----rw----   1 chl      chl            4 Mar 19 11:08 foo
chl% 

Observe that I (chl) am a member of the group chl (pretty well the default
setup).

So if I change the permissions so that the group has rw permission but
nobody else has any permissions, then members of the group should surely
be able to read and write, Yes?

But seemigly not so, yet they are able to touch.

How come?

-- 
Charles H. Lindsey ---------At Home, doing my own thing------------------------
Tel: +44 161 436 6131            Web: http://www.cs.man.ac.uk/~chl
Email: chl@clerew.man.ac.uk      Snail: 5 Clerewood Ave, CHEADLE, SK8 3JU, U.K.
PGP: 2C15F1A9      Fingerprint: 73 6D C2 51 93 A0 01 E7 65 E8 64 7E 14 A4 AB A5
0
Reply chl (40) 3/19/2012 11:14:26 AM

"Charles Lindsey" <chl@clerew.man.ac.uk> writes:

>chl% cd /tmp
>chl% groups
>chl bin uucp mail news src sysadmin uk-answers
>chl% touch foo
>chl% ls -l foo
>-rw-rw-r--   1 chl      chl            0 Mar 19 11:03 foo
>chl% echo FOO > foo
>chl% cat foo
>FOO
>chl% chmod 0060 foo
>chl% ls -l foo
>----rw----   1 chl      chl            4 Mar 19 11:03 foo
>chl% cat foo
>cat: cannot open foo
>chl% touch foo
>chl% ls -l foo
>----rw----   1 chl      chl            4 Mar 19 11:08 foo
>chl% 

>Observe that I (chl) am a member of the group chl (pretty well the default
>setup).

>So if I change the permissions so that the group has rw permission but
>nobody else has any permissions, then members of the group should surely
>be able to read and write, Yes?

The permissions are evaluated depending who you are; if you are the
owner, then the owner bits are evaluated and the group bits are
not relevant.

So with mode 060, user "chl" cannot read or write the file; but other
users in group "chl" can read or write the file.

>But seemigly not so, yet they are able to touch.

A owner can touch the file (changing the timestamps) and it doesn't
need read/write permission.

Casper
0
Reply Casper.Dik2 (258) 3/19/2012 1:48:31 PM


1 Replies
92 Views

(page loaded in 0.064 seconds)


Reply: