Mongodb default password

When one installs mongoDB on Linux (at least for what I have tried) a user called mongodb is created.

Is there a default password for this user?

… after checking closer I saw (in /etc/passwd) that the account has no shell.

So the question is more “How to use the mongodb user?”

Since it is not good to run mongodb as root I suppose running it as mongodb would be the way to go.

This is standard security practice. You have a user specific to a service but you cannot login as this user. You interact with the service using systemctl or other means. The systemctl utilities (as a root process) is able to interact with mongodb as the mongodb user. So mongodb will be run as mongodb user with only access to mongodb stuff, preventing access to other software or data if it is breached. Basically, you work as your normal user, in my case, steevej. You then use sudo to increase your privileges in order to stop/start the server. See the for more information.

This being written, nothing stops you playing around as your own login user by having mongodb, the process, works on directories where your login user has write access.

Typically, I reserved the mongod controlled by systemctl for production while I test in my own directories.

1 Like

OK, I see. Then your answer seems in agreement with what I normally do and with what I found here:

Thanks for sharing the link. If I had it I would have share it myself. I have more read to do.