Hw to Recover admin username/password if lost completely

Ask all your questions regarding OC 5.x Please read the Support Forum Rules
Forum rules
ownCloud 5.x reached end of life and is officially unsupported. For details see Wiki page.

Please upgrade your ownCloud.
fly
Helpful Elf
Posts: 190
Joined: Wed Jun 27, 2012 5:26 pm

Hw to Recover admin username/password if lost completely

Postby fly » Thu Apr 18, 2013 4:11 pm

Hi there!
Is there a way to recover/gain knowledge of the admin username/password if nobody can log in and nobody can reset the password via email? (e.g the admin has changed his username/password but has forgotton it!!!)

Full FTP access to the OC installation is available.

Is the username/password stored somewhere in a file?

Thank you!!

User avatar
RandolphCarter
ownCloud master
Posts: 5134
Joined: Wed May 30, 2012 8:42 am
ownCloud version: 8.1.1
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Re: Hw to Recover admin username/password if lost completely

Postby RandolphCarter » Thu Apr 18, 2013 4:27 pm

User/pw are only in the database, there is however a config setting which affects login (passwordsalt). But for mor info best see this thread: viewtopic.php?f=3&t=8099#p19500

fly
Helpful Elf
Posts: 190
Joined: Wed Jun 27, 2012 5:26 pm

Re: Hw to Recover admin username/password if lost completely

Postby fly » Thu Apr 18, 2013 6:07 pm

RandolphCarter wrote:User/pw are only in the database,


Cant I simply read out User/pw information from the mysqllite database file??
Anyone knows how to do this?

cantlep
Helpful Elf
Posts: 162
Joined: Thu Jan 24, 2013 7:01 pm
ownCloud version: 6.0.3
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.3.3

Re: Hw to Recover admin username/password if lost completely

Postby cantlep » Thu Apr 18, 2013 6:23 pm

I'd expect it to be hashed, so no.

User avatar
RandolphCarter
ownCloud master
Posts: 5134
Joined: Wed May 30, 2012 8:42 am
ownCloud version: 8.1.1
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Re: Hw to Recover admin username/password if lost completely

Postby RandolphCarter » Sat Apr 20, 2013 1:39 am

mysqllite

There's no such thing as mysqlite ;). And no, passwords are not stored in clear form (for security reasons), so you can't retrieve them from the database. Your only option is to reset them, please see the thread I posted for that.

fly
Helpful Elf
Posts: 190
Joined: Wed Jun 27, 2012 5:26 pm

Re: Hw to Recover admin username/password if lost completely

Postby fly » Sun Apr 21, 2013 7:49 pm

RandolphCarter wrote:
mysqllite

Your only option is to reset them, please see the thread I posted for that.

Ok Thank you

guang
Newbie
Posts: 2
Joined: Fri Jul 05, 2013 4:46 am
ownCloud version: 5.0.7
Webserver: Apache
Database: SQLite
OS: Linux
PHP version: 5.3.3

Re: Hw to Recover admin username/password if lost completely

Postby guang » Fri Jul 05, 2013 5:02 am

Hello all, I have found an easier way to recover your lost password from jbkc85's blog:

http://jbkc85.com/content/owncloud-database-password-change

Code: Select all

Log into the server hosting your owncloud installation
Navigate to the sites directory (ie: /var/www/owncloud)
Navigate to the 'phppass' 3rd party app (ie: /3rdparty/phpass)
edit the test.php file and replace the following:
edit $t_hasher = new PasswordHash(8, FALSE); to -
$t_hasher = new PasswordHash(8, CRYPT_BLOWFISH!=1);
edit $correct = 'test12345'; to -
$correct = 'yournewpass'.'yourconfigpasswordsalt';
Run 'php test.php'
Copy the first line that has 'Hash: $2a...'
Log into your database (MySQL is the example)
mysql -u root -p
use owncloud;
select * from oc_user;
Note the password value, copy it just in case
update oc_user set password= 'generatedhash' where uid = 'youruser';


if you use sqlite, then you need to find the right owncloud.db file and update the database as follow:
*****You should make a copy of your owncloud.db file first before make any change in case you cause any problem with the sqlite database update. *******

Code: Select all

root@owncloud data]# sqlite3 owncloud.db
SQLite version 3.6.20
Enter ".help" for instructions
Enter SQL statements terminated with a ";"
sqlite> select * from oc_users;
admin|| originalPassword#hash
sqlite>  update oc_users set password = 'generatedhash' where uid ='admin';
sqlite> select * fromoc_users;
admin|| generatedhash
sqlite> .exit


Good luck.

menacingm
Newbie
Posts: 1
Joined: Tue Sep 24, 2013 7:31 am
ownCloud version: 4.5.6
Webserver: Apache
Database: SQLite

Re: Hw to Recover admin username/password if lost completely

Postby menacingm » Tue Sep 24, 2013 7:33 am

Where do you find the 'yourconfigpasswordsalt' ?

User avatar
RandolphCarter
ownCloud master
Posts: 5134
Joined: Wed May 30, 2012 8:42 am
ownCloud version: 8.1.1
Webserver: Apache
Database: MySQL
OS: Linux
PHP version: 5.5.x

Re: Hw to Recover admin username/password if lost completely

Postby RandolphCarter » Tue Sep 24, 2013 9:40 pm

The "passwordsalt" setting in your config.php.
See the config.sample.php for an explanation: https://github.com/owncloud/core/blob/s ... le.php#L30


  • Similar Topics
    Replies
    Views
    Last post

Return to “ownCloud Community Edition 5.x and older”

Who is online

Users browsing this forum: Yahoo [Bot] and 3 guests