Unsupported content

 

This version of the documentation is no longer supported. However, the documentation is available for your convenience. You will not be able to leave comments. Click here to view the documentation for the current version.

Restricting MongoDB access by enabling authentication

Follow this procedure for a stand-alone environment only (not when running MongoDB as a replica set).

Video demonstration

The following video (4:10) demonstrates how to restrict MongoDB access by enabling authentication and store the encrypted MongoDB password in the configuration file:

https://youtu.be/8IuBBInFMkA

To restrict MongoDB access by enabling authentication

  1. Log on to the MongoDB shell and enter the following commands:

    use admin
    db.createUser( {
    	user: "siteUserAdmin", 
    	pwd: "<siteUserAdminPassword>", 
    	roles: [ { role: "userAdminAnyDatabase", db: "admin" } ] 
    });
    use social
    db.createUser( { 
    	user: "social_admin", 
    	pwd: "<social_adminPassword>", 
    	roles: [ { role: "dbOwner", db: "social" } ] 
    });
  2. Enable authentication by using either of the following methods: 
    • Start the mongodprocess by using the --auth option.
    • In the mongoconfiguration, set auth = true and restart the mongo service.
  3. To connect the BMC MyIT or Smart IT social service to mongo, change config.js in Smart_IT_MyIT/social to use the following value:

    Original valueNew value
    mongodb://localhost:27017/mongodb://social_admin:<social_adminPassword>@ipAddress:portNumber/
  4. Restart the social service. 
Was this page helpful? Yes No Submitting... Thank you

Comments