I Locked Myself Out of Zope - What do i do?
When you are locked out of Zope, either because you lost the password or because you deleted your user(s) or acl_users folder, you can use the zpasswd.py script and a zope restart to get back in. Read on for how to do this.
Login via SSH
First, you'll need to login to your account via SSH. See the SSH Howto if you don't know about SSH.
Go to the INSTANCE_HOME
Change Directory (cd) to your zope's INSTANCE_HOME, which is usually at /usr/local/zope/instance1.
Become root ('sudo su').
cd /usr/local/zope/instance1
What Version of Zope are you Using?
Now you'll need to find out what version of Zope you are using. You can usually do this by typing:
ll ../
And finding the numbered directory that corresponds to your Zope version. This could be 262 for Zope 2.6 users or 275 if you are using Zope 2.7.5. If have multiple directories whose names are 3 digit numbers and are unsure which to use, just pick any one of them.
For Zope 2.7.x
If your Zope version is 2.7.x then you will run this command:
python ../27x/bin/zpasswd.py access
... where 27x is the actual directory name of your Zope application, as discussed above.
For Zope 2.6.x
If your Zope version is 2.6.x or below, then you will run this command:
python ../26x/zpasswd.py access
... where 26x is the actual directory name of your Zope application, as discussed above.
Follow the Prompts
This will prompt you for a username, password (twice), Encoding and Domain restrictions.
Enter a username that is unlike any you might be using in your Zope. The password should be a short and easy one since we will delete the access file when we're done with it. The last two fields you should simply hit return without entering any value.
The 'access' File
This will create a file called "access" in your zope's INSTANCE_HOME.
Now Restart your Zope
You can now restart your Zope by typing 'zopectl restart` (as root).
Login to Zope and Fix The Damage
After your Zope has restarted, try logging into your Zope root with the new username and password you created. You should now be able to reset the password for your regular user, undo the deletion that broke your ability to login, or otherwise fix the problem you were experiencing.
Don't Forget to Delete the 'access' File!
When you have done that, you should logout of Zope and log back in with a regular user. Now that you are sure you have resolved your inability to login to Zope, you should delete the access file:
rm access
Not deleting it opens up a security vulnerability and is extremely unwise.
Questions?
Please contact us with your questions and we will get back to you right away.
