Skip to content

DOCS-2161 new create user syntax #1371

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -65,54 +65,30 @@ Create Users and Privilege Documents
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For every user that you want to be able to authenticate using Kerberos,
you must create corresponding privilege documents in the
you must create a corresponding user document in the
:data:`system.users <admin.system.users>` collection to provision
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this bit probably needs to change to say something like "using the user management methods/commands"

access to users. Consider the following document:

.. code-block:: javascript

{
user: "application/[email protected]",
roles: ["read"],
userSource: "$external"
}

This grants the Kerberos user principal
``application/[email protected]`` read only access to a
database. The :data:`~admin.system.users.userSource`
``$external`` reference allows :program:`mongod` to consult an
external source (i.e. Kerberos) to authenticate this user.
access for the user.

In the :program:`mongo` shell you can pass the :method:`db.addUser()`
a user privilege document to provision access to users, as in the
following operation:

.. code-block:: javascript

db = db.getSiblingDB("records")
db = db.getSiblingDB("$external")
db.addUser( {
"user": "application/[email protected]",
"roles": [ "read" ],
"userSource": "$external"
"roles": [ { "role":"read", db:"records"} ]
} )

These operations grants the Kerberos user
``application/[email protected]`` access to the ``records``
database.

To remove access to a user, use the :method:`~db.collection.remove()`
method, as in the following example:

.. code-block:: javascript

db.system.users.remove( { user: "application/[email protected]" } )

To modify a user document, use :doc:`update </core/write-operations>`
operations on documents in the :data:`system.users
<admin.system.users>` collection.
This grants the Kerberos user principal
``application/[email protected]`` read-only access to the
``records`` database. Creating a user on the ``$external`` database allows
:program:`mongod` to consult an external source (i.e. Kerberos) to
authenticate this user.

.. seealso:: :doc:`/reference/privilege-documents` and
:doc:`/reference/user-privileges`.
To remove access to a user or to modify a user document, see
:doc:`/administration/security-access-control`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

won't there be a tutorial for this that would be better to link to? How should we remember this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Jira ticket?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DOCS-2283


Start ``mongod`` with Kerberos Support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down