Skip to content

Activating the User Authentication


Single System and Replica Set Primary

The user authentication of MongoDB is disabled by default. Activate the user authentication to enhance the security.

Execute the following shell script as administrator:

/opt/seal/seal-mongodb/secure-mongo.sh

Secondary Members of the Replica Set

  1. Copy the key file created by secure-mongo.sh on the replica set primary

    /opt/seal/etc/mongod.keyfile
    

    into the same directory on your current member of the replica set:

    /opt/seal/etc
    
  2. Add the following lines to the /opt/seal/etc/mongod.conf file:

    security:
      authorization: enabled
      keyFile: /opt/seal/etc/mongod.keyfile
    
  3. Restart MongoDB:

    sudo systemctl restart mongod
    
  4. Proceed with step 1 on the next member of the replica set.