I’ve been developing an AMQP application recently using RabbitMQ. Its control application
rabbitmqctl, is allowed to be run by
rabbitmq users only, which causes a bit of pain every time I want to list queues, exchanges etc. from my regular development shell.
Hence this little hack to allow certain users to run
rabbitmqctl. The recipe is for Ubuntu Linux, but should work for any Unix with a pinch of salt.
There’s a group called
rabbitmq. We’ll set it up the way all members of this group will be allowed to run
rabbitmqctl without pain.
# Allow members of `rabbitmq` run `rabbitmqctl` without a password. %rabbitmq ALL=(ALL) NOPASSWD: /usr/sbin/rabbitmqctl
Fix permissions of this file, or
sudowill carp every time we run it:
# chmod 440 /etc/sudoers.d/rabbitmqctl
if [ `id -u` != 0 ]; then alias rabbitmqctl="sudo /usr/sbin/rabbitmqctl" fi
Add intended members to group
Re-login as one of group members and give it a try:
$ rabbitmqctl list_vhosts
Should work. If it doesn’t, use the “Comments” box below. :)