Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
mongo_usrs_roles [2019/09/10 18:56] – andonovj | mongo_usrs_roles [2019/10/18 20:04] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
======Overview====== | ======Overview====== | ||
Users and roles in Mongo are per databases. Meaning if you want to create a user in a certain database, you have to use that database as follows: | Users and roles in Mongo are per databases. Meaning if you want to create a user in a certain database, you have to use that database as follows: | ||
+ | |||
+ | |||
+ | =====Enable Authentication===== | ||
+ | Authentication is disabled by default, but you can enable it in the configuration file. Again depending on the version: | ||
+ | |||
+ | * Less then 3.X: Add the " | ||
+ | * Higher than 3.X: Add the following paramer: | ||
+ | |||
+ | <sxh bash> | ||
+ | security: | ||
+ | authorization: | ||
+ | </ | ||
=====User Management===== | =====User Management===== | ||
Line 93: | Line 105: | ||
Or if you know the username you can also user: | Or if you know the username you can also user: | ||
- | |||
<sxh bash> | <sxh bash> | ||
Line 125: | Line 136: | ||
Other way to see all the users authenticated to a certain database is to use the following command: Show users as follows: | Other way to see all the users authenticated to a certain database is to use the following command: Show users as follows: | ||
- | |||
<sxh bash> | <sxh bash> | ||
Line 170: | Line 180: | ||
> db.updateUser(" | > db.updateUser(" | ||
> | > | ||
- | </ | ||
- | |||
- | ====Authentication==== | ||
- | Authentication is disabled by default, but you can enable it in the configuration file. Again depending on the version: | ||
- | |||
- | * Less then 3.X: Add the " | ||
- | * Higher than 3.X: Add the following paramer: | ||
- | |||
- | <sxh bash> | ||
- | security: | ||
- | authorization: | ||
</ | </ | ||
Line 188: | Line 187: | ||
===Login with username and password=== | ===Login with username and password=== | ||
<sxh bash> | <sxh bash> | ||
- | |||
- | |||
</ | </ | ||
===Authenticate once connected=== | ===Authenticate once connected=== | ||
- | |||
- | |||
<sxh bash> | <sxh bash> | ||
[root@localhost ~]# mongo | [root@localhost ~]# mongo |