[Twisted-Python] shedding root

Andrew Bennetts andrew-twisted at puzzling.org
Tue Apr 5 19:17:09 MDT 2005


On Tue, Apr 05, 2005 at 08:43:16PM -0400, Matt Feifarek wrote:
> I've seen how the plugins created by mktap can shed root and after
> binding to a port, and run as an unprivileged user...
> 
> I'd like to do this in my twisted code, but my app isn't structured as
> a twisted "plugin". How can I manipulate the reactor (or whatever I
> need to tweak) to drop root after binding to say, port 80?

You can use twistd without using plugins.  See
http://twistedmatrix.com/projects/core/documentation/howto/application.html.
In fact, mktap and plugins are almost never useful any more.

> I tried using standard python os.setuid() etc. but it just locked up
> the reactor.
> 
> I looked in the API for useful material, but I was unsuccessful.

The place to look would be in twisted.application, but it's probably best to
use twistd -y, as described in the doc I linked.

-Andrew.





More information about the Twisted-Python mailing list