0

I have access to a copy of an old version of a production site on a dev server, but the owner of the website on prod has lost his credentials to admin and doesn't know his ssh login credentials. The only option for me to do his content updates is via the drupal web interface.

I'm able to get into the dev site via drush uli admin, but I need the password extracted from the dev server in order to get into the prod website.

How can this be done?

1
  • I hesitate to post this as an actual answer (I might convert my comment if it helps) ... But if eMail is working in your site, ask for a password reset link. Find a way to get access to that eMail (which should arrive at the owner's eMail ID I'd guess ...) and use that link to then reset the password. Commented Apr 28, 2017 at 16:10

3 Answers 3

0

Short answer: it can't be done.

The password is a salted hash, and unless you have access to specialist cracking equipment, you're not likely to reverse engineer that hash in yours, or even your great, great, great, great grandkids' lifetimes. Even with access to the original salt.

As Pierre mentioned in the comments, submitting a password reset link on the live site is probably the simplest course of action.

Or contact your hosting provider; most will find you a way back into a server you're locked out for a nominal fee, once they've verified your ownership.

Bottom line, you're not likely to recover the password from the hash in the database, so you'll need come up with a creative workaround.

0

Similar to what Clive wrote in the previous answer: it's a waste of time to try to extract that password (at least as of D7, in D6 you could still do that).

Similar to what I suggested in my comment from before:

If eMail is working in your site, ask for a password reset link. Try to find a way to get access to that eMail (which should arrive at the owner's eMail ID I'd guess ...) and use that link to then reset the password.

If you can't find such way to access that eMail, try these alternatives (if your available infrastructure allows you to do so):

  • find a way to perform an edit (using something like PhpMyAdmin) of the database table that contains the eMail Id related to the user with uid=1, and adapt that eMail Id to your own eMail Id. Then continue as I suggested in my comment already.
  • find a way to perform an edit (using something like PhpMyAdmin) of the database table that contains the roles granted to any of the users that are able to login to the site, and adapt these data to grant such user an admin role. Then login with that userid, and do what's needed (reset password or edit the eMail Id) for the original userid you're trying to get to work again.
0

Do you have access to the database like PHPMyAdmin or similar? If yes, then you can reset the password by updating the pass field.

In your local you can run ./scripts/password-hash.sh abcdef where abcdef is your password then it will generate a hashed password.

But as other mentioned password reset would be the simplest solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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