2026-03-12 21:01:38
This commit is contained in:
24
tiddlywiki/MongoDB - enable authentication using SCRAM-SHA-1.txt
Executable file
24
tiddlywiki/MongoDB - enable authentication using SCRAM-SHA-1.txt
Executable file
@@ -0,0 +1,24 @@
|
||||
-- create database for user management
|
||||
use admin
|
||||
-- create first superuser
|
||||
> db.createUser({ user: "superhero", pwd: "secret", roles: ["root"]});
|
||||
-- to list all users
|
||||
> show users
|
||||
|
||||
-- add in MongoDB configuration file ->
|
||||
security:
|
||||
authorization: 'enabled'
|
||||
<-------------------------------------
|
||||
|
||||
-- restart MongoDB
|
||||
systemctl stop mongod
|
||||
systemctl start mongod
|
||||
|
||||
-- to connect within mongo shell
|
||||
> use admin
|
||||
> db.auth('superhero', 'secret');
|
||||
|
||||
-- authentification at mongo shell connection
|
||||
mongo --host frdrpsrv4483 --username "superhero" --password "secret" --authenticationDatabase "admin"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user