I have installed owncloud 6.0 for testing purpose and later a stage i upgraded to 7.0 & 8.0 but i forget to assign the email id for password reset request and now i forget my owncloud admin password and trying to reset. I have spend lots of time on owncloud forum and found few more solution. In my point of view the below one is very simple and effective. See the below steps to reset the owncloud admin password.
1) Reset Owncloud 7 & 8 Admin password
To reset owncloud 7 & 8 admin password, we can use the occ command to reset the password which will uses HTTP user, follow the below procedure. Make sure you have to mention your owncloud installation directory insteadof us /var/www/dev.2daygeek.com/public_html/owncloud/occ.
# For Debian based Systems # $ sudo -u www-data php /var/www/dev.2daygeek.com/public_html/owncloud/occ user:resetpassword admin Enter a new password: Confirm the new password: Successfully reset password for admin # For RHEL based Systems # $ sudo -u apache php /var/www/dev.2daygeek.com/public_html/owncloud/occ user:resetpassword admin Enter a new password: Confirm the new password: Successfully reset password for admin # For openSUSE Systems # $ sudo -u www php /var/www/dev.2daygeek.com/public_html/owncloud/occ user:resetpassword admin Enter a new password: Confirm the new password: Successfully reset password for admin
1) Reset Owncloud 6 Admin password
To reset owncloud 6 admin password, follow the below procedure. Navigate to your owncloud installation directory & open config/config.php file and passwordsalt value. It will use later a stage.
# cd /var/www/dev.2daygeek.com/public_html/owncloud/config # nano config.php $CONFIG = array ( 'instanceid' => 'ocad6719eb29', 'passwordsalt' => 'f1f4ffb343483cae0fcc2f6d8d6797', 'trusted_domains' => array ( 0 => 'owncloud.2daygeek.com', ), 'datadirectory' => '/var/www/dev.2daygeek.com/public_html/owncloud/data', );
2) Navigate to phpass directory
Navigate to your phpass directory. Open test.php file and comment below orange colour lines and add green coloured line value newely under the orange colour line. Make sure you need to add your new password instead of admin123 and your passwordsalt value which we noted in step2. Save and exit.
# cd /var/www/dev.2daygeek.com/public_html/owncloud/3rdparty/phpass # nano test.php # Try to use stronger but system-specific hashes, with a possible fallback to # the weaker portable hashes. #$t_hasher = new PasswordHash(8, FALSE); $t_hasher = new PasswordHash(8, CRYPT_BLOWFISH!=1); #$correct = 'test12345'; $correct = 'admin123'.'f1f4ffb343483cae0fcc2f6d8d6797'; $hash = $t_hasher->HashPassword($correct); print 'Hash: ' . $hash . "\n";
4) Run the test.php file
After made above change, Run the test.php file. Like below and it will shows below result’s. Make sure you need to copy the First Hash value which is start value like $2….
# php test.php Hash: $2a$08$7nZBhzaJVMPqMICMrXMKQOEvmQ47z5QtQ4FxPSWv5ecRIvRq7j332 Check correct: '1' (should be '1') Check wrong: '' (should be '0' or '') Hash: $P$BJ4/Sgm8k9lsH1xgZMx9KGzlQvDuM3. Check correct: '1' (should be '1') Check wrong: '' (should be '0' or '') Hash: $P$9IQRaTwmfeRo7ud9Fh4E2PdI0S3r.L0 Check correct: '' (should be '1') Check wrong: '' (should be '0' or '') Some tests have FAILED
Note : After done this, you can remove the new changes which you made on your test.php file.
5) Update the new password to admin user
Login to mysql server and navigate to owncloud database and run the below command to update the admin password.
# mysql -u root -p mysql> use owncloud_cloud; mysql> UPDATE `oc_users` SET `password` = '$2a$08$7nZBhzaJVMPqMICMrXMKQOEvmQ47z5QtQ4FxPSWv5ecRIvRq7j332' WHERE `uid` = 'admin';
6) Owncloud password reset successful
Now, you have successfully reset your owncloud password, just navigate on your owncloud installation url on browser and login into your admin account using your new password. In my case new password is admin123 and play it.
We are preparing all articles in-depth to understand by all level/stage Linux administrators. If the article is useful for you, then please spend less than a minute to share your valuable comments in our commenting section.
Please stay tune with us…Good Luck.