[Twisted-Python] Aplication process uid/gid
Miguel Filho
miguel.filho at gmail.com
Mon Apr 28 06:38:00 MDT 2008
Hello list,
The code:
===============================
import pwd
from apolicy.config import config
...
from twisted.protocols import basic
from twisted.internet import reactor, protocol, task
from twisted.application import internet, service
...
user = pwd.getpwnam(config.get("main","user"))
application = service.Application('apolicy', uid=user[2], gid=user[3])
serviceCollection = service.IServiceCollection(application)
address, port = config.get("main", "listen").split(":")
internet.TCPServer(int(port), ACLPolicyDaemonFactory(),
interface=address).setServiceParent(serviceCollection)
===============================
I'm using twistd to start my daemon, the process starts normally and
the owner is the user nobody.
# ps uaxf | grep nobody
nobody 29052 0.1 0.6 13140 6440 ? S 09:11 0:01
/usr/bin/python /usr/bin/twistd -y
/usr/lib/python2.4/site-packages/apolicy/server.py -q --logfile
/var/log/twistd.log --pidfile=/var/run/twistd.pid
My class ACLPolicyDaemonFactory() tries to write a file to test if the
path given to my application is writable and has no problems, but the
file is created as root. What is the point where the process is
already running as nobody?
Regards,
Miguel
More information about the Twisted-Python
mailing list