Forgetting your password can be tiresome, especially if you’re the (only) administrator. Owncloud allows you to reset your password via the user-supplied email address, but this does of course only work if you have an email associated with your account.
Furthermore, the system needs to have a mail server configured. Perhaps you don’t, because of some reason, want to have a mail server up and running.
So here’s how you reset your owncloud admin (or user) password the quick and dirty way.
NOTE: This worked for me, at the time of posting. Future versions might not work this way. Please do proper research before looking into my solution. I am in no way responsible for you breaking something. OK?
First, log in as root or make sure you have sudo access. Or at least make sure you are allowed to modify the owncloud files.
We will be modifying the password reset function, instead of going into the database. Please back your existing controller.php file up, and understand that you are going to be susceptible to hacking attempts while making the following modifications.
We want to supply an email to the system by hard-coding it, and then print the password-reset URL to us. OwnCloud will then continue with its own procedures and attempt to mail the password to the email you provide. Essentially we’re printing the link you’re supposed to get via mail. If you leave this modification in place, anyone will be able to gain access to your OwnCloud!
Go to line 48 and on the line below insert (line 48 begins with $email)
$email = “firstname.lastname@example.org”; //Set email
Then go to line 53 and on the line below insert (line 53 begins with $link, and this is line 53 after you added the previous line.)
echo $link; //Print email reset link (DO NOT LEAVE THIS IN PLACE)
Now go to your OwnCloud, and try to log in. When it fails, click forgot password link, and then enter your username. You should see the password reset URL pop up. Copy, paste, and chose a new password.
And remove the lines you just added! DO NOT LEAVE THEM IN PLACE.
I found this to be easier than to edit the database.