1

So, I have to work on a D8 site I don't have a user account for. So, when I brought the code and database over to my local environment, I thought this would be an easy fix for drush.

My local dev environment is an Ubuntu server running on WSL, with php 7.2, and Drush version 8 I used the Drush ucrt and urol in the terminal, and both returned successes. I also had to temporarily deactivate the basic_auth service as the login pages weren't accessible after the move. Finally, when I tested the new user and password, it didn't work. I cleared the caches, re-set the password again, and then finally had the account blocked from too many failed attempts.

What's going on here? why didn't this work? and what do I do to make it work? I'd rather not add the user in Mysql, as I haven't seen a good tutorial for this.

2

what i personally usually do with local databases is overriding the admin password:

drush uinf 1

will help you to get the user 1 name (just to be sure it is 'admin') in that case :

drush upwd admin --password=MY_LOCAL_PASSWORD

then go to /user and try it :)

  • this worked like a charm. – nizz0k Dec 3 '18 at 5:48
0

You should also be able to log in as user 1 by using:

drush uli

https://drushcommands.com/drush-8x/user/user-login/

This will generate a one-time login link:

http://default/user/reset/1/{numbers}/{jibba-jabba}/login

To use this, copy everything after http://default and paste it after the domain in your local dev environment.

UPDATE: https://drupal.stackexchange.com/a/54108/80164 shows a better way to include your dev domain instead of http://default.

Once you're logged in as User 1, you should be able to reset the password for that account, or create a new user account for yourself.

Drush documentation: https://drushcommands.com

  • I have tried this route, and I'm having issues in that it's a pain in the neck to get the right URI recognized by this command (haven't set a vhost and the url gets truncated by the command). – nizz0k Dec 3 '18 at 5:44
  • 1
    If the URI is getting truncated, try redirecting the output to a file: drush uli > login.txt. Depending on your environment, you might also be able to send the output to the clipboard. Good luck! – hotwebmatter Dec 3 '18 at 5:48
  • that's a great tip! I wish there were better docs on Drush as I'm just scratching the surface – nizz0k Dec 3 '18 at 5:59
  • Added link to Drush documentation. – hotwebmatter Dec 3 '18 at 8:31
  • this worked like a charm, btw, tried that too! – nizz0k Dec 4 '18 at 9:37

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.