Becoming root within a Python script

Siggy Brentrup bsb at baal.infodrom.north.de
Thu Sep 23 20:28:01 EDT 1999


François Pinard <pinard at iro.umontreal.ca> writes:

> Hi, people.  I have a small problem, for which I see no elegant solution yet.
> Is there a common idiom I could use?
> 
> I would like, within a executing Python started as non-root, ask for the root
> password, and then, continue executing part of the script while being root,
> becoming the previous again after some sub-job is done.
> 
> Of course, I can kludge something in, but I would prefer something nice. :-)

What you are asking for requires suid root scripts, a really bad thing 
modern Unices don't allow any more.

You have to hack up a wrapper written a compiled language, which
starts the interpreter with root priveledge.

A while ago I did some work on such a beast using an md5 registry for
trusted scripts, but after rethinking I threw it away - just to big a
security risk.

CU
  Siggy

-- 
noch nichts Aufregendes:

Siggy Brentrup - bsb at baal.infodrom.north.de - voice: +49-441-6990134





More information about the Python-list mailing list