Authenticate MongoDB along with Robomongo - mongodb

I'm currently using Robomongo when accessing my mongodb database. I
have created a admin account on mongodb who has admin access to any
db. I would like to be able to ONLY login with the credentials of the
admin account. Now I can just login as "guest" without giving in any
credentials, I've already looked at the authentication mongodb files
but these seem only to authenticate using the cmd tool on the mongodb
itself. How can I make that my admin account can only login using the
Robomongo?
Regards.

In your mongodb conf file add this line "authorization: enabled"

Related

Authentication with password in MongoDB 5.0

Authentication with password in MongoDB 5.0
I would like to put a password to enter and protect my databases from the rest of the
users in MongoDB. I need to do it on MongoDB 5.0 version
Could someone help me, thanks in advance.
Here my image
You have it in the official docs well explained...
General steps are as follow:
1.Start MongoDB without authentication. ...
2.Connect to the server using the mongo shell. ...
3.Create the user administrator. ...
4.Enable authentication in mongod configuration file. ...
5.Connect and authenticate as the user administrator. ...
6.Finally, create additional users as needed.

Mongodb not authenticating on localhost or connecting authenticated mongodb compas

System
Hi I am running mongodb on ubuntu 20.14.
Im running mongodb with systemctl
What I've done
I've tried to make it more secure by adding an admin user and enabled authentication.
Ive restarted the service multiple times.
config file:
security:
authorization: enabled
How I created user:
use admin
db.createUser({
user: "username",
pwd: "123456",
roles:["root"]
})
Problem
I am still able to connect through mongodb compass without any auth??? Im able to do everything even tho I enabled the authentication?
I am not able to login authenticated using these urls:
mongodb://username:password#localhost:27017/
mongodb://username:password#localhost:27017?authSource=admin
Im sure the config file is loading since authentication works in console and I can see the right config load in the mongod.log
It would be this one:
mongodb://username:password#localhost:27017?authSource=admin
See also: Authentication failure while trying to save to mongodb
Yes, even without authentication you can connect to Mongo database in any case. However, apart from harmless commands like db.help(), db.version(), db.getMongo(), etc. you cannot execute anything.
You can skip parameter enableLocalhostAuthBypass. The localhost exception applies only when there are no users created in the MongoDB instance.
Solution
I thought the issue was with mongodb compass.
So what I did was deleting the application and when I did that I saw that I had mongodb installed on my pc too.
I was never connecting to the mongodb that I have created on my ubuntu server but on my own pc.

Mongodbd login with Mongoose to new database

I use mongoDB in Atlas cloud but now I want to movie to a local database. I installed MongoDB and created a admin user. Now I connect with mongoose to :
mongodb://login:pass#db.myserver.com:27017/admin
Works well. Now I create a new development database "develop".
I try to connect
mongodb://login:pass#db.myserver.com:27017/develop
This failed to login. OK, I understand that the admin database is the "/admin" one and that user is authenticated to this database but I thought that an admin can access all databases in a mongodb server?
In Atlas I just created the develop database and connected to it without any problem.
How I can well connect with mongoose to the new develop database? Do I need to create a second admin for this database?
Ok, I found out that I have to name the auth database in my connection string.
mongodb://login:pass#db.myserver.com:27017/develop?authSource=admin

Forgot mongodb admin database credentials. Reset everything

I forgot the credentials of my admin user.
Hence i am not able to connect to cluster mongo shell.
Now i want to delete all users and and credentials or even if reset of mongodb is possible then it will be a lot help.
I tried following commands but got "authentication required error".
db.createUser(), db.dropDatabase().
I expect to create new admin user with credentials.
you can do it by logging in to your Atlas Cluster here: https://www.mongodb.com. Then, on the left sidebar, you click on 'Database Access'. There you can manage the users and you can even delete them and create new ones.

How do I restrict access to mongodb to one OS user?

How do I restrict access to mongodb to one OS user?
ie. I have a user "system" on a linux machine. I want only user "system" to access mongodb. If "tom" on linux tries to use mongo shell and connect to the localhost mongodb, it needs to fail
First enable authentication for your database.
Next, create a database admin who can create users and assign roles/privileges.
Next, create the user "system" and assign him the necessary roles for your database.
Finally, close the localhost authentication (admin) bypass once the above steps are complete:
mongod --setParameter enableLocalhostAuthBypass=0
All of these steps are described in great detail in Mongo's access control tutorials.