Path: utzoo!attcan!lsuc!ecicrl!clewis From: clewis@ecicrl.UUCP (Chris Lewis) Newsgroups: unix-pc.sources Subject: Re: KSHPR: prompt generator for .kshrc Message-ID: <252@ecicrl.UUCP> Date: 3 Jul 89 04:23:35 GMT References: <19817@cup.portal.com> <287@ecijmm.UUCP> <1045@midgard.Midgard.MN.ORG> Reply-To: clewis@ecicrl.UUCP (Chris Lewis) Organization: Elegant Communications Inc. (Ferret Division) Lines: 24 In article <1045@midgard.Midgard.MN.ORG> caa@midgard.Midgard.MN.ORG (Charles A Anderson) writes: |In article <287@ecijmm.UUCP> jmm@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