101

Using rabbitmq, we can install management plugin. Then we access via browser using http://localhost:55672/ using guest:guest. The problem is, I can not login anymore because i changed password and entered blank for role.

Is there any way to reset user for rabbitmq management?

CloudyMarble
  • 36,908
  • 70
  • 97
  • 130
Superbiji
  • 1,723
  • 2
  • 14
  • 21

5 Answers5

203

You can access the user-management with rabbitmqctl and use the command:

add_user {username} {password}

or more preferably maybe edit an existing user, or set the permissions for the new user with:

set_permissions [-p vhostpath] {user} {conf} {write} {read}

For example use the following commands: (it is important to perform these three steps even when creating a new user, if you want to be able to login to the UI console and for your programs to work without facing any permission issues)

rabbitmqctl add_user newadmin s0m3p4ssw0rd
rabbitmqctl set_user_tags newadmin administrator
rabbitmqctl set_permissions -p / newadmin ".*" ".*" ".*"

...to create a new administrator user with full access to the default / vhost.

You can find all this on the RabbitMQ homepage, and more specifically on this page

Nav
  • 19,885
  • 27
  • 92
  • 135
Daniel Figueroa
  • 10,348
  • 5
  • 44
  • 66
57

The simplest way I found is to use this command to reset the password for any user in RabbitMQ

rabbitmqctl change_password <USERNAME> <NEWPASSWORD>
samtoddler
  • 8,463
  • 2
  • 26
  • 21
26

This is specifically for aliveness test, but could apply to other apis as well

rabbitmqctl add_vhost statuscheckvhost
rabbitmqctl add_user heartbeat alive
rabbitmqctl set_permissions -p statuscheckvhost heartbeat ".*" ".*" ".*"
rabbitmqctl set_user_tags heartbeat management

curl -i -u heartbeat:alive http://127.0.0.1:55672/api/aliveness-test/statuscheckvhost
HTTP/1.1 200 OK
Server: MochiWeb/1.1 WebMachine/1.9.0 (someone had painted it blue)
Date: Thu, 21 Feb 2013 22:20:10 GMT
Content-Type: application/json
Content-Length: 15
Cache-Control: no-cache
{"status":"ok"}
Meghal Gosalia
  • 261
  • 2
  • 3
8

If you have RabbitMQ on a docker container, you can first

docker exec -it <YOUR_CONTAINER> /bin/bash

Then you can do

rabbitmqctl change_password <USERNAME> <NEWPASSWORD>

such as @samtoddler pointed out

1

I was able to reset after this post. Thanks a lot.

rabbitmqctl add_user test password rabbitmqctl set_user_tags test administrator

Then I went to browser console and login with this test account. And from there I was able to reset pwd of admin account & guest account.

Tejas
  • 11
  • 1