skip to Main Content

i am using mongo db and it has 10 collections and from them one of the collection (system.users) has sensitive information like this

db.system.users.find()

{ "_id" : ObjectId("6572c3c6a9f24c464097225a"), "user" : "admin", "pwd" : "password", "roles" : [ "readWrite", "databaseName" ], "_class" : "com.package.MongoDbConfig$UserCredentials" }

when i am trying to take the mongodump i am getting getting 9 collections only and unable to get the system.users collection.

command

mongodump --host localhost --port 27017 --db database -u admin-p password --out /path

and i tried to run the with credentials also bet getting this issue

mongodump --host localhost --port 27017 --db database --out /path

Error:

Failed: can't create session: failed to connect to mongodb://localhost:27017/: connection() error occurred during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AuthenticationFailed) Authentication failed

Note: I don’t have any password-based authentication to mongo db, it will be directly access

please help me

Thanks

2

Answers


  1. Chosen as BEST ANSWER

    mongodump --host localhost --port 27017 --db database --collection system.users --out /path


  2. Is your users collection in your database or it is a separate collection in different database?

    If in same database and If you are connected to your mongodb server,Try this in terminal.

    mongodump --db yourDbName --authenticationDatabase yourAuthDb(eg:admin) --username yourUserName --password yourPassword --out /pathToDump
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search