0

I have a weird one. I have a site that was abandoned for a while and we need to get access to it again. So I tried to use drush to reset the admin password, but it's not working.

I'm using Drush 8.1.17 on what I presume is a Drupal 7.57 site (because of the CHANGELOG.txt file in the docroot).

Syntax for my command is like: php drush.phar upwd fakeadmin --password="examplepassword123"

I get a message Changed password for fakeadmin success and because I'm literally looking at the users table in my database I can see the hash change in the password field. Yet, when I copy the text 'examplepassword123' (without single quotes) into my login page, it does nothing.

Am I just messing up the Drush 8 syntax? (I'm already more used to Drush 9). What would cause it to not work?

EDIT: Drush just uses whatever DB credentials are in the standard sites/default/settings.php file correct? So if that's correct, then I should be working with the right database. No?

EDIT 2:

1) I tried it without the double quote just in case and that didn't work either.

2) I also tried running the script /scripts/password-hash.sh "examplepassword123" and copied the resulting hash into my database, and nothing happened. (found reading through this: https://www.drupal.org/node/992400)

3) I would almost say I'm using the wrong database at this point except that with another drush command I was able to see it add a new user_role row in an attempt to make another user we have access to an admin. Ideas?

EDIT: Well this was disappointing and weird. Drush was somehow changing the hash but not the password? An employee of ghosts past somehow had it saved on their hard drive, and gave me the password, and it was the same as before. I'm not going to question it....

  • Could the problem be drupal.org/node/1023440 ? Resetting the password probably doesn't clear the flood table. – hansfn Nov 16 '18 at 16:34
  • Will try this next. I was hitting the 5 input maximum, but then nothing was in the flood table. Perhaps the second DB command will help. Thanks. – Aaron Chamberlain Nov 16 '18 at 17:25
  • Aside: you can be more certain of the vintage of the drupal site by checking the .info files for core modules. – rivimey Nov 20 '18 at 0:16
0

Check to see if your cookies are being set correctly. It's possible that your login is succeeding, but if the session cookie is not set, then you will be immediately logged out again (or, more to the point, the browser won't get the message about you being logged in and will continue to present an anonymous user to your site).

Check your settings.php file and see if you have any configuration options related to the cookie domain that are not correct.

  • That's a good suggestion. It appears that I have that comments out, which I believe forces Drupal to just detect what my domain is. Also, I do have one user account I have access to that isn't an admin and when logging in there, the session cookie is present. Might try adding the line anyways just in case. – Aaron Chamberlain Nov 14 '18 at 21:49

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.