MongoDB Security - Are User Roles Required?


I have a droplet with my MongoDB.

On reading some security tutorials I see mention of enabling auth auth = true however I’m unsure whether I need this?

I SSH into my droplet with a sudo account. The operations I need to perform on the DB can be either read or update/insert. So is there any need to use a create another user with high enough credentials to do this? Just feels like I’m duplicating another user.

Also to add my MongoDB droplet only talks to my node droplet which in turn is open to the world (web app).

Any advice appreciated.


Submit an answer
Answer a question...

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.


Ideally, you want to isolate access and only provide just enough access to a specific user to do the job or task it needs to do.

In a way, it’s similar to MySQL/MariaDB/Percona – you wouldn’t run commands as the root user, you would create an individual user and grant user access to a specific database, thus limiting what that one user is capable of accessing. If that one user tried to access another database, it wouldn’t be able to do so unless it was granted direct access later on by either the root user or a user with the ability to grant such permissions.

When it comes to databases, given they are often the central point of storage for many applications, I would up the security when and where possible. It may very well add a little to the workload initially, but when something does happen, it makes damage control far easier and less time-consuming.

That being said, as an added layer, I’d make sure you’re backing up your database & data often so that, in the event something does happen, you can quickly restore.