Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Start the shell and add an administrative user for the server.
- $ ./mongo
- use admin
- db.addUser("mongoadmin", "anadminpassword")
- Note: On my system, typing ./mongo doesn’t work, but plain mongo does.
- Authenticate, still in the shell.
- 1
- db.auth("mongoadmin", "anadminpassword")
- Configure a specific user for another database.
- 1
- 2
- use projectx
- db.addUser("joe", "passwordForJoe")
- Exit the MongoDB shell.
- 1
- exit
- Edit the mongodb.conf file to enable authentication.
- 1
- sudo nano /etc/mongodb.conf
- Uncomment this line.
- 1
- auth=true
- Restart MongoDB
- 1
- sudo /etc/init.d/mongodb restart
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement