[Linux] suid scripts

Brian Horan bhoran@herald.com
Tue, 03 Oct 2000 10:29:59 -0400


Wouldn't something like setreuid()  work a bit better, setting both real and
effective uid's?
because if your gona do something as root, you might as well be root?

Pablo Averbuj wrote:

> .----| Danny Rathjens (Mon, Oct 02, at 08:08PM) |--------------
> | Am I going senile?  Any idea why this doesn't work?
> | (I did RH7-custom-upgrade a week ago)
>
> Like kendrick mentioned, no suid shell scripts. You can either use sudo or
> a C wrapper.
> [ .. searching for code .. ]
> Ah! here it is:
>
> --------- wrap.c ------------
> #define REAL_PATH "/path/to/script"
> main(ac, av)
>    char **av;
> {
>     setuid(0);
>    execv(REAL_PATH, av);
> }
> -----------------------------
>
> If you're writing in perl, try suidperl but read all the rtfm a bit first as
> there may be some precautions you should be taking (like taint checks).
>
> --
> --[ Pablo Averbuj ]--%--[ pablo@averbuj.com ]-%-[ http://pablo.averbuj.com ]--
> ---[ Finger pablo@averbuj.com for PGP key ]---%---[ Perl Warrior at large ]---
>
> _______________________________________________
> Linux mailing list
> Linux@flux.org
> http://www.flux.org/mailman/listinfo/linux

--
     ,~,
      v     Brian Horan
    /(|)\   Systems Analyst/Programmer
   /( | )\  Miami Herald Publishing Company
  //( | )\\ bhoran@herald.com     cell: (954) 296-7807
-----"-"-----------------------------------------