You are on page 1of 1

Search… Log In Sign Up

Home

PUBLIC

Stack Overflow

Tags
Can't connect to MongoDB with authentication enabled Ask Question
Users

Jobs I'm running the latest MongoDB for Ubuntu 14.04 asked 3 years, 4 months ago

I have created a user named "admin" with "userAdminAnyDatabase" role viewed 14,607 times
4
Teams I can access databases locally and externally active 1 year, 6 months ago
Q&A for work
I can login with "admin' with SHA-SCRAM-1
Learn More
When I edit to config file to restrict access only with authentication things go wrong. What happens:
1
1. I uncomment "#auth = true" in the config file.
2. I cannot access with the correct credentials of the "admin" account.

Bear in mind that I do use "service mongod restart" after making changes.

Config file for reference:


p ,
# http://docs.mongodb.org/manual/reference/configuration-options/

# Where and how to store data.


storage:
dbPath: /var/lib/mongodb
journal:
enabled: true
# engine: Work from anywhere
# mmapv1:
# wiredTiger:
Cloud- Docker Engineer
# where to write logging data.
systemLog: Elastic No office location
destination: file REMOTE
logAppend: true java docker
path: /var/log/mongodb/mongod.log

# network interfaces Director of Engineering


net: 7 Cups No office location
port: 27017 $170K - $200K REMOTE
bindIp: 0.0.0.0
php node.js

#processManagement:
Work remotely - from home or wherever you
choose.
#security:
#auth = true
#operationProfiling: Browse remote jobs

#replication:

#sharding: 65 people chatting

## Enterprise-Only Options:
Linked
#auditLog:
#snmp:
6 MongoDB permissions: restrict access to
two databases
Snapshot of database for reference:
1 Cannot connect with authentication to
mongodb?

Related

5148 The definitive guide to form-based website


authentication

707 MongoDB vs. Cassandra

1166 How to query MongoDB with “like”?

13 Set dbpath in MongoDB homebrew


installed (Mac OS)

-1 MongoDB replica sets with arbiter

0 Start mongo 3 on wiredTiger right after


installation

13 Error while upgrading Mongodb from 3.2 to


3.6

1 MongoDB log rotation

What's going wrong?


Hot Network Questions
mongodb authentication database Why does alert(0.-5) print -5?

How can guns be countered by melee combat


share improve this question edited Sep 22 '17 at 17:57 asked Oct 22 '15 at 17:58 without raw-ability or exceptional explanations?

Community ♦ ManyQuestions Is there a non trivial covering of the Klein bottle by


1 1 539 1 10 30 the Klein bottle

Co-worker sabotaging/undoing my work. (Software


Which version of the manager are you using? Can you access mongo from the cli? – bambam Oct 24 '15 at Development)
19:16 Minimum Viable Product for RTS game?
Using version 3.1.0.5 and yes I can, until I enable authorisation. – ManyQuestions Oct 24 '15 at 19:36 How do I avoid the "chosen hero" feeling?

Are you sure that manager supports SHA-SCRAM-1? – Danny Varod Oct 24 '15 at 20:13 Why is "rm -r" unable to delete this folder?

@DannyVarod It's an option in a ListView when creating a new connection so it should :) – ManyQuestions Why do neural networks need so many examples
Oct 24 '15 at 21:40 to perform?

what command you are using for that may i know ? I have done the same thing in ubuntu 15.x version – How do dictionaries source attestation?
Alok Deshwal Oct 25 '15 at 3:19
Is there a way to pause a running process on
Linux systems and resume later?
show 1 more comment
Limit at infinity for complex functions

2 Answers active oldest votes Why is Shelob considered evil?

Taking an academic pseudonym?

"I showed the monkey himself in the mirror". Why


I think that auth = true is an invalid configuration and your mongod is not starting because of it. To is this sentence grammatical?
enable authorization, try using the following instead:
Sensor logger for Raspberry Pi in a stratospheric
7 security:
probe

authorization: enabled Is it possible to detect 100% of SQLi with a simple


regex?
Then, to connect to the database, make sure that your client is using the correct authentication How to not let the Identify spell spoil everything?
database and authentication mechanism. This can be done using the commmand line by the
Democratic Socialism vs Social Democracy
following command:
What is a good way to explain how a character
mongo localhost -u admin -p myAdminPass --authenticationDatabase admin --authenticationMechani can produce flames from their body?

How can I take a waterfall's effect on a jump into


consideration mechanically?
share improve this answer edited Oct 25 '15 at 13:15 answered Oct 25 '15 at 3:32
XOR-free sets: Maximum density?
heenenee
16.9k 1 33 59 Critique vs nitpicking

How do I add a strong "onion flavor" to the biryani


I must've used an old version setting? I tried with the correct config and it actually makes no difference. Thanks (in restaurant style)?
though. – ManyQuestions Oct 25 '15 at 11:11
Why do single electrical receptacles exist?
@ManyQuestions I updated my answer to include the --authenticationDatabase command-line switch. I
am also not able to authenticate in my local MongoDB unless I specify it. I don't know how to specify it in your question feed
graphical client. Can you try it out please? – heenenee Oct 25 '15 at 13:16

There's a field in which you can give in the auth database – ManyQuestions Oct 25 '15 at 16:20

I just noticed this coming up though: 2015-10-25 T12:23:12.256-0400 I ACCESS [conn1] SCRAM-SHA-1
authentication failed for admin on admin from client xx.XX.xx.xx ; UserNotFound Could not find user
admin@admin – ManyQuestions Oct 25 '15 at 16:26

@ManyQuestions Maybe you created the user the old 2.X way? Try dropping and recreating the user with
db.createUser because you can get that error if you created it with db.addUser. – heenenee Oct 25 '15 at 16:58

show 1 more comment

Finding answers within your organization can be as easy as finding this one... Learn more

1. Did you follow the instructions in Enable Client Access Control to create the user and enable
authentication?
2 2. What is the output of your log, when you try to access mongoDB with credentials?
3. Did you tell mongoDB somewhere to use the config file? Try to start mongoDB locally on the PC
mongoDB is running with mongod --config ../etc/mongod.conf and then try to connect from
your Windows PC like you did before.

share improve this answer answered Oct 30 '15 at 13:20


Huber
481 4 22

add a comment

Your Answer

Sign up or log in Post as a guest


Name
Sign up using Google

Sign up using Facebook Email


Required, but never shown

Sign up using Email and Password

Post Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie
policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged mongodb authentication database

or ask your own question.

STACK OVERFLOW PRODUCTS COMPANY STACK EXCHANGE Blog Facebook Twitter LinkedIn
NETWORK
Questions Teams About
Technology
Jobs Talent Press
Life / Arts
Developer Jobs Directory Engagement Work Here
Culture / Recreation
Salary Calculator Enterprise Legal
Science
Help Privacy Policy
Other
Mobile Contact Us site design / logo © 2019 Stack Exchange Inc; user contributions
licensed under cc by-sa 3.0 with attribution required.
Disable Responsiveness rev 2019.2.22.32933

You might also like