title: How to use Compass to access remote Mongo instance via SSH tunnel?
body: <p>I have a Digital Ocean droplet running a NodeJS app with a Mongo DB v 3.2.21. I have been using the Compass app to access the DB via its SSH tunnel option, however it stopped working and is giving me this error when I try to connect: </p>
  
  <p>connect ECONNREFUSED 127.0.0.1:27017. </p>
  
  <p>The Compass configuration is using: </p>
  
  <p>Hostname: localhost</p>
  
  <p>Port: 27017</p>
  
  <p>Authentication: None</p>
  
  <p>SSH Tunnel: Use Identity File</p>
  
  <p>SSH Hostname: </p>
  
  <p>SSH Tunnel Port: 22</p>
  
  <p>SSH Username: root</p>
  
  <p>SSH Identity File: ID_RSA</p>
  
  <p>The result of netstat -ntlp | grep LISTEN on the remote machine is:</p>
  
  <p>tcp        0      0 127.0.0.53:53           0.0.0.0:*     LISTEN      621/systemd-resolve</p>
  
  <p>tcp        0      0 0.0.0.0:22              0.0.0.0:*     LISTEN      3209/sshd  </p>
  
  <p>tcp        0      0 127.0.0.1:27017         0.0.0.0:*     LISTEN      8395/mongod </p>
  
  <p>tcp6       0      0 :::80                   :::*          LISTEN      9009/node /app/app.</p>
  
  <p>tcp6       0      0 :::22                   :::*          LISTEN      3209/sshd  </p>
  
  <p>tcp6       0      0 :::443                  :::*          LISTEN      9009/node /app/app. </p>
  
  <p>Some possible clues:</p>
  
  <p>The Compass app is running on a Mac that I just updated to 10.15.4 - I am not 100% sure that the problem coincided with this update but it seems suspicious. </p>
  
  <p>I can SSH into the remote machine using the same credentials via Terminal on my Mac. When I SSH in, I can run the Mongo shell fine, read the db, etc.</p>
  
  <p>My nodeJS app can access the DB fine. </p>
  
  <p>If I stop the app, same message.
  If I stop the app and also stop the mongod service, the error message is: Error creating SSH Tunnel: (SSH) Channel open failure: Connection refused</p>
  
  <p>So I think the SSH tunnel is working, but Mongo is refusing the connection (?)</p>
  
  <p>Any help, or pointers would be greatly appreciated. Thanks.</p>