server/serverctl.py
branchstable
changeset 7764 c709f6c457ff
parent 7669 b96c41c6de4d
child 7815 2a164a9cf81c
--- a/server/serverctl.py	Tue Sep 06 15:11:35 2011 +0200
+++ b/server/serverctl.py	Tue Sep 06 15:16:06 2011 +0200
@@ -651,7 +651,7 @@
         )
 
     def run(self, args):
-        from logilab.common.daemon import daemonize
+        from logilab.common.daemon import daemonize, setugid
         from cubicweb.cwctl import init_cmdline_log_threshold
         from cubicweb.server.server import RepositoryServer
         appid = args[0]
@@ -675,12 +675,7 @@
             return
         uid = config['uid']
         if uid is not None:
-            try:
-                uid = int(uid)
-            except ValueError:
-                from pwd import getpwnam
-                uid = getpwnam(uid).pw_uid
-            os.setuid(uid)
+            setugid(uid)
         server.install_sig_handlers()
         server.connect(config['host'], 0)
         server.run()