DropPrivileges problem

Aaron Dalton <[email protected]>
Newsgroups gmane.comp.python.cherrypy
Message-ID <[email protected]>
Losing my mind a little here :)

I have the following script:

import cherrypy
from cherrypy.process.plugins import PIDFile, DropPrivileges
PIDFile(cherrypy.engine, 
"/home/protected/server/logs/server.pid").subscribe()
DropPrivileges(cherrypy.engine, umask=0644, uid=25000, 
gid=25000).subscribe()

class HelloWorld(object):
    @cherrypy.expose
    def index(self):
        return "Hello world!"

if __name__ == '__main__':
    cherrypy.config.update("/home/protected/server/server.conf")
    cherrypy.quickstart(HelloWorld())

I'm hosing this on a shared hosting service where to daemonize, I simply 
run it in a bash script in the foreground:

#!/bin/bash
export VIRUALENV_ACTIVATOR_SIMPLE=1
. /home/protected/server/venv/etc/activate.sh
exec python2 server.py

When I try to run the script, though, I get the following error:

[28/Apr/2016:18:59:19] ENGINE Error in 'start' listener <bound method 
DropPrivileges.start of <cherrypy.process.plugins.DropPrivileges object at 
0x805a9bd10>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/site-packages/cherrypy/process/wspbus.py", 
line 203, in publish
    output.append(listener(*args, **kwargs))
  File 
"/usr/local/lib/python2.7/site-packages/cherrypy/process/plugins.py", line 
285, in start
    self.bus.log('Started as uid: %r gid: %r' % current_ids())
  File 
"/usr/local/lib/python2.7/site-packages/cherrypy/process/plugins.py", line 
273, in current_ids
    group = grp.getgrgid(os.getgid())[0]
KeyError: 'getgrgid(): gid not found: 246576'

246576 is my personal UID. The hosting service is running the script as me, 
and the intent is that once started, privileges will drop to to uid 25000. 
What am I doing wrong?

Thanks!!

-- 
You received this message because you are subscribed to the Google Groups "cherrypy-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to cherrypy-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
To post to this group, send email to cherrypy-users-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
Visit this group at https://groups.google.com/group/cherrypy-users.
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.