diff --git a/hp-labrea/labrea-idea.py b/hp-labrea/labrea-idea.py
index 9b347076dcd074447230bc0e05e14741d5f7cc0f..2e030f97a2c5b31dabf1c1359920653ee69630eb 100755
--- a/hp-labrea/labrea-idea.py
+++ b/hp-labrea/labrea-idea.py
@@ -399,6 +399,17 @@ class Filer(object):
         os.rename(pth.join(self.tmp, short_name), pth.join(self.incoming, short_name))
 
 
+def get_uid_gid(str_id, get_nam_func):
+    if str_id:
+        try:
+            id = int(str_id)
+        except ValueError:
+            id = get_nam_func(str_id)[2]
+    else:
+        id = None
+    return id
+
+
 def daemonize(
         work_dir=None, chroot_dir=None,
         umask=None, uid=None, gid=None,
@@ -411,8 +422,10 @@ def daemonize(
         os.umask(umask)
     if work_dir is not None:
         os.chdir(work_dir)
+    gid = get_uid_gid(gid, getgrnam)
     if gid is not None:
         os.setgid(gid)
+    uid = get_uid_gid(uid, getpwnam)
     if uid is not None:
         os.setuid(uid)
     # Doublefork, split session
@@ -572,14 +585,14 @@ def get_args():
         "-u", "--uid",
         default=None,
         dest="uid",
-        type="int",
+        type="string",
         action="store",
         help="user id to run under")
     optp.add_option(
         "-g", "--gid",
         default=None,
         dest="gid",
-        type="int",
+        type="string",
         action="store",
         help="group id to run under")
     optp.add_option(