no setuid for CGI scripts?

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Mon Nov 5 14:19:33 CET 2001


----- Original Message ----- 
From: "pawn" <NOSpawnPAM at lightspawn.org>


> I'm trying to convert a few simple CGI scripts from Perl to Python,
> and was shocked to learn that the Python interpreter silently ignores
> the setuid bit.

Don't be shocked.  It's not really the interpreter's business, it's 
the OS.  Perl (if I remember right) does have a special setuid-perl
interpreter, but IMHO that's a hack.

> I really don't know how to get around this. Since the server is hosted
> remotely I can't recompile python to allow setuid, and I can't make my
> files world read/writable - I need my python CGIs to run with MY uid.

You wouldn't need to recompile, just set the bits on the program file
if you owned it.  It's actually a webserver thing.  Apache has a setuid
module just to handle this; if the remote site is using Apache you could
ask about it.

> I read somewhere about using a wrapper C program but it seems really
> convoluted, as well as requiring a different wrapper for each CGI.

Robin Becker supplied one in another post, so I won't bother digging up
my old solution (which I wrote long ago for shell scripts).  A single
wrapper can handle the entire system.

The main question is, can you put a compiled CGI on the remote system?
(That is, will they allow it to run?)

> Is there any solution, or should I stick to / am I stuck with Perl?

Ultimately this is a problem for the remote site administration.  Have 
you asked them?






More information about the Python-list mailing list