KSHPR: prompt generator for .kshrc

Chris Lewis clewis at ecicrl.UUCP
Mon Jul 3 14:23:35 AEST 1989


In article <1045 at midgard.Midgard.MN.ORG> caa at midgard.Midgard.MN.ORG (Charles A Anderson) writes:
|In article <287 at ecijmm.UUCP> jmm at ecijmm.UUCP (John Macdonald) writes:
||Well you asked for it...  I hope there won't be a deluge of similar
||postings.  Anyhow, my method of determining whether I'm su'ed to root
||or not is a simple test "if [ -w /etc/passwd ]".  If that succeeds,
||you're either root or the proud owner of an insecure system.  

|Won't work for me, cuz my /etc/passwd is 444.  Meaning I have to do a w!
|to change it in vi but that's ok with me.

So is John's.  (It better be or I'm in deep s**t).  "test -w /etc/passwd"
will succeed *even if* passwd is 444 if you're su'd to root.

Sidenote: You have to do the "w!" in vi, not because vi *can't* write,
but because vi doesn't *think* it can write.  Vi is *not* smart enough
to chmod +w/chmod -w (or, unlink()-creat() either) just because you 
said "w!".  "w!" means "write even though you don't think you can".
Not "write even though you can't".

Aren't permissions fun?
-- 
Chris Lewis, Markham, Ontario, Canada
{uunet!attcan,utgpu,yunexus,utzoo}!lsuc!ecicrl!clewis
Ferret Mailing list: ...!lsuc!eci386!ferret-request



More information about the Unix-pc.sources mailing list