Managing users with Drush cheatsheet

Changing passwords for an existing user

drush upwd <username> —password=<new password>

Examples

Change password for test1 to letmein:

drush upwd test1 —password=letmein

Assign a role

drush urol <rolename> <username>

Examples

Add the role editor to username test1:

drush urol editor test1 

Add the role editor to user with uid of 3:

drush urol editor 3 

Add the editor role to users with ids 3 and 4:

drush urol editor --uid=3,4

Remove a role

drush unrol <rolename> <username>

Examples

Remove the role editor to username test1:

drush unrol editor test1 

Add editor role to user with uid of 3:

drush unrol editor 3 

Remove the editor role to users with ids 3 and 4

drush unrol editor --uid=3,4

Create users

drush ucrt <username>

Examples

Create a user with username test1:

drush ucrt test1 

Add an email address and password for the user at the same time:

drush ucrt test1 --mail=test@example.com -- password=password1

Setting passwords for a user account

drush upwd <username> --password=<password>

Examples

Add letmein as a password to username test1:

$ drush upwd test1 --password=letmein 

Display information about a user

drush uinf <username> 

Examples

Display information for user with username test1:

drush uinf test1 

Display information for user with uid of 3:

drush uinf 3 

Display information about users with uids 3 and 4:

drush uinf 3,4 

Display information for users with username test1 and test2:

drush uinf test1,test2 

Display information about user with uid 2 and also user with name of test3:

drush uinf 2,test3

Block a user

drush ublk <username>

Examples

Block the user with username test1:

drush ublk test1 

Block users with uids 3 and 4 and username test1:

drush ublk 3,4,test1 

Unblock a user

drush uublk <username>

Examples

Unblock the user with username test1:

drush uublk test1 

Unblock users with uids 3 and 4 and username test1:

drush unblk 3,4,test1