Forums | Mahara Community
Support
/
Unable to login after site migration
26 May 2016, 23:39
Hi,
I needed to create a duplication of our live Mahara site for testing. The current site is version 15.04 (on Ubuntu 14.04.2 / Apache 2 & PHP 5.5.9 / MySQL 5.5.43 server). So I went about it as follows:
- Copied [mahararoot] & [maharadataroot] to the new (second) server
- Closed the live site
- Backed up the live site database
- Installed the copied database on the new server
So far so good. Then I loaded the new site in the browser and got the following:
The site is temporarily closed for a database upgrade. Site administrators may log in.
When I tried to login using admin username, I got the following error:
You have not provided the correct credentials to log in. Please check your username and password are correct.
Problem is I WAS using the correct username and password so I wasn’t sure why I couldn’t login. I’ve tried 3 other site administrator login details and got the same error. The original site is network enabled for SSO (Moodle to Mahara) but all the user IDs tried are not members of the Mahoodle institution set up on the original site (authinstance for all including admin is 1).
I’ve been reading related posts about this issue and have tried to troubleshoot so the following checks have been done:
- Tried resetting passwords for admin and the other 3 site adminstrators. (Even used the script suggested here: https://mahara.org/interaction/forum/topic.php?id=4594.)
- In the usr table, authinstance field for admin (and the other site administrators) is 1
- There is no entry for admin in auth_remote_user table
- Managed to get cron to work (Found out from here - https://mahara.org/interaction/forum/topic.php?id=4793#post21375 – cron will not run if the site is closed so I followed the suggestion here: https://mahara.org/interaction/forum/topic.php?id=5279 and overwrote the setting in the database with: update config set value='0' where field='siteclosedbyadmin';).
Could anyone tell me what I’m clearly missing please? Should I have disabled networking before backing up the database for instance? Wondering if that’s the problem although I am not sure why this will affect login by internal users. Clearly grasping at straws:).
Thanks for your help.
Remy
27 May 2016, 7:57
Hi Remy,Have you modified your config.php to point to the new site?
* wwwconfig
* database name and host
* please make sure the main site salt is still the same as in your main site config file
I'm probably stating the obvious but always good to double check.
Please let me know how you go.
Cheers,
Ghada
31 May 2016, 19:51
Hi Ghada,
You are a life saver - turns out differences in the salt value was the problem. Thank you very much!
I thought I needed to create a different salt value for the migrated site but guess I was wrong. I can confirm I'm now able to login.
Regards,
Remy
27 May 2016, 8:38
Hi Remy,
On top of what Ghada already mentioned, take a look at the instructions for copying a database. It does mention the command for changing the wwwroot in the DB in case it is in there.
Here are slightly shorter instructions:
Restore your DB. In Postgres for example: sudo -u postgres pg_restore -O -j4 -d DBname -U maharauser -W -h localhost pathto/DB.pg
Enter the password you use to connect to the database.
Once that is done you will need to reset the password for a user before you can log in:
Go to you mahara webroot and then got to admin/cli/ directory and type
sudo php reset_password.php -h
To show you the settings for resetting a password
To reset a password do this:
sudo php admin/cli/reset_password.php -u=username -p=mynewpassword
And so try logging in with 'mynewpassword' and it should let you in and ask you to reset your password
You will need to copy the dataroot information into the correct place on your machine
You may need to update the permissions settings on the dataroot files for example
chown -R www-data:www-data artefact/
find /full/path/to/dataroot/artefact/ -type d -exec chmod 700 {} \;
find /full/path/to/dataroot/artefact/ -type f -exec chmod 600 {} \;
Cheers
Kristina
31 May 2016, 19:54
Thanks Kristina.
In this case, the difference in the site salt was the problem but appreciate your tips for changing / resetting passwords.
Regards,
Remy