Reputation: 1787
I've setup a very basic queue, 'test_queue', on a fresh installation of RabbitMQ, and created a basic non-admin user, 'user' (which I have given the same virtual host access as admin account).
When I send in a test message on the command line via:
rabbitmqadmin publish exchange=amq.default routing_key=test_queue payload="hello, world" -u admin -p {admin password}
It works just fine. But when I try and use the basic user:
rabbitmqadmin publish exchange=amq.default routing_key=test_queue payload="hello, world" -u user -p {user password}
I get the following error:
*** Access refused: /api/exchanges/%2F/amq.default/publish
I've searched for how to add permission for a specific user to publish to a message queue but can't find the solution through the noise.
Upvotes: 4
Views: 8155
Reputation: 9637
I searched Google with site:rabbitmq.com permission
and this document is the first hit: https://www.rabbitmq.com/access-control.html
At the end of the "How Permissions Work" section, you are directed to the rabbitmqctl
man page
Within that page, you will find the documentation for the set_permissions
command. That is what you need to use.
If you would like to open a pull request to improve the documentation to make finding this solution easier, we would welcome it here! Thanks.
Upvotes: -2
Reputation: 513
I had a similar problem and resolved it by adding the permission through RabbitMQ Admin UI (Admin->Users->Some User->Set Permission):
You can enable the Admin UI as a plugin through CLI:
rabbitmq-plugins enable rabbitmq_management
To access it you will also need to create some login credentials. More details: https://www.rabbitmq.com/management.html#getting-started
Upvotes: 7