If user account is locked after entering wrong password 5 times. That's a default setting.

That can be changed via

drush cset user.flood user_limit 10

I have different roles. I need to set flood user_limit role wise

Role A, It will be 10
Role B, It will be 7

Can we achieve same thing via CLI?

  • 1
    There are two modules https://www.drupal.org/project/flood_settings and https://www.drupal.org/project/floodcontrol_settings_api you can modify them or extend them. Commented Jun 18, 2020 at 10:26

1 Answer 1


No you can't.

The user.flood user_limit config setting feeds into the DatabaseBackend::isAllowed() method as the $threshold arg, which is used to compare the row count for this query:

  $number = $this->connection
      ->select(static::TABLE_NAME, 'f')
      ->condition('event', $name)
      ->condition('identifier', $identifier)
      ->condition('timestamp', REQUEST_TIME - $window, '>')

It only compares the threshold login count against a unique user ID, $identifier.

You'd have to do some sort of modification to the flood core service to make some sort of per-role flood limit.

  • Since the question is asking how to achieve it from the command line interface, this is the only possible answer. Replacing a Drupal service would be one of the alternatives, but writing an answer about that would make the answer too long, considering the question isn't even showing any knowledge of what that means.
    – apaderno
    Commented Jun 18, 2020 at 16:01

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.