HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

can't update user password on Mongodb 4.0.5 (Use of SCRAM-SHA-256 requires undigested passwords)

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
canundigestedupdateusermongodbsha256requirespasswordpasswords

Problem

I'm trying to update a password from a user, using changeUserPassword(), and I just receive the following message:


Error: Updating user failed: Use of SCRAM-SHA-256 requires undigested passwords

> db
mydb
> db.getUsers()
[
    {
        "_id"  : "mydb.mongo",
        "user" : "mongo",
        "db"   : "mydb",
        "roles" : [
            {
            "role" : "dbOwner",
            "db" : "mydb"
            }
        ],
        "mechanisms" : [
            "SCRAM-SHA-1",
            "SCRAM-SHA-256"
        ]
    }
]

 > db.changeUserPassword("mongo", "mongo_n3w_p4ss");
2019-05-22T20:58:10.128-0500 E QUERY    [thread1] Error: Updating user failed: Use of SCRAM-SHA-256 requires undigested passwords :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
DB.prototype.updateUser@src/mongo/shell/db.js:1487:15
DB.prototype.changeUserPassword@src/mongo/shell/db.js:1491:9
@(shell):1:1
> db.version()
4.0.5


I also tried updateUser(), but no use.

What am I missing and what is the meaning of "requiring undigested password"?

Solution

Basically, I made it with db.updateUser.

On the doc, it says the following:

  • passwordDigestor : string




Optional. Indicates whether the server or the client digests the password.


Available values are:


"server" (Default)
The server receives undigested password from the client and digests the password.


"client" (Not compatible with SCRAM-SHA-256)
The client digests the password and passes the digested password to the server.


Changed in version 4.0: The default value is "server". In earlier versions, the default value is "client".

It seems that, the default was "client", by unknown reasons. By the way, my Mongo Shell Client is v3.6.3.

Therefore, I just defined passwordDigestor as server, and ok. Logged out and logged in with the new password.

> db.updateUser("mongo", {pwd:"mongo_n3w_p4ss", passwordDigestor:"server"});

Code Snippets

> db.updateUser("mongo", {pwd:"mongo_n3w_p4ss", passwordDigestor:"server"});

Context

StackExchange Database Administrators Q#238847, answer score: 4

Revisions (0)

No revisions yet.