[rabbitmq-discuss] Suggested small changes to /etc/init.d/rabbitmq-server

Matthias Radestock matthias at lshift.net
Mon Jul 20 21:00:55 BST 2009


Terry Jones wrote:
> It would be nice if /etc/init.d/rabbitmq-server allowed one to customize
> where it writes the output that currently goes to /var/log/rabbitmq.
> Attached is a trivial diff to allow the directory for those files to be set
> in /etc/default/rabbitmq

Sounds like a good idea and the patch looks fine. I have filed a bug to 
get (something like) this incorporated.

> Is there any decent reason why the scripts in /usr/sbin/rabbit-* refuse to
> run rabbitmq unless you're root?  Seeing as a normal user can directly run
> /usr/lib/rabbitmq/bin/rabbit-*, I don't really see the point of denying a
> normal user in /usr/sbin/rabbit-*.

The scripts in /usr/sbin are there to start/control system-wide 
instances of RabbitMQ. That's why they are in sbin and need to be run as 
root. They are actually very thin wrappers around the scripts in 
/usr/lib/rabbitmq/bin, and it's the latter that should be invoked (in 
combination with suitable env var / config settings) if you want to run 
rabbit as an ordinary user.

> The /usr/sbin scripts could check to see if you're root and use su
> rabbitmq if so, and just run as the user if not. The worst that can
> happen is that rabbit fails to start, isn't it?

Rabbit failing to start is what *will* happen if we allowed ordinary 
users to run the scripts in /usr/sbin, unless they changed various 
paths/permissions to the mnesia dirs, log files etc. Many RabbitMQ users 
ran into this (and were perplexed by the resulting error messages) 
before we added the root check.

> Last time, I went behind the back of the normal rabbit startup
> scripts (using rabbitmqctl_real) to get things done as a normal user.
> It would be nice to just be able to run /etc/init.d/rabbit-server and
> not to have to hack it again this time

As above, the scripts in /etc/init.d/ are meant to be run as root and 
are for system-wide processes. Running them as ordinary users is 
generally not supported.



More information about the rabbitmq-discuss mailing list