Database
...
MongoDB
Examples of authorization sett...

Setting up authorization in Linux

9min

Connect and create a user in MongoDB

Connecting to shell

Connect to the MongoDB shell:

Shell


Creating a user

Switch to the admin database:

Shell


Create a user by changing the Login (user) and Password (pwd) of the user:

Shell


In MongoDB, you cannot use the characters .,@,$,:,%,",',/,\,| in usernames and passwords, as this can cause issues with connection of the application server to MongoDB

If a MongoDB replica set is used, you must add the cluster manager role to the user:

Shell


Enable authorisation and connect Passwork

Enabling authorization in MongoDB

You need to edit the MongoDB config file to enable authorisation, run the following commands in the shell to get the location:

Shell


Edit the resulting configuration file by adding a line:

Shell


Save the changes and restart the MongoDB service:

Shell


To test, connect to the shell with authorisation:

PowerShell


Setting up and connecting Passwork with authorization

You need to edit the [mongo] section of Passwork configuration file at /<passwork>/conf/keys/config.ini and specify the login and password of the created user:

Shell


Save the changes and refresh the Passwork page to test the connection with MongoDB authorisation.