If you lost your password for the web interface Admin login of your OwnCloud installation; Or perhaps, like myself, you weren’t paying attention and glossed over that part when you set up the MySQL DB settings and closed out the browser before configuring anything else, fear not! After searching high and low and trying several different methods, including replacing hashes and modifying database tables and whatnot, I have found the solution that is kind of cobbled together from a couple of sites, including OwnCloud’s forums.
There may be other ways to do this, but this was by far the easiest (and only working) method, I have come across. This method was supposedly introduced in version 7 of OwnCloud so I can’t say if it works for previous versions (or even future versions). Also note, I am using a Debian 7.6 (Wheezy) server to host OwnCloud. If you have a better method, please comment below.
1. Open a Terminal session
2. Change the directory to your OwnCloud installation (The default is /var/www/owncloud):
$ cd /var/www/owncloud
3. Run the following command:
$ sudo ./occ user:resetpassword admin (It may ask you to enter the password to use sudo- enter your user’s password)
4. Enter the new password and press enter. Then enter it once more to confirm and press enter. (note that the cursor will not move while you type the password in either case)
5. Once you have confirmed the new password, you should see that you have “Successfully reset password for admin”. Now go to the web interface and login as admin.
But wait! There’s more!
6. What if, like me, you had not already made an occ file, executable? You would have been greeted by a message:
sudo: .occ: command not found
7. To get around this, you must run the following command to make an occ file executable:
$ sudo chmod +x occ
8. Now you can run the command in step 3 and successfully change the admin password.