Path: utzoo!attcan!lsuc!ecicrl!ecijmm!jmm From: jmm@ecijmm.UUCP (John Macdonald) Newsgroups: unix-pc.sources Subject: Re: KSHPR: prompt generator for .kshrc Message-ID: <289@ecijmm.UUCP> Date: 29 Jun 89 04:42:44 GMT References: <19817@cup.portal.com> <287@ecijmm.UUCP> <1045@midgard.Midgard.MN.ORG> Reply-To: jmm@ecijmm.UUCP (John Macdonald) Organization: R. H. Lathwell Associates, Elegant Communications, Inc. Lines: 15 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: ||... 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. My /etc/passwd is 444 too. The test works anyhow. Both from sh and ksh. Try it. Vi checks for this as a special case, it doesn't just try to write and see if it fails (you wouldn't - that's part of the special charm of being root). -- John Macdonald