Warning: Following the instruction below at your own risks, because bad things happen! Don’t blame me for your bravery in destroying ownCloud’s database if something goes wrong and beyond one’s expectation. Nonetheless, I’ve used the exact directives to successfully change the admin and users passwords for ownCloud.
Forgetting your ownCloud’s password? Whether your ownCloud’s admin or regular user password is lost, you can always restore or change the password for the admin or user. Perhaps, you forgot to enter the email address into user’s settings to receive lost password reset email, to think that you’re stuck is being crazy. Of course, unless you forgot your MySQL database’s root password too, then you really are stuck and won’t be able to access your data that reside within ownCloud. Nonetheless, let’s hope you aren’t yet out of options, then you can totally use your MySQL’s root password to edit your ownCloud’s admin or user password. I won’t talk about how to access and edit any other database as I can barely get around MySQL. Nonetheless, read on and the trick is here to treat you well.
I don’t even bother with MySQL command lines, and so I sure hope you have installed phpMyAdmin. We will use phpMyAdmin to edit out the oc_users table’s passwords.
- So, first of all, log into your ownCloud MySQL’s database as a root user or the owner of ownCloud database through phpMyAdmin.
- Secondly, expand the left panel and expand the ownCloud database. You should see bunch of ownCloud tables underneath ownCloud’s database, and these tables should begin with oc_ extension. Try to find oc_users!
- Click on oc_users to access the oc_users table. Before you even think aboud editing a user entry within this table, you must know that once you edit a user’s password there is no going back to the original password. Of course, if you already know the original password, you wouldn’t do this in the first place!
- Click on the edit link next to the user to access the oc_users’ user entry. In here you can change the password for a user. Don’t do anything yet though, because the passwords store within oc_users table are encrypted with whatever. If you delete the encrypted passphrase, you basically delete the password. Nonetheless, you can’t enter a password of your own, because your password isn’t encrypted. If you try to enter a plain password, your user account won’t see the password change. Furthermore, if you try to empty out the password, ownCloud’s login page won’t allow you to access ownCloud service even though you had emptied out the password.
- If you read my instruction carefully, it means you haven’t done anything yet. Good, because now you need to open up a web browser’s tab or a new web browser so you can go to http://pajhome.org.uk/crypt/md5/ (link). If this webpage is still the same and has yet to be changed, under the Demonstration section you should see MD5/SHA-1 boxes. Instead of entering a real password that can be read by the owner of this website, you need to enter a weak password (that you plan to change it later) into the Input Calculate Result’s top box. When done entering a temporary password that is easy to remember, hit the SHA-1 button to allow the webpage to generate the SHA-1 hash. Make sure you copy the SHA-1 hash result in the bottom box.
- We need to paste the SHA-1 hash passphrase into the password’s value field (box) of a user you want to change the password for within the database. So, back in phpMyAdmin, within a user’s entry which resides within the oc_users table, you need to enter the SHA-1 hash into the password’s value field (box). Hit the Go button which situates right underneath the password’s value field (box). This should do it.
- Now, you can try log into ownCloud service with a new password that you had created for the ownCloud user. Of course, the password isn’t the SHA-1 hash passphrase, because the ownCloud’s login page expects the regular plain password that you encrypted with SHA-1 hash earlier. If everything goes as plan, you should be able logging into the ownCloud’s admin or user account. From, here you can change the password in Personal page, and so you should change the password you just changed for your ownCloud admin or user into a really strong password.
Now, you can chuck down a beer and congratulate yourself a job well done.