MongoDB not authorized for query admin.system.users
Firstly you should to run mongod on localhost without --auth
and create user with necessary roles that you needed. In your case you should add userAdminAnyDatabase
or userAdmin
role. Than you could run mongod with --auth
and authenticate by this user for have remote access to system.users
collections.
You could read about it here.
MongoDB - admin user not authorized
I was also scratching my head around the same issue, and everything worked after I set the role to be root when adding the first admin user.
use admin
db.createUser(
{
user: 'admin',
pwd: 'password',
roles: [ { role: 'root', db: 'admin' } ]
}
);
exit;
If you have already created the admin
user, you can change the role like this:
use admin;
db.grantRolesToUser('admin', [{ role: 'root', db: 'admin' }])
For a complete authentication setting reference, see the steps I've compiled after hours of research over the internet.
Update role user: not authorized on admin to execute command
I was updating roles with the wrong command here is the right one:
db.grantRolesToUser( "mongoadmin", [{ role: "read", db: "local"}])
Now I can check the replicainfo:
rep0:PRIMARY> rs.printReplicationInfo()
configured oplog size: 990MB
log length start to end: 617347secs (171.49hrs)
oplog first event time: Thu May 14 2015 14:25:04 GMT+0200 (CEST)
oplog last event time: Thu May 21 2015 17:54:11 GMT+0200 (CEST)
now: Thu May 21 2015 17:54:24 GMT+0200 (CEST)
Can't access collections and data on mongo though userAdmin
The myadmin
user has userAdminAnyDatabase
privileges. This means the user can grant any privileges to any user in any database, but it doesn't give the user permissions to do non-user management operations. The solution is to use the myadmin
user's user administration privileges to grant itself more privileges. For query operations on any database, grant the readWriteAnyDatabase
role. There's lots of built-in roles to choose from.
MongoDB not authorized for query - code 13
You need to assign the read
role to the user in question.
The dbAdmin
role does not include read access on non-system collections.
Able query only admin database
You need to give your admin user the role readWriteAnyDatabase
in order to allow that user to query other databases.
You may want to also consider giving your admin user dbAdminAnyDatabase
and clusterAdmin
roles.
Related Topics
Why Does Zookeeper Not Use My Log4J.Properties File Log Directory
How to Specify Filenames Within a Zip When Creating It on the Command Line from a Pipe
Best Way to Monitor File System Changes in Linux
Linux Shared Library That Uses a Shared Library Undefined Symbol
Simulate a Faulty Block Device with Read Errors
Reliability of Linux Kernel Add_Timer at Resolution of One Jiffy
How to Get Coordinates of Touchscreen Rawdata Using Linux
Identifying Received Signal Name in Bash
Finding Process Count in Linux via Command Line
Change Default Console Loglevel During Boot Up
Differencebetween Pthread_Self() and Gettid()? Which One Should I Use
How to Tell Cmake I Want My Project to Link Libraries Statically
How to Compile Simple C Program in Linux Mint 15
Device Tree Compiler Not Recognizes C Syntax for Include Files
Script to Change Password on Linux Servers Over Ssh