|
| 1 | +--- |
| 2 | +myst: |
| 3 | + html_meta: |
| 4 | + "description": "How to create a Zope manager user in an existing Zope instance" |
| 5 | + "property=og:description": "How to create a Zope manager user in an existing Zope instance" |
| 6 | + "property=og:title": "Zope manager users" |
| 7 | + "keywords": "Plone, Zope, users, admin user, emergency user, administration, pip, buildout" |
| 8 | +--- |
| 9 | + |
| 10 | +(admin-guide-zope-manager-user-label)= |
| 11 | + |
| 12 | +# Zope manager users |
| 13 | + |
| 14 | +This guide explains how to add a Zope user with the "manager" role—called a "Zope manager user"—to an existing Zope instance. |
| 15 | + |
| 16 | +Zope manager users have full access to the whole Zope instance. |
| 17 | + |
| 18 | +Some installation methods automatically create a Zope manager user named `admin` for you already. |
| 19 | + |
| 20 | +There are multiple reasons why you might need to add a Zope manager user, including the following. |
| 21 | + |
| 22 | +- Your installation method did not create one. |
| 23 | +- You lost access to your instance. |
| 24 | +- You inherited a project without proper documentation. |
| 25 | + |
| 26 | +```{note} |
| 27 | +If you need to regain access to your instance, this user is also referred to as an "emergency user" in this context only. |
| 28 | +
|
| 29 | +The emergency user is a superuser with full access to the Zope instance. |
| 30 | +It is not limited to a specific Plone site. |
| 31 | +Please be aware of the security implications. |
| 32 | +Consider changing the passwords of the existing Zope manager users after you regain access to your instance. |
| 33 | +``` |
| 34 | + |
| 35 | +(admin-guide-add-a-new-zope-manager-user-label)= |
| 36 | + |
| 37 | +## Add a new Zope manager user |
| 38 | + |
| 39 | +There are multiple methods to create a Zope manager user. |
| 40 | +The method depends on how you created and manage your Zope instance, either via {term}`buildout` or {term}`pip`. |
| 41 | + |
| 42 | +```{important} |
| 43 | +If you are running a standalone instance, you must stop it before adding the user. |
| 44 | +``` |
| 45 | + |
| 46 | +(admin-guide-adduser-instance-command-label)= |
| 47 | + |
| 48 | +### `adduser` instance command |
| 49 | + |
| 50 | +If your site was installed with `buildout` and `plone.recipe.zope2instance`, you can add a Zope manager user via the instance script. |
| 51 | + |
| 52 | +Run the following command. |
| 53 | + |
| 54 | +```shell |
| 55 | +bin/instance adduser username password |
| 56 | +``` |
| 57 | + |
| 58 | +The name of the instance script might vary based on your installation. |
| 59 | +Replace `username` and `password` with the desired values. |
| 60 | + |
| 61 | +If the command is successful, then it will return the following console output. |
| 62 | + |
| 63 | +```console |
| 64 | +Created user: username |
| 65 | +``` |
| 66 | + |
| 67 | +When you run the script, if the user already exists: |
| 68 | + |
| 69 | +- No user will be created. |
| 70 | +- The password will not be changed. |
| 71 | +- The command will return a message such as the following. |
| 72 | + |
| 73 | + ```console |
| 74 | + Created user: None |
| 75 | + ``` |
| 76 | + |
| 77 | +(admin-guide-addzopeuser-command-label)= |
| 78 | + |
| 79 | +### `addzopeuser` script |
| 80 | + |
| 81 | +For `pip` based installations, you will have a script called `addzopeuser` in the {file}`bin` directory of your virtual environment. |
| 82 | +The `addzopeuser` script might also be available in `buildout` based installations. |
| 83 | + |
| 84 | +Run the following command. |
| 85 | + |
| 86 | +```shell |
| 87 | +$ .venv/bin/addzopeuser -c path/to/etc/zope.conf username password |
| 88 | +``` |
| 89 | + |
| 90 | +The `addzopeuser` script and {file}`zope.conf` locations might vary based on your installation. |
| 91 | +Replace `username` and `password` with the desired values. |
| 92 | + |
| 93 | +If the command is successful, then it will return the following console output. |
| 94 | + |
| 95 | +```console |
| 96 | +User username created. |
| 97 | +``` |
| 98 | + |
| 99 | +When you run the script, if the user already exists: |
| 100 | + |
| 101 | +- No user will be created. |
| 102 | +- The password will not be changed. |
| 103 | +- The command will return a message such as the following. |
| 104 | + |
| 105 | + ```console |
| 106 | + Got no result back. User creation may have failed. |
| 107 | + Maybe the user already exists and nothing is done then. |
| 108 | + Or the implementation does not give info when it succeeds. |
| 109 | + ``` |
0 commit comments