I'm trying to use drush's user-block feature and I'm getting following error:

# drush -r . -l fqdn ublk 'user.email@host.tld.dev'
You do not have permission to block user.email@host.tld.dev.           [error]

I'm doing it from shell and I am root, so I'm not sure which permissions is it talking about.

  • Did you cd to the document root?
    – heshanlk
    Jul 3 '13 at 19:18
  • @heshanlk Yes I did, if I wouldn't be in root of Drupal, I'd get another message: "The directory /tmp/ does not contain a valid Drupal installation"
    – alexus
    Jul 3 '13 at 19:29
  • did you just try with uid? I think if you are using email you need to set an option. You can try drush -d ublk --email=user.email@host.tld.dev
    – heshanlk
    Jul 3 '13 at 20:22
  • @heshanlk yes, I've tried it like that as well, although it's --mail not --email and then I get another error messaging saying Missing required argument: 'users'. See drush help user-block` for [error]`
    – alexus
    Jul 3 '13 at 21:17
  • What do you get when you try with -d?
    – heshanlk
    Jul 4 '13 at 1:00

Sometimes modules does not respect that user with UID 1 should be allowed to do everything. And sometimes you simply want hooks to fire with specific user's ID.

When it happens, you can use drush --user=123 where 123 is UID of an user that is allowed to perform given action.

Source: Drush issue 1126240.

  • I'm getting error doing that as well, Missing required argument: 'users'. See drush help user-block` for [error]`
    – alexus
    Jul 8 '13 at 14:26
  • @alexus that's an unrelated error. It means you are trying to block users but don't tell Drupal which users to block.
    – Mołot
    Jul 8 '13 at 14:29
  • I understand that, but I'm following your "answer" to my "question", if I use your command this is the error that I get.
    – alexus
    Jul 8 '13 at 14:56
  • 1
    @alexus --user=constant_uid_of_admin should very well be enough. You shouldn't need to use blocked user's UID to do that... if you do, you should fill support request on drush issue queue, something strange is happening.
    – Mołot
    Jul 8 '13 at 15:14
  • 1
    fyi, if i specify drush ublk XXX@XXX.TPL --user=ANYTHING, it will go through and user will be disabled and what I specify in --user is really irrelevant to actual user that I was trying to disable..
    – alexus
    Jul 8 '13 at 18:58

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.