Note that there are some explanatory texts on larger screens.

plurals
  1. POauthenticating mongodb from a remote machine with ssh tunnelling
    primarykey
    data
    text
    <p>I have mongo db running in a remote server (debian) with authentication on. I need to connect to it with UMongo (UI tool for mongodb) from my local machine (windows) to visualize the data. I have not opened mongodb port in server machine, but have made a ssh tunnel from my <code>localhost:9999</code> to the <code>mongodb-host:port</code>. As connection uri in UMongo, i have given </p> <pre><code>[username]:[password]@localhost:9002 (also tried with [username]:[password]@localhost:9002/dbname) </code></pre> <p>and tried to connect. It shows the database but doesn't authenticate, it throws authentication error. I have made sure that the credentials given are correct. Wondering whether the credentials are not being passed to the mongodb server properly with ssh tunnelling.</p> <p><strong>Update</strong>: I restarted mongo server with authentication disabled. After that i tried to access the remote mongo shell. When i tried with <code>mongo --port 9002</code>, it gave the below error:</p> <pre><code>MongoDB shell version: 2.4.4 connecting to: 127.0.0.1:9002/test Thu Sep 05 22:55:21.107 Socket recv() errno:10054 An existing connection was forcibly closed by the remote host. 127.0.0.1:9002 Thu Sep 05 22:55:21.107 SocketException: remote: 127.0.0.1:9002 error: 9001 socket exception [1] server [127.0.0.1:9002] Thu Sep 05 22:55:21.107 DBClientCursor::init call() failed Thu Sep 05 22:55:21.107 JavaScript execution failed: Error: DBClientBase::findN: transport error: 127.0.0.1:9002 ns: admin.$cmd query: { whatsmyuri: 1 } at src/mongo/shell/mongo.js:L114 exception: connect failed </code></pre> <p>But when i tried with <code>mongo --port 9002 --nodb</code>, i was able to get the mongo shell. Then i tried to <code>use mydb</code> which throws the below error:</p> <pre><code>Thu Sep 05 22:57:43.205 JavaScript execution failed: ReferenceError: db is not defined at src/mongo/shell/utils.js:L691 </code></pre> <p>Any help would be much appreciated.</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload