[Twisted-Python] Switch to a different uid/gid after binding reserved ports

Glyph Lefkowitz glyph at twistedmatrix.com
Sun Jun 8 08:37:26 EDT 2003

On Sunday, June 8, 2003, at 06:10 AM, Richard Townsend wrote:

> The Twisted docs state that an Application object "can switch to a 
> different
> uid/gid after binding reserved ports".

You can specify keyword arguments to Application's constructor.

	a = Application(uid=1001, gid=1001)

Then, call either the setUID or setEUID method of your Application 
instance.  You will need to call bindPorts before calling these 
methods, however.

> (Note: I can't use twistd because it would not compatible with our 
> system
> architecture).

Can you detail what about twistd is incompatible with your system 
architecture?  If your system is deployed for a long period of time, 
chances are you are going to find that you require more and more 
features from twistd and re-implement it one feature at a time.

We provide the ability to run Twisted without twistd for simplicity's 
sake and for certain special cases, but this is really not recommended. 
  Twisted is a framework, not a library, and should be used as one 
wherever possible.

More information about the Twisted-Python mailing list