[plug] setuid etc

Carl Gherardi C.Gherardi at curtin.edu.au
Mon Feb 10 15:58:44 WST 2003


'lo all,

I'm having a battle with a program at the moment.

I have a program that looks very much like:

main( int argc, char *argv[], char *envp[]) {
     int euid;

     euid = geteuid();
     setuid( euid);

     setpgrp( 0, setsid());

     execve( argv[1], &argv[1], envp);
}

called runasroot

Which I use with sudo to make things really run as root.
Eg. Create a shell script that requires root privs for various bits.
create wrapper program like.

main()
{
char * args = { "myrootshellscript", "argstoshellscript" };
	runasroot(args);
}
called useless

# sudo useless

This program makes sure that the actual uid of the program runs as root and
not just the effective uid.

Dumb question is there a unix utility that does this already, or am I
reinventing the wheel?

Cheers

Carl



More information about the plug mailing list