On Oct 28, 2012, at 13:00 , Jeff Moore <lists / ruby-forum.com> wrote:

> It's the inconsistency with:
>=20
> root@nail:/projects/proc_fs# ls -al /proc/sys/fs/binfmt_misc/register
> --w------- 1 root root 0 2012-10-28 08:24=20
> /proc/sys/fs/binfmt_misc/register
>=20
> that I find mostly surprising.

Yeah. But that's just how root works and is both a blessing and a curse.=20=


10000 % sudo bash
9999 % echo "blah" > blah.txt
10000 % chmod 000 blah.txt
10001 % ll blah.txt
----------  1 root  staff  5 Oct 28 14:54 blah.txt
10002 % cat blah.txt
blah
10003 % ruby -e 'p File.readable? "blah.txt"'
true
10004 % exit
10001 % ruby -e 'p File.readable? "blah.txt"'
false


So, while ls tells you the attributes on the file, root overrides all. =
If you made something that root couldn't get to / change / rm / read =
then you'd wind up with a really wonky system. For example, instant DOS:

while true ; do
  F=3D$$.$(date +%s)
  dd if=3D/dev/zero of=3D$F bs=3D1g count=3D1
  chmod 0 $F
done