How to add manager


This article shows how to add another Zope Manager to top acl_users folder. Under Linux you can use zopectl but this desn’t work on Windows.


Some time ago it was possible to add Manager to Zope instance using inituser file. I’m not sure when or why this functionality was abandoned. But currently it is possible only using zopectl adduser command. There is a little problem on Windows. This script doesn’t work on this system. I’ve looked inside code of Zope2/Startup/ and it is really focused on Linux. So I had to find my own solution.


Copy those 2 files described below to your /bin directory and run:

If user does not exist it will be added. Otherwise you will see message or error. It was tested on Zope 2.9

Shell script add_user.bat

First part is a shell script – .bat file. It sets some variables (copied from runzope.bat). But variables defined in runzope.bat were not enough. I was getting errors until I’ve defined ZOPE_CONFIG. This environment variable is used during startup to find config file.

Python script

And here is Python script that adds user. The most important fragment is copied from method do_adduser inside Zope2/Startup/ Then I’ve added few details like reading data from command line parameters, checking if user exists, nice messages.

if len (sys.argv) 3 :
print “Bad syntax:

else :
LOGIN=sys.argv[ 1 ]
PASSWORD=sys.argv[ 2 ]
#Remove all arguments otherwise raise error
del sys.argv[ 2 ]
del sys.argv[ 1 ]

import Zope2
app =
try :
acl_users = app.acl_users
if not acl_users.getUser(LOGIN):
acl_users._doAddUser(LOGIN,PASSWORD, [ ‘Manager’ ], [])
import transaction
print “User ‘%s’ added” %LOGIN
else :
print “User ‘%s’ already exists, not added” %LOGIN
except :
print “User ‘%s’ NOT added” %LOGIN
print “ERROR: %s-%s ” %(sys.exc_info()[ 0 ],sys.exc_info()[ 1 ])

just one to add one user with manager role

Could you tell me how to add one user manager into zope site cause i have just taken over a zope system but i don’t have any account to manage it.

i just add some code into: ..\lib\python\Zope\App\

acl_users = app.acl_users
acl_users._doAddUser(‘nghia’,’password’, [‘Manager’], [])

but it’s seem not working

Could you show me how to.

Thanks in advance

How to add manager

6. Start instance: ‘./zopectl start’

Rate article
Add a comment