title: Mongo "auth failed" Only for Remote Connections. Local Works fine
body: <p>I have a Bitnami MEAN instance running on EC2. After much finagling, I've been able to successfully connect to the DB using the local shell. I created authenticated users with all of the permissions necessary to access the data, and when I run the below code -- I am able to access the DB with no problem.</p>
  
  <pre><code>sudo mongo admin -u &lt;USERNAME-p &lt;PASSWORD&gt;
  </code></pre>
  
  <p>That said, when I try to repeat this using a remote connection I am repeatedly given an "auth failed" error from MongoDB.</p>
  
  <pre><code>mongo &lt;HOST&gt;:&lt;PORT&gt;/&lt;DATABASE&gt; -u &lt;USERNAME&gt; -p &lt;PASSWORD&gt;
  </code></pre>
  
  <p>...</p>
  
  <p>This is strange because I am using the exact same credentials as I do in running the local shell. The only difference is I'm including the host and port information. I've since also confirmed that my remote connection DOES work if I disable the auth parameter in mongodb.config. </p>
  
  <pre><code>mongo &lt;HOST&gt;:&lt;PORT&gt;/&lt;DATABASE&gt;
  </code></pre>
  
  <p>Obviously, in production I want to be able to authenticate. Do any of you have suggestions as to why there is a discrepancy between remote and local authentication?</p>