Like in a certain way in MySQL.
CREATE 'dbuser'@'10.1.0.1' identitifed by 'password';
GRANT USAGE on *.* to 'dbuser'@'10.1.0.1';
We are not using any mongodb tools except for Robo
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It only takes a minute to sign up.
Sign up to join this communityLike in a certain way in MySQL.
CREATE 'dbuser'@'10.1.0.1' identitifed by 'password';
GRANT USAGE on *.* to 'dbuser'@'10.1.0.1';
We are not using any mongodb tools except for Robo
When you create a user then you can specify Authentication Restrictions
Would be like this:
use admin
db.createUser(
{
user: "dbuser",
pwd: "password"
roles: [ { role: "readWrite", db: "reporting" } ],
authenticationRestrictions: [ {
clientSource: ["192.0.2.0"],
serverAddress: ["198.51.100.0"]
} ]
}
)
But for me it is not clear, if you are looking for this.
clientSource
restrictions can be an array of IP addresses and/or CIDR ranges, so you can set up appropriate restrctions per MongoDB user. To prevent 192.0.2.0 from authenticating with any credentials other than dbuser
, you would make sure this IP isn't included in the clientSource
addresses or ranges for other users. Where possible I would also limit guest access to interacting via an API rather than providing direct access to your MongoDB deployment.
– Stennie
Feb 1 at 0:53
In mongodb config file, you should specify bind_address value to your desired ip.