How to repair damaged config.php

Ask all your questions regarding OC 8.0 and 8.1 Please read the Support Forum Rules
Forum rules
The forums were migrated over to https://central.owncloud.org which is based on the forum software Discourse. The forums here is put into read-only mode starting from today.

More background information about this move and the reasoning behind it is available in this blogpost:

https://daniel.molkentin.net/2016/07/20 ... d-central/
rvanhouten
Beginner
Posts: 16
Joined: Fri Jul 10, 2015 9:47 am
ownCloud version: 8.0.4
Webserver: nginx
Database: PostgreSQL
OS: Linux
PHP version: 5.4

How to repair damaged config.php

Postby rvanhouten » Sun Jul 19, 2015 1:25 pm

By mistake I removed almost all of the lines in config.php. When I tried to login, I was presented the install wizard, i.e. I was asked to create a new account, select a database, enter db_account/db_passwd/db_name/db_host (I use Postgresql as database). I entered all the correct info. As a result config.php is rebuilt. However, in config.php for 'dbuser' now it says 'oc-oc-admin' where I entered 'oc-admin' on owncloud's web-page. So it prefixed the username with 'oc_'. I assume the hash value for the password will also not match my 'oc_admin' username. When I try to login to owncloud on the web, as expected, I get a Postgres login error.

Is there a way to recover from a damaged config.php? I hope that if I can somehow get the has value for 'dbpassword' back, I'm able to log in again.

Any help is appreciated.

TIA,
Reinier van Houten.

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: How to repair damaged config.php

Postby RealRancor » Sun Jul 19, 2015 1:55 pm

Hi,

the dbpassword entry is not hashed but just a very strong generated password.
*gone*

rvanhouten
Beginner
Posts: 16
Joined: Fri Jul 10, 2015 9:47 am
ownCloud version: 8.0.4
Webserver: nginx
Database: PostgreSQL
OS: Linux
PHP version: 5.4

Re: How to repair damaged config.php

Postby rvanhouten » Sun Jul 19, 2015 2:02 pm

Okay, but can I re-generate it? I do know the original human readable password.

--Reinier

RealRancor
ownCloud master
Posts: 17381
Joined: Sat May 26, 2012 3:00 pm
ownCloud version: 9.0.2
Webserver: nginx
Database: MySQL
OS: Linux
PHP version: 7.0.x

Re: How to repair damaged config.php

Postby RealRancor » Sun Jul 19, 2015 2:05 pm

Hi,

as written above this is human-readable. You can use the new generated one and update the password of your current mysql user with it.
*gone*

rvanhouten
Beginner
Posts: 16
Joined: Fri Jul 10, 2015 9:47 am
ownCloud version: 8.0.4
Webserver: nginx
Database: PostgreSQL
OS: Linux
PHP version: 5.4

Re: How to repair damaged config.php

Postby rvanhouten » Sun Jul 19, 2015 2:18 pm

As a matter of fact, password was the same (user oc_admin and user oc_oc_admin had same password). I don't know the algorithm to generate the value that shows up in config.php, but given the human-readable password was the same, is the newly generated one (for oc_oc_admin) the same as the original (for oc_admin)?

tflidd
Forum Moderator
Posts: 7159
Joined: Sat Dec 07, 2013 7:27 pm
ownCloud version: 8.2.3
Webserver: Apache
Database: MySQL
OS: Linux

Re: How to repair damaged config.php

Postby tflidd » Sun Jul 19, 2015 4:18 pm

If security is not completely broken, the passwords should be different each time.

I don't understand why you have different users. You shouldn't follow the setup guide because it sets up new tables in your database (and you want to use the old one). To avoid the install manager, there is some information missing in your config.php. Here is a config.php of a freshly installed owncloud (you need to put in your hostname, username etc.):

Code: Select all

<?php
$CONFIG = array (
  'instanceid' => 'ocmr3ngu09p3',
  'passwordsalt' => 'TH8hiIMlIIRGd01NXKpiTMRujiekzg',
  'secret' => 'kVbcdXsnq97HwiQrutU55PtMYE7kMRYTRFhAtITNp3BUkB74',
  'trusted_domains' =>
  array (
    0 => 'myhost.example.com',
  ),
  'datadirectory' => '/var/www/owncloud/data',
  'dbtype' => 'mysql',
  'version' => '8.0.4.2',
  'dbname' => 'owncloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'oc_admin',
  'dbpassword' => 'xxxxxx',
  'installed' => true,
  'loglevel' => 0,
);

For password-salt and secret, you should use some random-data. You will probably get to the login screen but login won't work because the password-salt has changed. If you have an e-mail-address associated to your account, you can use the reset function. I'm not sure where the string in secret-variable is used for (encryption app?).

rvanhouten
Beginner
Posts: 16
Joined: Fri Jul 10, 2015 9:47 am
ownCloud version: 8.0.4
Webserver: nginx
Database: PostgreSQL
OS: Linux
PHP version: 5.4

Re: How to repair damaged config.php

Postby rvanhouten » Sun Jul 19, 2015 5:25 pm

Hi, thanks.

When trying to login, I'm getting an internal server error. Owncloud.log shows a "password authentication failed' msg. User (or 'role' as it's called in Postgres) is defined though. It's oc_admin. This the sames as dbuser in config.php. It's also defined as the owner of database 'owncloud'. So, on paper everything looks okay. Can't login though.

Tried occ to reset password, but in vain since I can't login there either. It looks like either something is broken in the db somewhere or in owncloud's settings somewhere (although config.php seems reasonably healthy again).

Will keep on investigating, but if someone has hints or tips in the meantime, by all means...

Thanks,
Reinier.

tflidd
Forum Moderator
Posts: 7159
Joined: Sat Dec 07, 2013 7:27 pm
ownCloud version: 8.2.3
Webserver: Apache
Database: MySQL
OS: Linux

Re: How to repair damaged config.php

Postby tflidd » Sun Jul 19, 2015 5:46 pm

Can you login as the owncloud user on the database (from command line)?

rvanhouten
Beginner
Posts: 16
Joined: Fri Jul 10, 2015 9:47 am
ownCloud version: 8.0.4
Webserver: nginx
Database: PostgreSQL
OS: Linux
PHP version: 5.4

Re: How to repair damaged config.php

Postby rvanhouten » Sun Jul 19, 2015 6:02 pm

No, cmd-line db access gives me the same 'password authentication failed for user oc_admin' msg.

rvanhouten
Beginner
Posts: 16
Joined: Fri Jul 10, 2015 9:47 am
ownCloud version: 8.0.4
Webserver: nginx
Database: PostgreSQL
OS: Linux
PHP version: 5.4

Re: How to repair damaged config.php

Postby rvanhouten » Sun Jul 19, 2015 6:06 pm

I can login though as superuser 'postgres'. Then I can query the database and see that db 'owncloud' is defined with its owner 'oc_admin'. It has a password, but it's not visible.


  • Similar Topics
    Replies
    Views
    Last post

Return to “ownCloud Server 8.0 and 8.1”

Who is online

Users browsing this forum: No registered users and 3 guests