Re: Setuid scripts in python

Marvin R Long (mlong@express.ctron.com)
Wed, 16 Mar 94 09:20:52 EST

Anybody done setuiding using python scripts. Our resident expert tried this but
it didn't seem to work. The usual thing about no permission match, even with
the python executable set with the s bit.

Any clues,

Thanks,

Adrian


Marvin-

I don't know if you have been playing with built in modules but I have
a little C routine which allows me to setsid ./ezpython anything.py

------------------------------ setsid.c -------------------------------------
#include <stdio.h>
#include <sys/types.h>
#include <errno.h>

pid_t process_id ;

main(argc, argv, envp)
char **argv;
char **envp;
{
char executable_path ;
int i ;
int ret_value ;

if ( argc > 1 )
{
process_id = setsid();
printf ("process_id : %1d\n", process_id );
ret_value = execvp( *++argv, argv ) ;
/*
if ( ret_value < 0 )
{
perror(NULL);
}
printf ("execv ret_value : %1d\n", ret_value );
*/
}
else
{
printf( "setsid usage : setsid \"executable arg(s)\"\n" );
}

}

//////////////////////////////////////////////////////////////////////////////
// Marvin Long // Cabletron Systems, Inc. // 603-337-7384 //
// mlong@ctron.com // Box 5005, Rochester, NH 03867 // fax 603-332-1019 //
//////////////////////////////////////////////////////////////////////////////