Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 02 Jan 1999 00:31:11 +1000
From:      Greg Black <gjb@acm.org>
To:        "Ronald F. Guilmette" <rfg@monkeys.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: /bin/sh -p broken? 
Message-ID:  <19990101143111.16317.qmail@alice.gba.oz.au>
In-Reply-To: <32180.915166033@monkeys.com>  of Thu, 31 Dec 1998 20:47:13 PST
References:  <32180.915166033@monkeys.com> 

next in thread | previous in thread | raw e-mail | index | archive | help
> Is it just me or does the -p option to /bin/sh not actually do what it
> it is supposed to do?

Seems not to.

> This is really quite handy, because it allows you to write setuid shell
> scripts.... and I happen to be in need of exactly such a thing right at
> the moment.

If you really need to do this (which I think is a bad idea, but
that's not of interest here), it's a matter of a few seconds to
write a setuid C wrapper program like this:

    #include <stdlib.h>
    #include <unistd.h>

    int main(void)
    {
      setuid(geteuid());	/* optional */
      system("my_shell_script");
      return 0;
    }

-- 
Greg Black <gjb@acm.org>


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990101143111.16317.qmail>