[Linux] suid scripts

Arieh Markel Arieh.Markel@central.sun.com
Tue, 3 Oct 2000 08:27:39 -0600 (MDT)


The example below only sets uid to root. However, there are cases when
the ownership of the file is not root, but another user.

> From: Pablo Averbuj <pablo@gos.nu>
> To: Danny Rathjens <dkr@hq.mycity.com>
> Cc: linux@flux.org
> Subject: Re: [Linux] suid scripts
> Content-Disposition: inline
> 
> .----| 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);


	setuid (geteuid());


Arieh
	
>    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

--
 Arieh Markel		                Sun Microsystems Inc.
 Network Storage                        500 Eldorado Blvd. MS UBRM11-194
 e-mail: arieh.markel@sun.COM           Broomfield, CO 80021
 Let's go Panthers !!!!                 Phone: (303) 272-8547 x78547
 (e-mail me with subject SEND PUBLIC KEY to get public key)