MongoDB/Ubuntu connect ECONNREFUSED

I have setup a Linode using the market place for MongoDB on a Ubunto. I have used # ufw and created a rule.

ufw allow 27017/tcp

ufw now shows the ports allow from Anywhere.

Without this open, the computer took awhile for the connection from MongoDB Compass to fail. But once added, the system comes back in 3 seconds with:


I got the IP address from the portal by click on my new Linode and looking at the machine. I can launch LISH and connect to the console, even run # mongo and look at the databases, etc.

So it appears that my machine is allowing the traffic. The security: section in the mongod.conf file whos security authentication turned off right now, even though I did add a admin user to the admin database.

Any additional steps I need to take or guidance on setting up my database for remote access accross the Internet using the TCP with the IP and Port 27017.

1 Reply

I figured it out. Not only did I have to open the port on the ufw. I also had to edit /etc/mongod.conf and append the ip address of my server to the binded server.

network interfaces

port: 27017

Make sure you turn on authentication.


Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct