title: Create mongo user with right to read local database
body: <p>I would like to create a mongo user who can read local database. I try to use command on local database:</p>
  
  <pre><code>db.createUser(
    {     user: "readonlyuser", pwd: "loh8Ephi",
      roles: [ { role: "read", db: "local" } ]
  })
  </code></pre>
  
  <p>But - it doesn't work. I receive:</p>
  
  <pre><code>connecting to: local
  2015-12-21T14:08:07.904+0100 Error: couldn't add user: Cannot create users in the local database at src/mongo/shell/db.js:1054
  </code></pre>
  
  <p>I've tried to create that user against admin database:</p>
  
  <pre><code>&gt; use admin
  switched to db admin
  &gt; db.createUser(
  ...   {     user: "readonlyuser", pwd: "loh8Ephi", roles: [ { role: "read", db: "local" } ] })
  
  Successfully added user: {
  "user" : "readonlyuser",
  "roles" : [
      {
          "role" : "read",
          "db" : "local"
      }
  ]
  </code></pre>
  
  <p>And now i try to connect:</p>
  
  <pre><code>undefine@machine:~$ mongo -u readonlyuser -p loh8Ephi local
  MongoDB shell version: 2.6.11
  connecting to: local
  2015-12-21T15:35:19.190+0100 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1292
  exception: login failed
  </code></pre>
  
  <p>How to create readonly user who have access only to local database?</p>