Running CGIs under my uid - going slowly insane.

pawn NOSpawnPAM at lightspawn.org
Wed Feb 6 03:03:05 EST 2002


Thank you! I got it to work, kinda. Here's what I eventually did:

#include <stdlib.h>
#include <string.h>

int main( int argc, char* argv[] ) {
    int len;
    char* args[3];
    args[0]="python";
    args[1]=argv[0];
    len = strlen(args[1]);
    args[1][len-3]='p';
    args[1][len-2]='y';
    args[1][len-1]='\0';
    args[2]=NULL;
    execv( "/usr/bin/python", args );
}

Now instead of running, say, test.cgi, which is written in python...

$ mv test.cgi test.py
cp wrapper.cgi test.cgi

Repeat once for every script that needs to run with my (your) uid.

At least I hope somebody else will come across this while having the same problem.



More information about the Python-list mailing list