3

Enabling Authentication

 3 years ago
source link: https://www.percona.com/doc/percona-server-for-mongodb/4.4/enable-auth.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Enabling Authentication

By default, Percona Server for MongoDB does not restrict access to data and configuration.

To enable authentication and automatically set it up, run the /usr/bin/percona-server-mongodb-enable-auth.sh script as root or using sudo. This script creates the dba user with the root role. The password is randomly generated and printed out in the output. Then it restarts Percona Server for MongoDB with access control enabled. The dba user has full superuser privileges on the server. You can add other users with various roles depending on your needs.

For usage information, run the script with the -h option.

To enable access control manually:

  1. Add the following lines to the configuration file:

    security:
      authorization: enabled
    
  2. Run the following command on the admin database:

    > db.createUser({user: 'USER', pwd: 'PASSWORD', roles: ['root'] });
    
  3. Restart the mongod service:

    $ systemctl restart mongod
    

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK