title: RabbitMQ Declare Exchange from Terminal - Access refused: /api/exchanges/
body: <p>I'm using rabbitmq to handle messages between my databases for an enterprise application I work on. As part of the process, I'm trying to help automate the setup of the servers (e.g. script it). In this process, I've tried to use <code>rabbitmqadmin</code> to declare exchanges from the command prompt. I have 2 different servers running <code>CentOS 5.x</code> and <code>CentOS 6.x</code> and both are having the same issue.</p>
  
  <p>So far I declared an administrator user and set its password, then I set its tag to be of the administrator tag, then I ensure it has permissions to the vhosts. After that I try to declare the exchange, with user and password specified and it fails.</p>
  
  <pre><code>rabbitmqctl add_user administrator password
  rabbitmqctl set_user_tags administrator administrator
  rabbitmqctl set_permissions -p / administrator ".*" ".*" ".*"
  rabbitmqctl add_vhost vhostFoo
  rabbitmqctl set_permissions -p vhostFoo administrator ".*" ".*" ".*"
  rabbitmqadmin -u administrator -p password declare exchange --vhost=vhostFoo name=exchangeNew type=direct
  </code></pre>
  
  <p>For the CentOS 5.x box I have to use <code>python26 rabbitmqadmin</code> instead of just <code>rabbitmqadmin</code>, but get the same result.</p>
  
  <p>The last command results in:</p>
  
  <pre><code>*** Access refused: /api/exchanges/vhostFoo/exchangeNew
  </code></pre>
  
  <p>Both my CentOS 5.x and Cent 6.x boxes are running rabbitmq 3.3.5. Any thoughts on what I'm missing or thoughts on how I can get more info on what's wrong (e.g. error log file or way to get more verbose output)?</p>