Get List of Users in RabbitMQ

Get List of Users in RabbitMQ

Whether you're an administrator looking to audit user accounts or a developer integrating with RabbitMQ, knowing how to retrieve the list of users is essential. This tutorial demonstrates how to get list of users in RabbitMQ.

1. CLI

You can list all users in RabbitMQ using the following command:

sudo rabbitmqctl -s list_users

Example output:

test  [administrator]
guest [administrator]

This command retrieves all users along with their associated tags, such as administrator.

2. HTTP API

Alternatively, you can fetch users via the RabbitMQ HTTP API. Run the following curl command:

curl -u guest:guest http://localhost:15672/api/users

Example JSON response:

[
  {
    "hashing_algorithm": "rabbit_password_hashing_sha256",
    "limits": {},
    "name": "guest",
    "password_hash": "ka1PJty9Dgb7/5ZStHn7Bmk0zRl3w6F524h8tnNxUiWGmO1S",
    "tags": [
      "administrator"
    ]
  },
  {
    "hashing_algorithm": "rabbit_password_hashing_sha256",
    "limits": {},
    "name": "test",
    "password_hash": "fjEV6QiLQMSI1o6NqaYYm5i32+VeUIZIfxRKuv6lxvO3mYVF",
    "tags": [
      "administrator"
    ]
  }
]

This response provides details about each user, including their name, password hash, and assigned tags.

Leave a Comment

Cancel reply

Your email address will not be published.