[Zope] How to start zope in more than one group

Fischer Ulrich ulrich.fischer@sfwte.ch
Thu, 21 Mar 2002 17:26:43 +0100


Hi

normaly, zope is started as root and runs as user 'nobody' or a
predefined user 'zuser'. I use zope (Zope 2.3.3) in the second way on
SUSE Linux7.2. Zope is connected to Apache. The 'zuser' is in the user
groups A, B, C, ... The membership in group 'A' is defined in the passwd
file ('user's primary group'), the other memberships are defined in the
group file. My problem is, that z2.py reads only the 'user's primary
group' in the passwd file. But I need for full functionality all the
grouprights of the user 'zuser'. Is there a possibilty to fix this? Do I
have to change z2.py, when, how (I only know how to write 'python')

z2.py (the part where the gid is set)
:
:
    # Try to set uid to "-u" -provided uid.
    # Try to set gid to  "-u" user's primary group.
    # This will only work if this script is run by root.
    try:
        import pwd
        try:
            try:    UID = string.atoi(UID)
            except: pass
            gid = None
            if type(UID) == type(""):
                uid = pwd.getpwnam(UID)[2]
                gid = pwd.getpwnam(UID)[3]
            elif type(UID) == type(1):
                uid = pwd.getpwuid(UID)[2]
                gid = pwd.getpwuid(UID)[3]
            else:
                raise KeyError
            try:
                if gid is not None:
                    try:
                        os.setgid(gid)
                    except OSError:
                        pass
                os.setuid(uid)
            except OSError:
                pass
        except KeyError:
            zLOG.LOG("z2", zLOG.ERROR, ("can't find UID %s" % UID))
    except:
        pass
:
:



Thanks
Best regards

Ulrich

_______________________________________________________________

Ulrich G. Fischer
Dipl. Natw. ETH
Center Aerodynamic

Ruag Aerospace
Technologies/Projects Division		Tel. +41 41 268 38 79
P.O. Box 301				Fax. +41 41 268 38 97
CH-6032 Emmen				ulrich.fischer@ruag.com
Switzerland				www.ruag.com
_______________________________________________________________